Repository navigation
refactor(ui): settle shell commits in the rendered lifecycle - #180137
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR makes the rendered shell acknowledge completed updates instead of scheduling completion through a detached callback. Example: The shell is invalidated twice, then unmounted before rendering finishes.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-owned refactor removes redundant lifecycle machinery without a concrete introduced defect, but two exact-head browser failures remain unattributed. Priority: P3 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Control UI shell projects synchronous application state into Solid-rendered navigation and routes, then releases update waiters used by focus restoration and other DOM-dependent actions. flowchart TD
A[Application state changes] --> B[Shell presentation owner]
B --> C[Shell revision]
C --> D[Rendered shell snapshot]
D --> E[Solid settled callback]
E --> F[Complete update waiters]
F --> G[Focus and shell follow-up]
Technical reviewBest possible solution: Retain the focused lifecycle cutover and qualify the exact-head browser failures before landing. Do we have a high-confidence way to reproduce the issue? This is a behavior-preserving refactor rather than a newly established product bug; source inspection confirms the detached scheduler and its replacement, and no target code was executed. Is this the best way to solve the issue? The change is the smallest coherent cutover: the existing synchronous owner retains completion promises, the mounted renderer acknowledges settlement, and the redundant scheduler token disappears. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 242ccbb10267. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -9, Tests +2, Other -1. Total -8 across 4 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 21, 2026, 10:12 PM ET / October 22, 2026, 02:12 UTC. |
|
Merged via squash.
|
…w#180137) * refactor(ui): settle shell commits in the rendered lifecycle * test(ui): seed visible details in subagent loading proof * test(ui): await committed chat before switching agents * test(ui): await lazy previews and diagnose agent navigation
Supersedes #180011 and #179478. Their retired workflow bindings and shared template remain untouched.
Checklist in the two touched production files:
Problem and solution
The synchronous shell owner scheduled DOM completion through a detached Solid callback and kept a separate pending token. A renderless keyed branch in the mounted shell now registers
onSettledfor each view snapshot, outside route readiness. The owner retains its coalesced completion promise; rendering settles it, and unmount settles outstanding work as false. This preserves focus-restoration ordering and removes the detached scheduler and token.Head
61d13f66a7a5639c1f5ceac865e47a6b28aeb9a5merges main0d0df35a139ac9e71a830691bcd115764740e585to refresh Security Review provenance after its protected workflow changed. The only conflict preserves main's removal of redundant attachment tests and retains asynchronous-preview waits. The six-file diff preserves markup, routes, selectors, lazy boundaries, dependencies, and domain ownership.Proof
pnpm tsgo:uici:fullThe paired CI comparison uses protected main
4c66fb3c8709971bbe8dc611431ef513ea5bcfddand tested integration treedb993f0e8ac86b0010c578edfc1fe703af743035. Both builds use one runner and installed toolchain. Earlier local paired numbers remain in the history below; the current CI comparison supplies refreshed-context budget proof without duplicate local builds.Production LOC: 675 → 666 (−9). Test deltas: shell +2, attachments +3, agent-selection +10. The owner-API baseline loses one allowance. No appearance change; lifecycle and full browser tests supply behavioral proof.
Knip reports these identical baseline paths:
src/auto-reply/heartbeat-reply-payload.tsandsrc/infra/{heartbeat-active-hours,heartbeat-delivery-normalization,heartbeat-dispatch,heartbeat-runner-config,heartbeat-runner-execution,heartbeat-runner-prompt,heartbeat-runner-run,heartbeat-runner-scheduler,heartbeat-runner-session,heartbeat-runner,heartbeat-session-publication,heartbeat-wake-policy}.ts. Both runs usedpnpm deadcode:knip; the exact 13-path comparison matches. No ignores or heartbeat source changes were added.An earlier head had intermittent agent-selection failures that could not be reproduced on its exact base or unchanged source. This PR retains failure-only diagnostics; it does not claim a proven navigation root-cause fix. Current full CI is green.
Earlier proof and replacement history
Current head:
61d13f66a7a5639c1f5ceac865e47a6b28aeb9a5, merged with main0d0df35a139ac9e71a830691bcd115764740e585to refresh Security Review provenance after its protected workflow changed. The only conflict preserves main's removal of redundant attachment tests and keeps the lazy-preview waits in the surviving tests. The six-file production change remains the same: 675 → 666 LOC (−9). Fresh independent P0–P2 review is scoped-clean. Current-head full CI and local proof refresh are in progress; the earlier exact-head results below remain historical evidence and are not claimed as current-head CI.Supersedes #180011 and #179478. The former is blocked by damaged native-review checkout metadata; the latter is pinned to retired workflow
1e48ec3a9e3f. This PR leaves their state and the shared template untouched.Current checklist in the touched production files (app family, two files):
Problem and solution
The synchronous shell owner scheduled DOM completion through a detached Solid callback and kept a separate pending token. A renderless keyed branch in the mounted shell now registers
onSettledfor each view snapshot, outside the route-readiness boundary. The owner retains its coalesced completion promise; rendering settles it, and unmount settles outstanding work as false. This keeps focus restoration in the same Solid drain and removes the detached scheduler and token.The existing regression mounts the real shell and retains its assertions for promise identity, caller disposal, and unmount cancellation. No visible markup, host tag, selector, class, route, lazy boundary, dependency, or domain authority changes.
Head
703dd9087d2659f8f9dc522db72b71072c5edf72merges mainb98018c4433de6a471c7b9376156193debd91af9. The sole conflict was the Details E2E fixture: main already fixes the empty-section timeout, so this merge keeps main's complete test and drops the redundant synthetic creator change. Head5e7b6ed1624ecc680cbb83fe39d567789a0c18b5adds a committed-route interaction precondition, waits for lazy attachment previews independently of the submit button, and records selection plus resolver/startup requests if agent navigation fails. The final diff is six files; production source is unchanged from703dd9087d2659f8f9dc522db72b71072c5edf72.Proof
pnpm tsgo:ui703dd908; production unchanged sincepnpm deadcode:knip703dd908; production unchanged sinceci:fullCIProduction LOC: 676 → 667 (−9). Shell-test LOC: +2; attachment-test LOC: +3; agent-selection E2E: +10. The owner API baseline loses one allowance. No new effects, listeners, queries, or manual component factories. No appearance change; existing behavior tests cover this lifecycle refactor.
The previous full run failed
reorders plugin sidebar tabs and keeps the order after reload(also fails on scheduled main 39707038848) andrestores the selected agent when a fresh shell reopens the canonical global session(not attributed as inherited). The latter passed once on CI’s actual main base4d86333f6a82117ede1c530fa0b2a3b70341bcaband once on the unchanged PR head using pinned Bun. A prior Node attempt stalled during loader setup and provides no behavioral evidence.The agent-selection fixture now waits for a successful committed chat route before opening the agent menu. Roster readiness alone permits non-success route states; this explicitly establishes the interaction precondition. All existing click, route, reopen, identity, and persistence assertions remain. The updated test passed (1/1), as did the E2E typecheck. This is not claimed as a proven explanation of the intermittent failure; fresh full CI qualifies the new head.
Run 39712655459 repeated
restores the selected agent when a fresh shell reopens the canonical global session, before the reopen/persistence assertions: clicking OpenClaw left/chat/dummy. The readiness wait did not fix it. The same test passed locally on the unchanged head, the exact CI base, and a temporary diagnostic run with 6× CPU throttling of the test Chromium page. The successful trace delivered the menu selection, accepted navigation to OpenClaw, and canonicalized that route. No production culprit has been established; failure-only diagnostics now report selection and agent-scoped resolver/startup requests. No inherited-failure claim is made.The four
command-palette-attachmentsfailures werepreserves the input and submits text with images in the background,removes failed reads, reports an error toast, and permits repaste,keeps a rejected image prompt visible without creating a duplicate session, andsettles a cold submit exactly once after partial preparation. All 15 tests passed once on main parent72ad5e9dd83ee4d2b7f89b236f7c9256fd579a55under CI’s UI config. Submit readiness does not wait for the separately lazy preview: the tests now settle its dynamic import and await their preview assertions. Every payload, rejection, and exactly-once assertion remains. These passing base replays are not inherited evidence.Current run
39716829833has two failures reproduced on its exact main parent317f9399d9b0c4e410b7a4d4f8cc9649c015be34. The five unit names inchat-details-output-intent.test.tsxmatch exactly: “opens Files through the current callback when Outputs refreshes before the visible button settles” and “rejects a visible View all callback after its {session, agent, incarnation, visibility} changes”. Both CI and main also report TS2353 forartifactsLoadingat lines 27 and 53. The first main unit attempt timed out during cold loading; one retry with a 300-second no-output limit produced the same five assertions in 21 seconds. This new main test and its renderer are outside this PR’s source changes. These are the only two root failures in the completed69-job run. All9 UI E2E shards and both real-Gateway shards passed, including the earlier agent-selection case; security-fast also passed. Landing uses the documented native inherited-failure route, with this failed CI preserved as failed.Earlier replacement and whole-scope migration record (historical)
Supersedes #179478 (its native review is pinned to workflow
1e48ec3a9e3f, which cannot read state schema 30).This replacement replays that PR's single commit onto current main
7db22d13bf4e. The only conflict was the shrink-only owner-API baseline: main's app-host/app-root removals are preserved, and this change removes the shell-presentation allowance. No workflow binding or shared state was modified.Current checklist counts in the two touched production files (before → after):
Fresh replacement proof:
pnpm install --frozen-lockfilepnpm tsgo:uipnpm test ui/src/app/app-host.test.ts --maxWorkers=1pnpm deadcode:knip(production)ci:fullCI on17113f93cc17Touched production LOC: 676 → 667 (−9). The shell test gains 2 lines; the coupled E2E fixture repair gains 3 lines. No production markup, selectors, routes, classes, lazy imports, or domain authority changes. The replacement carries
ci:fullfor complete UI/Gateway CI.The first full CI run (
39690387849) passed every check exceptkeeps new batches collapsed until Subagents is opened manually without duplicate wait status. It timed out waiting for the loaded Details section to be visible. The fixture had no guaranteed People, Environment, Context, or Output data, so the section could legitimately have zero height. The same test passed once on the exact base and once on the unchanged head locally; those passing attempts are not claimed as a fix. The repair supplies a synthetic creator and additionally waits for the visible People heading, preserving every loading and visibility assertion. The repaired test passed locally (31.4 s browser scenario, 298.8 s including isolated bundle setup). This Playwright E2E reproduction used the Node runtime; unit proof used the pinned Bun runtime. A fresh isolated P0–P2 review found no actionable issue in the fixture repair.The original PR body below is preserved as historical context; the fresh measurements and proof above supersede its old base, queue status, and local setup failure.
Whole-scope Solid 2 census at base
93a248d1f9db. Counts are before → after; unchanged values appear once. Presentation candidates exclude synchronous domain-owner authority and foreign-DOM adapters.Production census: 566 files; 91,604 → 91,595 LOC. App: 31,376 → 31,367; lib: 54,223; plugins: 3,903; API: 2,102. Counted tracked production TS/TSX, excluding declarations, tests/test support, and
lib/reactive.What Problem This Solves
The synchronous shell owner scheduled DOM completion through an unowned Solid callback and kept a separate pending-commit token. Make the rendered shell own that callback instead: a renderless keyed branch registers
onSettledfor each shell view snapshot, outside the route-readiness boundary. The synchronous owner retains its coalesced completion promise; mount/resume invalidate, completed rendering settles it, and unmount settles outstanding work as false.This removes the detached scheduler and its token without a microtask hop. Commit callbacks stay in the same Solid drain, preserving focus restoration ordering. No visible markup, selectors, routes, classes, lazy imports, or domain authority changes. The narrow
commitRenderedPresentation()host contract is inline so this PR does not edit the separately claimed shell-view-state interface.Evidence
pnpm tsgo:ui(tsrs)pnpm test ui/src/app/app-host.test.ts --maxWorkers=1runWithOwnerallowance removedgit diff --checkThe existing disposed-caller regression now mounts the real shell with its runtime. It keeps the same assertions for coalesced promise identity, completion after caller disposal, and false settlement on unmount. No assertion was removed. No local E2E or parity battery runs;
ci:fullsupplies all UI and Gateway shards. The local worker-start timeout is a setup gap, not a product pass or test assertion failure.Touched production LOC: 675 → 666 (−9) across two files; test LOC 1,078 → 1,080 (+2). Pending scheduler tokens 1 → 0 and detached owner calls 1 → 0. Other checklist candidates in these two production files remain zero; native-history state retains its raw external-owner snapshot. No new effects, state owners, or dependencies were added.
Remaining scope
The strict checker exits 1 for existing absolute startup and Chat caps on both base and head. Startup growth is 13 B, below the 64 B limit, while both route payloads shrink. No budget or baseline is increased. The staged baseline and its final published metrics are byte-for-byte identical.