Skip to content

feat: suggest the next prompt in PlatformClaw web chat - #413

Merged
iililiiilili merged 4 commits into
mainfrom
feature/composer-predictions
Oct 28, 2026
Merged

iililiiilili merged 4 commits into
mainfrom
feature/composer-predictions

Conversation

@iililiiilili

@iililiiilili iililiiilili commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #412

What Problem This Solves

PlatformClaw Web users currently write every follow-up from an empty composer. This adds an optional suggested next question after a browser-submitted response completes, without sending a message or approving an action for the user.

Why This Change Was Made

Selectively adapt the upstream prediction lifecycle to the Lit composer. The existing admin HTTP plugin owns the isolated Fast request and SQLite account preference; the authenticated BFF owns identity, authorized personal/Space history, and cancellation; the composer owns presentation and keyboard/IME behavior. No prediction operation is exposed as an agent tool or Gateway WebSocket method.

Inference uses only the configured codemate/codellm-fast route, six recent user/assistant text messages capped at 300 Unicode characters each, and 64 output tokens. It has a ten-second whole-request deadline, one active request per Gateway process, no queue/retry/fallback, and ordinary model calls preempt speculative work. Private DNS destinations are pinned and redirects forbidden. Predictions are neither broadcast nor saved in chat history.

Existing menu keyboard handling and WebSocket response helpers are extracted unchanged to keep their owning modules bounded. No dependency, protocol-version, or SQLite schema-version change is included.

User Impact

Enable the server's plugins.entries.admin-http-rpc.config.composerPredictionsEnabled flag, then opt in under Settings > Appearance > Chat preferences. Both defaults are OFF; the account preference persists in the existing plugin SQLite keyed store.

Ghost Text stays separate from the draft. Tab inserts it without sending; Escape, typing, Korean IME composition, session changes, and a new response discard it. Enter keeps its existing behavior. Browser dispatch provenance prevents Knox, Cron, background, and API completions from triggering predictions, including unrelated completions in the visible session.

The standalone development-only preview works in a fresh browser tab and survives closing the browser. In a normal checkout, run pnpm platformclaw:composer-preview (linked-worktree instructions are documented); its banner distinguishes synthetic results from real LLM calls and offers success, delay, timeout, and busy scenarios.

Evidence

  • Final hosted CI: commit 89dc123a5f98c8ea2f3b0a4a2c763eb411f038d4 is green in CI run 40616633913 and PlatformClaw CI run 40616633914. All 79 reported checks are complete with no failures or pending checks; non-applicable checks are skipped. The PR remains Ready and mergeable.
  • Fresh autoreview: full-feature review plus fresh reviews of both final test-only corrections exited 0 with no accepted/actionable findings (patch is correct; default P0 threshold, Codex gpt-5.6-sol, high). TruffleHog scanned each exact change successfully. The local helper copy uses its existing Windows URI normalizer and one scanner worker; scan/finding scope and isolation are preserved. Codex isolation flags were personally checked in sibling codex-rs/exec/src/cli.rs:36-45.
  • Source identity: 37 changed files, based on e6dd20821eff090f37c1c6cae0569b9b23263c44, matched byte-for-byte across the worktree, review snapshots, and Linux proof. Final aggregate SHA256: 4f26c3f260194ff3c5f6b10d00885d6702aa486df74b379092228a8288a37d02.
  • Linux focused proof: Ubuntu 22.04.5 / Node 24.18 / pnpm 11.15.1; init-enabled task container, CPU 2 / memory 3 GiB, serial heavy-check lock. 44 plugin tests, 13 hook-boundary contracts, 270 chat/UI sibling tests, and 19 i18n tests passed. Three affected type configs (plugin production/tests and UI), i18n verification, full import-cycle analysis, and both full-tree Knip 6.8.0 configurations passed. Existing authenticated BFF/context/cancellation tests and control-plane type proof remain valid. Scoped lint/format and git diff --check passed.
  • Final hosted browser proof: all four E2E shards passed. Shard 2 passed all 52 files, explicitly including Composer (1 test), Memory product experience (5 tests), and Canvas Basic/Assigned VM (2 tests). The Composer scenario covers settings, browser provenance, Tab/Enter/Escape, typing/IME, delayed cancellation, busy skip, and timeout.
  • CI integration repairs: lifecycle hooks are registered at the plugin entry point while service-owned admission/cancellation stays intact; the route test exercises actual hook wiring. The IME path avoids an unnecessary render, the Tab cue uses i18n, the fixture import cycle is removed, the preview has a package command, and E2E uses the shared Chromium resolver. Exact hook contracts were updated; file allowlists, detectors, equality checks, raw-copy baselines, assertions, and timeouts were preserved. The final UI test helper explicitly requires JSON string bodies; typed lint reproduced the two original findings before the fix and zero afterward, and its 8 actual controller tests passed.
  • Canvas test-owner repair: its inner-first pre-scroll can wait forever for animation frames in an offscreen iframe. A normal Playwright 1.62 / Chromium 151 probe reproduced frozen rAF and zero clicks, while outer-first scrolling resumed rAF and delivered one trusted click in 197 ms. This matches Playwright's native iframe pointer ordering. One outer-frame scroll was added before the existing inner scroll; outer/inner stability, one native click, and per-document acknowledgment checks remain. Both complete Canvas operator scenarios passed locally and in final CI. No browser flags, forced clicks, or product behavior changed.

Validation limits and follow-ups

Initial local full-gate/type-lint attempts hit SDK preparation timeout or the fixed memory/swap budget; these attempts are retained as failures, not counted as passes. Final hosted full gates passed. A bounded task-only typed-lint mirror was used for the before/after diagnostic; it did not replace hosted validation. Optional video setup with an intentionally empty browser cache lacked ffmpeg; screenshots and later normal-cache Canvas recordings were preserved.

No company Fast endpoint/credentials are available here. Model availability/quality, measured GPU cancellation, and normal-chat latency under live load remain unverified. HTTP cancellation is propagated; stopping GPU work depends on the serving stack. Before enabling multiple Gateway instances, add a shared admission owner; the current limit is process-local.

Named follow-up: the Memory source-preview fixture seeds appearance records without explicitly selecting a Gateway. A standalone Vite observation showed saved dark preferences falling back to light; using the existing page-scoped selection restored dark. Product theme policy and Memory assertions remain unchanged; final hosted Memory tests passed. Independently triage existing default-branch dependency alerts; this PR changes no dependency version.

Review measurements

  • Runtime: +885/-87, net +798 lines, justified by the new capability and its authentication/context, inference/admission, and composer lifecycle owners.
  • Tests and development demo: +1021/-5; documentation: +100 lines. Final Canvas repair adds no production code.
  • New defaults: one server feature flag and one account preference, both OFF. Existing conversation model/fallback settings are untouched. No dependency, protocol-version, or SQLite schema-version change.

AI-assisted with Codex. No session transcript, credentials, internal endpoint, runtime database, or execution log is included in the branch.

@iililiiilili
iililiiilili marked this pull request as ready for review October 27, 2026 23:40
@iililiiilili
iililiiilili merged commit d46f20f into main Oct 28, 2026
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: suggest next prompts in PlatformClaw web chat

1 participant