Repository navigation
refactor(ui): share pending focus requests across choice and preview views - #176765
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 shares pending-focus handling between answer choices and file previews while preserving selection, focus, and document scroll behavior. Example: A recommended “Review changes” choice arrives while the chat composer has focus.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the focused refactor preserves existing focus safeguards, and no actionable code defect was found; required validation remains unresolved. Priority: P3 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherControl UI components receive question or file-preview properties, derive presentation state, and apply focus and scroll changes to their owned DOM elements. flowchart TD
A[Question properties] --> B[OptionCard]
C[Preview properties] --> D[FilePreview]
B --> E[Pending focus primitive]
D --> E
E --> F[Component focus policy]
F --> G[Owned DOM targets]
D --> H[Scroll and row reveal]
Technical reviewBest possible solution: Retain the shared focus primitive and existing component policies, with required browser validation and CI gates resolved before landing. Do we have a high-confidence way to reproduce the issue? This is a behavior-preserving refactor; the supplied built-app comparisons exercise existing focus and retention contracts rather than establish a new upstream bug. Is this the best way to solve the issue? The small shared primitive removes duplicated focus-request mechanics while leaving readiness and target selection with existing component owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c2549f8295d0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +24, Tests +91. Total +115 across 5 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
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 18, 2026, 10:00 PM ET / October 19, 2026, 02:00 UTC. |
b0b6d23 to
931c801
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 931c80117e
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import { createEffect } from "solid-js"; | ||
|
|
||
| /** Consume each focus request once, after its target is ready. */ | ||
| export function createPendingFocus<T>( |
There was a problem hiding this comment.
Keep the Solid refactor net-negative
This refactor introduces a 22-line shared primitive and increases the touched production files by 24 lines overall (54 additions versus 30 deletions), while the required Solid refactor checklist explicitly requires net production LOC to decrease. Please consolidate the focus logic without growing production code, or simplify equivalent code in the same coherent refactor.
AGENTS.md reference: ui/AGENTS.md:L5-L5
Useful? React with 👍 / 👎.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…views (openclaw#176765) * refactor(ui): share pending focus admission * test(ui): wait for transcript readiness before selection
OptionCard and FilePreview now share one pending-focus primitive instead of each managing focus in a view effect. A recommendation can wait while the card is disabled, a replacement request can cancel it, and the request is consumed before the caller checks whether another control owns focus. Description and disabled updates retain the existing choice nodes and selection.
FilePreview keeps its immediate selection-handler focus and connected/open guards. Its remaining effect separately compares content-reset and active-row-reveal inputs, so sibling inventory updates can reveal the selected row without resetting the document being read. Focus still runs only initially or when the active path changes in document layout; switching layout alone does not refocus. Tags, classes, routes, and lazy boundaries are unchanged.
Scope and counts
The 24-line production increase is the 22-line shared lifetime primitive plus two lines in FilePreview. The remaining feature effect at
ui/src/components/file-preview-modal.tsx:184synchronizes the preview body's scroll reset and active-row reveal with committed DOM; the other effect lives once inui/src/lib/reactive/pending-focus.ts:14. No new dependency, domain owner, cache, or config option.Proof
Compared base
64e9443af525212642b0406fbc454727f267a68awith headb0b6d23717501dc58f234d411ee11943cff55ffd.pnpm tsgo:uioption-card.test.tsx --maxWorkers=1file-preview-modal.test.ts --maxWorkers=1pnpm ui:buildpnpm ui:buildb0b6d237head, exit 0; single run, 9m 9.9sThe strict check exits 1 on both revisions because Chat exceeds 1,490,000 B and New Session exceeds 1,050,000 B. These exact metric failures reproduce at the merge base. Startup passes; no request count or lazy boundary changed. The small startup increase includes the shared focus primitive and remains below the current committed startup limit.
The unit tests retain the existing owner contracts and add coverage for a disabled pending recommendation, refusal consumption, cancellation by a request without a recommendation, keyed choice retention, active-row reveal, and layout-only focus restraint. The browser proof loads the full built app with synthetic data: a real Custodian question plus controlled publications from its existing store, followed by the registered FilePreview element after the Plugins route loads. No real Gateway, credentials, or user data.
The first browser attempt completed the OptionCard frames, then a hard navigation canceled an asset proxy request (
ECONNRESET). The successful retained attempt uses the app's existing in-place navigation hook. No source or build change was needed.Before / after
All eight full baseline and head captures were inspected by both worker and parent: synthetic-only and showing the expected selection, focus handoff, and preview states. Both FilePreview frames are pixel-identical. The OptionCard frames differ by 1,954 and 1,949 pixels, entirely in the animated mascot and build footer; the component and page region has zero changed pixels. Accepted head captures were preserved without recapture. The comparison below uses the existing captures, with only the bottom 60-pixel build footer removed from the OptionCard frames.
Evidence identity
Four source files retained their reviewed hashes through formatting/rebase.
file-preview-modal.tsxchanged only in formatting, to SHA-25634962a24dc8a25a18b96f247ff43506ca96f5d813d16957266daf017734c147a.Raw local evidence is retained under
.artifacts/w-zero-component-focus/:validation.json,format-repair.json,final-source.json,proof-report.json,performance-comparison.json,visual-comparison.json,visual-regions.json, the build/performance/capture logs, and screenshot manifests. The original formatting and capture failures remain preserved separately from their successful replacements.Full-CI attachment recovery
The first run, 39186103539, captured
OPENCLAW_CI_FULL: falsebefore theci:fulllabel was observed. Its three UI unit shards and two selected Control UI E2E shards passed; real-Gateway coverage was skipped, so it is not full proof. The workflow does not trigger on label changes. A same-head close/reopen withci:fullalready attached selected the full plan in 39188357118.That first run failed only
chat boot JS gzip: 1,491,219 → 1,491,226 B against 1,490,000 B. The exact base fails the same named metric. New-session boot passes at 1,049,429 → 1,049,454 B; startup is 337,507 B with one CSS request. No budget or baseline changed.Full-CI result and selection readiness
Full run
39188357118completed onb0b6d237: all three UI unit shards, eight of nine Control UI E2E shards, and both real-Gateway shards passed. Its two failures were the same inheritedchat boot JS gzipmetric above andkeeps retained comments usable after clearing history (replacement: true)in the selected-text E2E suite. The latter is not inherited: the exact test passes in scheduled main run39183785855at the original merge base.That test failed during its first Add to chat click, before history was cleared: the toolbar appeared, then detached while Playwright awaited stability. Its synthetic text-selection helper could select attached transcript content before it became visible and before initial positioning settled. Plugin composer readiness does not establish transcript readiness. The correction adds only a wait for the selected passage to be visible and the existing transcript scroll-idle check before the first selection. The real click,
reducedMotion: "no-preference", and all comment/history-retention assertions are unchanged. The toolbar intentionally dismisses on scroll or collapsed selection; the retained log does not establish which event dismissed it in the failing run. The final full-CI run passes the corrected selected-text shard. The earlier failure still does not establish the precise dismissal trigger.The final branch was rebased without conflicts onto
a9e5f4e3b7b2; main had no changes in the six affected files. Final head is931c80117e689bc8e0fa1b27f5f3c1dcdc97e08d. The build, startup, visual, Knip, and original unit evidence above remains pinned tob0b6d237and base64e9443a; it is reused proof, not a final-head rerun.pnpm tsgo:uiThe reviewed E2E source SHA-256 is
fa23338a32dda1f5bd343ca3bfecf87327361a119fd8ad6936526f25aad11f8c, unchanged by the rebase. No additional local E2E or build was run for this correction.Final-head full CI and inherited failures
Run 39190432776, attempt 1, completed on
931c80117e689bc8e0fa1b27f5f3c1dcdc97e08dwithci:fullactive. All three UI unit shards, eight of nine Control UI E2E shards, and one of two real-Gateway shards passed. The corrected selected-text suite passes;security-fastpasses.The remaining assertion failures match completed test failures in the existing CI run 39190227860 at this PR's exact merge base,
a9e5f4e3b7b2114caa573554766ab7b4850b39e4. Both baseline job logs attest that checkout. The tests failed several minutes before their jobs were cancelled:session-list-filter.e2e.test.ts— refetches instead of showing a row excluded by configured-agent filteringsession-list-filter.e2e.test.ts— keeps the Sessions page query stable when the startup roster completescommand-palette-search.real-gateway.e2e.test.ts— finds a grouped spawned conversation beyond the roster and treats a full result page as successThese are completed failing-test results, not a claim that the cancelled baseline suite completed. The newest scheduled-main run 39195750293, head
5ec30bfc7216adeb622700464db6dccae368e17e, now passes all three tests after main's separate test repair246c6533a0c0aligned them with conditional session queries. This PR uses the documented exact-merge-base evidence alternate; it does not claim those failures remain on latest main.The current performance job also fails the existing Chat boot budget: exact CI base
3635488eis 1,491,366 B and the tested merge is 1,491,451 B (+85 B), both above 1,490,000 B. New Session passes at 1,049,566 → 1,049,635 B (+69 B). Startup passes at 337,534 B gzip and one CSS request (38,500 B). These are current CI measurements, separate from the same-machine local comparison above.Native inherited-failure evidence binds the actual tested merge
e5abc5d0d8b4b4b07187ad259b2ea979f7cc1000to its ordered base/head parents, exact failure names, unchanged failing-test and budget source objects, and retained logs. No failing check is represented as green.