Skip to content

refactor(ui): own composer suggestions in Solid stores - #174226

Merged
steipete merged 4 commits into
mainfrom
solid2/w-idiom2-chat-composer
Oct 16, 2026
Merged

steipete merged 4 commits into
mainfrom
solid2/w-idiom2-chat-composer

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Composer suggestions still used class-owned rendering state and manual host invalidation after the Solid migration.

User Impact

Preserves the existing mention, emoji, and next-message suggestion behavior, including keyboard selection, native undo, query caching, and stale-result cancellation. Chat, New Session, and the command palette share the migrated mention picker.

Why This Change Was Made

Moves suggestion presentation into Solid stores and factories, removes their host-update callbacks, and binds prediction cancellation to the component lifetime. Store draft updates preserve same-turn keyboard decisions without maintaining a second state copy. Retained pane/draft owners continue to own mention-cache disposal. External directory and geometry synchronization runs in effects; the remaining slash/skill and frame invalidation path is a separate cutover.

Evidence

Check Result
Focused tests 22 emoji cases, 14 mention-cache cases, and 16 prediction cases pass; targeted palette detach and New Session route-replacement regressions also pass
UI typecheck pnpm tsgo:ui passes
Targeted lint / formatting Pass; existing advisory reactivity/class warnings remain
Production Knip pnpm deadcode:knip passes
Production builds and strict performance Base 339,663 B gzip; head 339,658 B gzip; one startup CSS request on both
Visual proof Inspected synthetic Chat slash, mention, and emoji states at 1280×900; attached before/after images
Broad proof Final head 13349bd0005f passes full CI run 38912959154, including all UI unit, UI E2E, WebKit, and real-Gateway shards

Touched production files: 5,235 → 5,233 LOC (−2). Controller-pattern references: 35 → 14; native listener registrations: 3 → 1; render effects: 3 → 1; effects: 3 → 9; untrack: 10 → 13. Added effects synchronize external directory/search policy and popup geometry; untracked reads capture stable popup/palette identities and one-time placement. No startup import or lazy boundary changes.

Before: slash commands

After: slash commands

Before: mention results

After: mention results

Before: emoji completion

After: emoji completion

CI repair

The first CI run exposed a synchronous overlay-retirement loop during emoji acceptance, an unnecessary store reset during the palette's first render, and a plain skill-menu reset that did not notify the New Session view. The repair closes the emoji draft before retiring its overlay, skips resetting a fresh palette menu, and publishes the visible skill-menu closure. A browser probe confirms Tab inserts through the native editing command without errors.

The navigation/eviction failures in run 38904273398 are not claimed as inherited: the six shard-1 cases pass on scheduled main run 38902471699. The exact failing diagnostic-runtime route test reproduced a store write during pane eviction (REACTIVE_WRITE_IN_OWNED_SCOPE / REACTIVITY_HALTED). Pane and New Session teardown now release emoji resources without writing presentation state. The same route test passes (1 case, 4 skipped), as do focused acceptance regressions. Replacement run 38908774669 passes all UI E2E and real-Gateway shards, all WebKit overlay/focus tests, and the composer regressions. Its remaining failures are the test-only unbound-method lint error corrected in this head and the independent native-fixture timeout described below.

Replacement-run attribution

Run 38908774669 timed out in control-ui-e2e-suite.test.ts at joins scenario cleanup or retires the unsafe fork and retains its state: scenario-timeout. The retained unjoined child then caused seven deliberate guard failures: the scenario-noncooperative, scenario-late-close, scenario-close-failure, resources-success, resources-close-failure, resources-late-setup, and resources-browser-failure cases. The fixture mocks Chromium and uses a synthetic server; it does not import the composer. Its test, suite helper, managed-child shutdown helper, isolated-state owner, cleanup helper, and diagnostic sources are byte-identical between this PR's base and head.

Those eight exact cases pass in scheduled main run 38908699969, but main uses Node while the failing invocation uses Bun. This is source-unrelated native-fixture timeout evidence, not a claim of the same failure reproduced on main. The underlying Bun delay remains unproven. A focused test-spy correction fixes this PR's separate typescript(unbound-method) lint error; type-aware lint and both affected Chat/New Session acceptance cases pass locally.

Final head 13349bd0005f16602ef9305a78c32810ee28e8aa passed full run 38912959154 without exceptions. The native workflow merged that exact head as 3ca8c08ef47ca567bd844f969f6b6b24611ce5d1; the unrelated Bun fixture timeout did not recur. No CI rerun or admin bypass was used.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T13:36:53.443029Z e236893 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR moves mention, emoji, and follow-up suggestion presentation into Solid stores and factories.

Example: Type @casey in the Chat composer.

  • Before: The class-owned picker displays Casey Vale through manual host invalidation.
  • After: The Solid store drives the same picker and selection presentation.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful, approved refactor with visual parity evidence, but the lifecycle cutover introduces concrete defects and exact-head CI confirms a stale-menu regression.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor-proof gate is waived for this maintainer-authored PR; inspected Chat screenshots support slash and mention visual parity, while tests support prediction cleanup.
Patch quality 🦪 silver shellfish (2/6) 3 actionable review findings remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Suggestion presentation still depends on class-owned render state and manual host invalidation after the Solid migration.
Reason: The maintainer-authored direction removes obsolete presentation ownership while preserving existing features and draft authority.

Merge readiness

⛔ Needs changes before merge - 3 items remain

Keep this maintainer-authored refactor open; its direction is approved, but three introduced lifecycle and rendering defects need repair.

Priority: P2
Reviewed head: 9de13ef02b79687c1c32639a22e07885f03a5b30

Before merge

  • Invalidate the frame after resetting the skill owner (P2) - Opening the skill picker and then changing draftOwnerKey computes frame().skillMenuVisible from the old plain skill state before this effect runs. syncSkillCommandOwner subsequently resets that state without notifying or invalidating the cached frame, so the previous draft's picker remains visible. The existing draft-route test fails at composer.test.tsx:329 in exact-head CI. Preserve synchronous owner reconciliation before projecting visibility, or publish its reset through the existing owner.
  • Separate emoji disposal from reactive presentation reset (P2) - close() now invokes a store setter, but retained disposal paths still call it from owned cleanup. For example, PendingSessionCreateContent.onCleanup calls resetChatComposerState, and NewSession page cleanup reaches composerTextarea.disconnect; both call emojiMenu.close. When those branches retire during a reactive transition, Solid rc.14 rejects the setter with REACTIVE_WRITE_IN_OWNED_SCOPE before anchor and remaining owner cleanup finish. Provide a resource-only disposal path and migrate these cleanup callers instead of publishing store state during teardown.
  • Apply queued palette opens outside the component body (P2) - Calling openPalette before the bridge has mounted records pendingOpen. On mount, command-palette.tsx:63 consumes it inside the component body by calling CommandPaletteState.openPalette, which immediately calls mentionMenu.close. This newly added store setter is rejected even when the menu is already closed, so development builds fail before initializing and displaying the queued draft. Move the queued opening to a permitted lifecycle boundary while preserving the existing input handoff.

Findings

  • [P2] Invalidate the frame after resetting the skill owner — ui/src/pages/new-session/composer.tsx:453-455
  • [P2] Separate emoji disposal from reactive presentation reset — ui/src/pages/chat/components/chat-composer-emoji.tsx:64-68
  • [P2] Apply queued palette opens outside the component body — ui/src/pages/chat/components/chat-composer-mention-menu.tsx:379

Tests

  • Missing end-to-end proof: The supplied screenshots do not exercise draft replacement, queued palette opening, or cleanup during a reactive transition; base-versus-head proof for these failures was not supplied.
Agent review details

How this fits together

Chat, New Session, and the command palette consume shared suggestion owners; textarea events and Gateway responses enter them, and menu presentation or selected draft text leaves them.

flowchart LR
  A[Textarea events] --> B[Suggestion factories]
  C[Gateway directory and prediction responses] --> B
  B --> D[Solid presentation stores]
  D --> E[Composer suggestion views]
  E --> F[Existing draft owners]
Loading

Technical review

Best possible solution:

Keep the Solid presentation cutover while preserving synchronous scope resets and separating live presentation updates from lifecycle disposal.

Do we have a high-confidence way to reproduce the issue?

The draft-route failure is recorded in exact-head CI, and source plus the pinned Solid runtime establishes the two owned-scope write paths; no target code was executed during this review.

Is this the best way to solve the issue?

The presentation-store direction fits the existing Solid migration, but the cutover must update retained lifecycle callers and preserve frame invalidation after synchronous owner changes.

Full review comments:

  • [P2] Invalidate the frame after resetting the skill owner — ui/src/pages/new-session/composer.tsx:453-455
    Opening the skill picker and then changing draftOwnerKey computes frame().skillMenuVisible from the old plain skill state before this effect runs. syncSkillCommandOwner subsequently resets that state without notifying or invalidating the cached frame, so the previous draft's picker remains visible. The existing draft-route test fails at composer.test.tsx:329 in exact-head CI. Preserve synchronous owner reconciliation before projecting visibility, or publish its reset through the existing owner.
    Confidence: 0.99
  • [P2] Separate emoji disposal from reactive presentation reset — ui/src/pages/chat/components/chat-composer-emoji.tsx:64-68
    close() now invokes a store setter, but retained disposal paths still call it from owned cleanup. For example, PendingSessionCreateContent.onCleanup calls resetChatComposerState, and NewSession page cleanup reaches composerTextarea.disconnect; both call emojiMenu.close. When those branches retire during a reactive transition, Solid rc.14 rejects the setter with REACTIVE_WRITE_IN_OWNED_SCOPE before anchor and remaining owner cleanup finish. Provide a resource-only disposal path and migrate these cleanup callers instead of publishing store state during teardown.
    Confidence: 0.97
  • [P2] Apply queued palette opens outside the component body — ui/src/pages/chat/components/chat-composer-mention-menu.tsx:379
    Calling openPalette before the bridge has mounted records pendingOpen. On mount, command-palette.tsx:63 consumes it inside the component body by calling CommandPaletteState.openPalette, which immediately calls mentionMenu.close. This newly added store setter is rejected even when the menu is already closed, so development builds fail before initializing and displaying the queued draft. Move the queued opening to a permitted lifecycle boundary while preserving the existing input handoff.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 28f5f250e113.

Provenance checked

  • Mention, emoji, and prediction behavior keeps the original intent (516fbb2: Human mentions require explicit selection; subsequent emoji and prediction features preserve native editing and reject stale results. The supplied linked PR descriptions and local history establish these contracts.)
  • Solid presentation ownership changes intended behavior with a stated reason (07384e0: The original Solid port retained plain TypeScript owners and stable composer DOM; this PR explains the narrower migration of suggestion presentation into stores.)
  • New Session skill scope synchronization keeps the original intent (88e8716: The previous rendering path synchronized client, agent, and draft ownership before projecting skill-menu visibility, retiring results from the previous scope.)
  • Command palette synchronous handoffs keeps the original intent (cbfea5e: The preceding refactor retained synchronous search and draft handoffs while Solid owned subscriptions and rendering; queued opening remains an explicit bridge contract.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm --dir ui test src/pages/new-session/composer.test.tsx src/components/command-palette.test.ts src/components/command-palette-lifecycle.test.ts
  • pnpm --dir ui test src/pages/chat/chat-composer-emoji.test.ts src/pages/chat/chat-composer-mentions-cache.test.ts src/pages/chat/chat-composer-prediction.test.tsx
  • pnpm tsgo:ui
  • git diff --check

What I checked:

  • Pinned introduced change: The introduced diff replaces suggestion classes and callbacks across all three composer consumers; fetched main retains the previous implementations. (ui/src/pages/chat/components/chat-composer-mention-menu.tsx:91, 9de13ef02b79)
  • Draft replacement failure confirmed by CI: The checks-ui failure reports that the skill menu remains mounted after replacing draft:one with draft:two; the moved effect resets plain skill state after the frame has cached its visibility. (ui/src/pages/new-session/composer.tsx:454, 9de13ef02b79)
  • Reactive writes remain reachable during lifecycle work: Emoji close now calls a store setter, while pending-session and New Session cleanup still reach it through synchronous disposal; CI also records REACTIVE_WRITE_IN_OWNED_SCOPE in the command-palette suite. (ui/src/pages/chat/components/chat-composer-emoji.tsx:66, 9de13ef02b79)
  • Queued palette opening caller: The bridge consumes pendingOpen by calling openPalette inside its component body; openPalette calls the newly reactive mentionMenu.close before initializing the draft. (ui/src/components/command-palette.tsx:63, 9de13ef02b79)
  • Inspected visual evidence: The four prepared images show matching before/after slash and Casey Vale mention layouts. The two remaining emoji image downloads failed with curl error 23 because the scratch destination was not writable; this is a reviewer infrastructure limit. (9de13ef02b79)
  • Policy and inspection limits: Read the root and UI policies and applicable Solid/test guidance; no nested ui/src AGENTS.md or maintainer-notes directory was present. The installed cheatsheet was absent, so the exact pinned npm package contract was read instead. Raw CI logs redirected to a blocked Azure host, leaving other browser failures unattributed. (ui/AGENTS.md:5, 9de13ef02b79)

PR surface

Source -5, Tests +21. Total +16 across 16 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 13 703 708 -5
Tests 3 28 7 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 731 715 +16

Labels

Label changes:

  • add P2: The refactor introduces bounded composer rendering and development-runtime lifecycle failures that should be repaired before merge.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The refactor introduces bounded composer rendering and development-runtime lifecycle failures that should be repaired before merge.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 9:14 AM ET / 13:14 UTC.

@steipete
steipete enabled auto-merge (squash) October 16, 2026 14:16
@steipete
steipete merged commit 3ca8c08 into main Oct 16, 2026
94 of 95 checks passed
@steipete
steipete deleted the solid2/w-idiom2-chat-composer branch October 16, 2026 14:30
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* refactor(ui): own composer suggestions in Solid stores

* fix(ui): preserve composer menu lifecycle ordering

* fix(ui): release composer resources without publishing state

* test(ui): keep emoji overlay spy bound
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant