Skip to content

refactor(ui): own chat context subscriptions in Solid - #174289

Merged
steipete merged 1 commit into
mainfrom
solid2/w-idiom2-chat-context-isolated
Oct 16, 2026
Merged

steipete merged 1 commit into
mainfrom
solid2/w-idiom2-chat-context-isolated

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Chat kept context subscriptions in a host controller alongside the mounted Solid presentation. Configuration and theme notifications duplicated existing watches, while model-auth events had their own Gateway listener beside the pane's ordered event owner.

The mounted runtime now owns plugin/navigation projections and picker-dismissal cleanup. Input ownership, approval reconciliation, and runtime-configuration callbacks remain synchronous and use the existing chat-state cleanup lifetime. Model-auth invalidation joins the existing Gateway listener. The context object is exposed to its rendering consumer; no new store or context fallback is introduced.

The context controller and duplicate watches are removed. Native-Gateway observation and the Board lease controller remain unchanged: the native helper belongs to an overlapping active migration, and Board lease selection must keep its synchronous hidden-pane custody. Tags, markup, styles, routes, selectors, and lazy boundaries are unchanged.

Evidence

Check Result
Mounted context/subscription tests Both cases passed: parked updates, reveal, disposal/remount, model-auth events and listener cleanup
pnpm tsgo:ui Passed
Scoped lint, formatting, git diff --check Passed
Production Knip Passed on the corrected final tree
Independent Codex review, P0–P2 No actionable findings in predecessor and final narrowed reviews
Full UI, browser-extension, real-Gateway coverage ci:full requested

No local full suites, E2E or build: rendering output and startup imports do not change. PR CI owns broad and performance proof.

Size and idiom census

Four touched production files: 2,280 → 2,268 LOC (−12). Chat-owned subscription controller objects 3 → 2. Literal controller-pattern references 19 → 21 because previously hidden notification calls become explicit synchronous callbacks; createEffect 1 → 1, untrack 1 → 1, native listener references 8 → 8.

Final CI result

Run 38913602480 passed with full UI, browser-extension and real-Gateway coverage. Startup JavaScript measured 339,383 B gzip across 7 requests, with 1 CSS request / 38,786 B. The lazy chat-route bundle grew 170 B gzip for the owner-bound projections; startup boundaries are unchanged. Merged as b203feaf4d4af207f4d77862e5ed5da418ce168f.

@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-16T14:13:51.304256Z 2889491 PR opened
ℹ️ 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.

@steipete
steipete enabled auto-merge (squash) October 16, 2026 14:17
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 chat presentation subscriptions and picker cleanup into Solid while consolidating model-auth events into the existing Gateway listener.

Example: A retained chat pane is hidden while navigation changes navCollapsed from false to true.

  • Before: The host subscription requests a pane update.
  • After: The Solid projection parks rendering and reads the latest navigation state on reveal.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, narrowly scoped refactor with mounted lifecycle coverage, held by one concrete rendering regression.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is outside the ordinary contributor proof gate; its supplied evidence exercises mounted runtimes with fixture Gateway responses rather than a shipped browser session.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No intended visible change; legacy host subscriptions duplicate lifetime ownership beside the mounted Solid view.
Reason: The maintainer-authored direction reduces duplicate subscriptions and preserves synchronous domain ownership without adding configuration or a parallel store.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this PR open: the focused ownership refactor is worthwhile, but its replacement input-owner subscription drops a render invalidation and can leave composer presentation stale.

Priority: P2
Reviewed head: 288949164993229516aa193b06e9f3b618c2e755

Before merge

  • Invalidate the pane after input ownership changes (P2) - The previous watchStore callback ran activeChanged and then requested a host update; this direct subscription runs only activeChanged. With an already mounted page conversation and a different Home dock conversation, focusing between regions can change the effective active getter without changing either pane's selected property. activeChanged updates native bindings and aria-live but does not request rendering, so the composerPredictions.active boolean captured in chat-pane-render.ts remains stale: the old region can retain its prediction while the newly focused region remains ineligible until an unrelated update. Request a pane update after the synchronous callback.
  • Explain or restore the original intent of Input-owner subscription - b86ea6c: The Home dock introduced one application input owner and a watch that synchronizes active bindings while notifying rendering.

Findings

  • [P2] Invalidate the pane after input ownership changes — ui/src/pages/chat/chat-pane-base.ts:179-181

Provenance

  • Input-owner subscription changes intended behavior without addressing why it exists (b86ea6c: The Home dock introduced one application input owner and a watch that synchronizes active bindings while notifying rendering.)

Tests

  • Missing end-to-end proof: The supplied tests do not check rendered prediction eligibility across page/dock input handoffs, and no failing-base run is reported.
Agent review details

How this fits together

Control UI chat runtimes consume application capabilities and ordered Gateway events, maintain synchronous conversation state, and publish frames to retained Solid views.

flowchart LR
  A[Application capabilities] --> B[Synchronous chat runtime]
  C[Gateway events] --> B
  A --> D[Solid projections]
  B --> E[Parked render lifecycle]
  D --> E
  E --> F[Chat pane and composer]
Loading

Technical review

Best possible solution:

Keep the Solid ownership cutover and restore the pane render notification after synchronous input-owner reconciliation.

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

Source tracing establishes that input-region changes no longer invalidate rendered active-dependent props; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The ownership split fits the existing architecture, provided the direct input subscription preserves both synchronous reconciliation and rendering notification.

Full review comments:

  • [P2] Invalidate the pane after input ownership changes — ui/src/pages/chat/chat-pane-base.ts:179-181
    The previous watchStore callback ran activeChanged and then requested a host update; this direct subscription runs only activeChanged. With an already mounted page conversation and a different Home dock conversation, focusing between regions can change the effective active getter without changing either pane's selected property. activeChanged updates native bindings and aria-live but does not request rendering, so the composerPredictions.active boolean captured in chat-pane-render.ts remains stale: the old region can retain its prediction while the newly focused region remains ineligible until an unrelated update. Request a pane update after the synchronous callback.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Model-auth event invalidation keeps the original intent (0125ffa: Account recovery required mounted composers to refresh account identity after committed auth changes.)
  • Picker dismissal lifetime keeps the original intent (23b9b82: Mounted composers share document dismissal listeners and release them after the last owner disconnects.)
  • Solid presentation lifetime keeps the original intent (6c444b6: The mounted Solid view owns presentation refreshes while hidden panes park rendering and synchronous runtime state stays authoritative.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/pages/chat/chat-pane-subscriptions.test.ts ui/src/pages/chat/chat-pane-retained-presentation.test.ts --maxWorkers=1
  • pnpm tsgo:ui
  • git diff --check

What I checked:

  • Pinned introduced change: The introduced diff replaces the input-owner watchStore with a direct subscription, removes the context subscription controller, and moves plugin/navigation projections and picker cleanup into the mounted Solid view. (ui/src/pages/chat/chat-pane-base.ts:180, 288949164993)
  • Lost notification contract: SubscriptionsController.watchStore synchronizes its callback and requests a host update on notifications; the replacement invokes only activeChanged, whose implementation updates bindings and aria-live without invalidating the pane. (ui/src/pages/chat/chat-pane-retained-presentation.ts:443, 288949164993)
  • Rendered consumer affected: Composer prediction eligibility captures this.active in the rendered frame; ComposerPredictionController subsequently uses that captured active value to retain or dismiss suggestions. (ui/src/pages/chat/chat-pane-render.ts:452, 288949164993)
  • Current-main behavior and feature history: Fetched main retains the original subscriptions; history traces the input-owner watch to the Home dock implementation and the auth invalidation to account recovery, rather than merely their latest formatting edits. (ui/src/pages/chat/chat-pane-base.ts, ca009ba036a8)
  • Discussion and validation: The complete live comments contain automation status and a prior review summary, with no additional runtime artifact; the body reports two mounted tests, UI types, lint, formatting, and Knip, while UI and real-Gateway CI remain in progress. (288949164993)
  • Applied review policy and local limits: Read root and UI AGENTS.md plus Solid and test-review guidance; no deeper UI AGENTS.md or maintainer-notes directory exists, and the installed Solid cheatsheet is unavailable in this checkout. (ui/AGENTS.md:7, 288949164993)

PR surface

Source -12, Tests +121. Total +109 across 6 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 38 50 -12
Tests 2 121 0 +121
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 159 50 +109

Review metrics

Metric Value Why it matters
Production versus test LOC Production +38/-50; tests +121/-0 Production shrinks by 12 lines; test growth covers parking, remounting, auth invalidation, and cleanup.

Labels

Label changes:

  • add P2: The introduced input-focus handoff regression can leave composer presentation stale, with limited scope and recovery through a subsequent update.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The introduced input-focus handoff regression can leave composer presentation stale, with limited scope and recovery through a subsequent update.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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, 10:26 AM ET / 14:26 UTC.

@steipete
steipete merged commit b203fea into main Oct 16, 2026
101 of 103 checks passed
@steipete
steipete deleted the solid2/w-idiom2-chat-context-isolated branch October 16, 2026 14:30
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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