Repository navigation
fix(doctor): identify malformed legacy exec approval fields - #133952
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
9cd2e68 to
be9f89f
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 1:08 PM ET / 17:08 UTC. ClawSweeper reviewWhat this changesThis PR adds redacted field-level Doctor diagnostics for malformed legacy exec-approval files, plus browser-tab inventory fencing, Control UI avatar lifecycle repairs, and focused reliability tests. Merge readinessKeep open for final maintainer acceptance: current main does not contain the branch’s bounded malformed-approval diagnostic or its browser/UI repairs, and no introduced blocking defect was found. Priority: P2 Review scores
Verification
How this fits togetherDoctor imports legacy approval policies into canonical SQLite state while preserving malformed sources for operator recovery and keeping approvals fail-closed. The browser extension publishes accessible tabs to the relay, while Control UI components fetch protected avatar routes for visible state. flowchart LR
A[Legacy approval file] --> B[Doctor migration]
B --> C[Redacted validation diagnostic]
C --> D[Operator repair]
D --> E[Canonical approval state]
F[Browser tab events] --> G[Revision-checked inventory]
G --> H[Relay and Control UI]
Decision needed
Why: The PR is maintainer-authored, carries the protected maintainer label, and changes an upgrade-sensitive fail-closed migration message alongside several reliability repairs. Before merge
Agent review detailsSecurityNone. PR surfaceSource +118, Tests +314, Docs +4. Total +436 across 19 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the parser-owned, value-free diagnostic and lifecycle-owner repairs only after exact-head CI confirms the preserved-file and upgrade behavior on the final branch. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the migration regression cases construct malformed legacy files and assert the preserved-file, diagnostic, receipt, and runtime-gate outcomes; the supplied PR evidence also describes an isolated CLI before/after run. Is this the best way to solve the issue? Yes: exposing a bounded diagnostic at the strict parser and consuming it only in the Doctor migration avoids raw-value leakage and avoids weakening canonical approval validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d147d40f4f1c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (14 earlier review cycles; latest 8 shown)
|
f2e1f41 to
fd4d6b1
Compare
|
@clawsweeper re-review The diagnostic patch is unchanged. Commit fd4d6b1391e5cea2b4083b36d659d4315be4966c adds the CI follow-through described in Evidence: a queued Lit render could reacquire an avatar route after disconnect, allowing an orphan retry to consume the replacement icon's response. The shared loader now owns connection/release for all five consumers (net -19 production lines), with strict request-URL, disconnect/reconnect, and visible recovery tests. The controlled pre-fix ordering reproduced the three-fetch failure; the original hosted log omitted URLs, so its historical third caller remains unproven. Focused tests, the Linux UI group, UI build, final selected checks, and fresh Codex autoreview passed. Exact-head hosted CI and Browser-pane proof are still pending. Please review this added lifecycle behavior as well as the original diagnostic change. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Browser proof for fd4d6b1391e5cea2b4083b36d659d4315be4966c passed through the real Control UI with the canonical mock preview server and isolated Chromium. All six changed production-file hashes match the verified browser candidate. A synthetic 503 with The embedded browser pane remained hidden and did not finish startup, so this proof used visible-page isolated Chromium. The four screenshots below were inspected and contain only synthetic fixture data: initial fallback, connected recovery, navigation away with no retry, and reopened recovery. The original hosted failure did not record its third URL; the controlled pre-fix lifecycle test separately reproduced the same three-fetch assertion failure. |
Real-browser proof for the avatar lifecycle CI repairVerified the candidate UI production sources at fd4d6b1 in isolated Chromium against the canonical Observed:
The queued-render-before-disconnect ordering is separately covered by the deterministic regression: on pre-fix code it produced requests in the order The images below show the candidate's connected fallback, successful recovery, actual navigation away, and reopened chat. They are runtime flow states, not fabricated before/after mockups. All four captures were inspected and contain synthetic-only data. The embedded preview pane remained hidden and stalled startup, so the browser proof used visible-document headless Chromium against the same preview server instead. The task-owned browser and server have been stopped. The Doctor diagnostic code and its fail-closed migration/runtime behavior remain unchanged by this CI follow-through. Required exact-head CI is still a separate merge gate. |
Immediate-reconnect finding repaired and browser-verifiedAddressed the ownerless-503 finding in the latest review. The failed response now deletes an unowned entry rather than retaining a miss with no retry or cooldown. Reconnection therefore acquires a fresh request. This is a condition refactor with zero net production growth; the new regression failed before the fix with one request instead of two, then passed with the other 57 focused tests. UI build, changed checks, and fresh Codex autoreview (P0 scope) passed. Verified candidate fd325ec3 in isolated Chromium against the real Control UI and canonical synthetic mock server. For this narrow race, the probe held delivery of the first real HTTP The observed order was The previous browser flows were also rerun on this final source: mounted recovery used two requests; actual navigation to Plugins plus a late disconnected render produced zero retries; reopening used one new request and displayed the icon. All six production-file hashes matched, with no browser page errors or preview-server errors. Task-owned browsers and the preview server have been stopped. Exact-head required CI and native preparation remain separate landing gates. |
32c9359 to
d2c51d0
Compare
fd485c4 to
a95e15e
Compare
a95e15e to
ad59723
Compare
|
Final landing evidence for Doctor now identifies one safe malformed legacy field without exposing policy values or changing the strict schema, receipts, source preservation, or runtime approval gate. The maintainer accepted the combined avatar lifecycle and browser inventory repairs encountered during required CI follow-through. Thanks @sercada for the original report; the historical nullable-metadata migration is already covered by #118282. The final isolated dist-backed flow used the normal runtime build at Final fixture commands passed: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-flow.streaming.e2e.test.ts
node scripts/check-changed.mjs -- ui/src/e2e/chat-flow.streaming.e2e.test.ts
git diff --checkAll12 streaming cases passed. The prior UI shard failed because the working indicator predates the deferred tool projection: Playwright retained a bubble that detached during scrolling. Both viewport probes reproduced that owner transition; the fixture now waits for the actual tool card before selecting its touch target. No production code, assertion, deadline, retry policy, or configuration changed. Fresh Codex autoreview was scoped-clean at default P0, following the whole-branch review. The broader diagnostic, avatar, browser, cancellation, and Linux proof is in the PR body and linked browser evidence. ClawSweeper's latest reviewed code has no actionable findings. Its rank-up requests are addressed: maintainer scope acceptance is recorded, and installed Zod4.4.3 union/error source was inspected directly. Runtime +195/-77 (net118), tests +565/-251 (net314), docs+4, tooling0 across19files. Duplicate lint, Gateway, prompt and focus repairs are upstream-owned and absent from this PR. Historical hosted extra-fetch/CDP/pointer ordering and lint shutdown kernel cause remain unknown; controlled reproductions do not claim those exact historical traces. Prior remote proof leases are stopped. The interrupted full build on a superseded head is not claimed as completed. Exact-head CI33416971947 completed successfully:184 successful jobs and13 intentional skips. Workflow Sanity33416972078 passed. |
|
Merged via squash.
|
…#133952) * fix(doctor): identify malformed legacy exec approval fields * fix(ui): release avatar routes with their hosts * fix(ui): recover ownerless avatar misses on reconnect * fix(browser): fence stale inventory publication after tab creation * test(scripts): wait for process readiness before cancellation * test(ui): scope reconnect responses to workspace icons * test(ui): establish mobile metadata rest state * test(ui): wait for tool projection before held touch










Related: #118242, #118282.
What Problem This Solves
Fixes an issue where operators running Doctor against malformed legacy exec approvals receive only a generic preservation warning, leaving them unable to locate the field that needs repair. Thanks @sercada for reporting the original upgrade problem; #118282 already handles the historical nullable-metadata migration.
Required CI exposed independently reproducible avatar lifecycle, browser tab inventory, and fixture defects. This PR includes those bounded owner repairs under the authorized landing scope. The maintainer has accepted the combined maintenance scope; the final prepared-head decision remains separate.
Why This Change Was Made
The strict parser now returns either canonical policy or one bounded, value-free diagnostic. Doctor displays a fixed field path and static reason, using a one-based agent ordinal and zero-based allowlist index. The nullable runtime parser delegates to the same strict owner; only Doctor applies the already-existing legacy null normalization. The schema, canonical row decisions, source preservation, migration receipts, and fail-closed runtime gate are unchanged. Agent keys, patterns, commands, socket paths/tokens, and raw validation exceptions never enter diagnostics; diagnostic text is not persisted in receipts.
The shared protected-avatar loader now owns its five Lit consumers' connection lifecycle, preventing queued renders after disconnect from reacquiring orphan requests. An ownerless 503 result is removed through the existing cleanup path so immediate reconnect can retry. Both browser inventory publishers revalidate discovery generation after awaited reads, preventing stale inventory from retiring a newly handed-off tab session. Access and revocation checks remain intact.
The retained tests now wait for process-tree readiness and a resting mobile touch state. Assertions and existing test, command, and cleanup deadlines remain intact. Main #134033, #134031, #134207, and #134014 now own the prepared-model fixture, lint resource chooser, Gateway fixture corrections, and dropdown focus synchronization respectively; duplicate commits were dropped during actual conflict refreshes. Those files have no delta in this PR.
User Impact
Doctor identifies, for example,
agents entry #2.allowlist[1].lastUsedAt: expected a finite numberwhile preserving malformed input and refusing runtime approvals. Correcting the identified field lets the normal import finish. Protected avatars recover across disconnect/reconnect, and browser targets survive an overtaken inventory read.There are no new config/environment options, dependencies, protocol/schema changes, approval-policy changes, or releases. Runtime LOC is +195/-77 (net +118): diagnostic projection +124, shared avatar lifecycle consolidation -19, and browser publication fencing +13. The diagnostic growth implements a value-free projection unavailable from generic Zod formatters; the browser growth validates the two publication boundaries. Tests are +565/-251 (net +314), including the moved icon suite; docs +4, tooling 0. Nineteen files remain in the PR.
Evidence
lastUsedAtto 0 allowed import, source retirement, and successful approvals read. All synthetic states were cleaned. The fresh integrated result on the final refresh is recorded below.core/schemas.ts:2167–2248,errors.ts:345–359, andutil.ts:837–868were inspected directly for union-relative paths and value exposure. Installed Lit's queued-update/connection contract, Web Awesome's post-animation focus assignment, and Playwright/Chromium touch behavior were inspected at their owners.Session not foundbefore repair. All 189 owner/relay/access tests passed. Native Linux Chromium proof passed both all-tab and selected-tab modes, same-target navigation and snapshot, preserved unrelated pages, and verified page/relay/MCP/HTTP cleanup. This proves the controlled ownership defect; the original hosted CDP sequence was not logged.CI repair history and limits:
Latest ClawSweeper review, reviewed at4ac68682 on August31 17:08UTC, reports no code findings. Its scope rank-up move is addressed by maintainer acceptance of this maintenance batch; its dependency-environment gap is addressed by the direct Zod inspection above. Exact-head required CI and native preparation have completed; final prepared-head approval remains separate.
Current conflict refresh:
a95e15ec3afa71c6e7511d2253fee01f40698585, based on main9cc05cca83e20179ae78fdc3fd2232c262414ea7. Main #134014 independently supplied the same dropdown focus and hidden-popup waits; the actual conflict was resolved by preserving that file exactly as upstream while retaining the browser repair. All19 remaining PR file blobs are byte-identical to the previously reviewed head. The upstream focus suite passed all6 cases and a fresh whole-branch Codex review was scoped-clean at P0. The preceding refresh had passed66 Gateway/diagnostic tests and12 streaming E2E cases. No source edits followed review.Run33411024583 had183 successful jobs and13 skips, with only its aggregate queued when the actual main conflict stopped the watcher. No test failure or retry was involved. A full local build on that superseded head was deliberately interrupted with exit143; every owned child/process group was verified stopped before source changed. Its partial output is not claimed as a completed build. The final CLI probe uses the repository's normal runtime build/postbuild path and verifies both build stamps against the exact head; declaration-only build work is not represented as completed.
Fresh integrated CLI proof at
a95e15ec3afa71c6e7511d2253fee01f40698585: the normal runtime build completed successfully in23.9s, both build/postbuild stamps match the exact head, and the native-load check verified38 plugin control-plane modules. With fresh isolated synthetic state, Doctor printed the bounded second-agent/second-entrylastUsedAtwarning, preserved exact bytes, and leaked no private markers.approvals getexited1. Correcting only that field to0 let Doctor import and retire the source; both Doctor and approvals read then exited0, and the corrected policy was readable. No approvals payload was retained, and all fresh synthetic states were cleaned.Malformed Doctor itself exits0 on the current upstream behavior. #133773, commit
122232dc7792b75934e6961dd60a3c5f9d81b80c, deliberately catches pending approval migration in Doctor security checks and post-import cleanup so the rest of Doctor can continue. The raw parent diff was checked directly. The earlier Doctor exit1 was the pending-migration gate error removed by that repair. This PR leaves that upstream exit behavior intact and keeps the runtime gate fail-closed. The maintainer accepted this current upstream contract after checking its source and raw parent diff. The original harness result remains recorded as exit1 because it expected Doctor1; the completed command observations satisfy the corrected contract. No rerun or exit-policy change was needed.Latest documentation conflict refresh:
ad59723dfd7fc8d3392dfbaecf5b9aecc09421d5on692cb7b1f28f910e59e8f4ee0acb5cb27f45667a. The adjacent auth-archive recovery note from #134009 and all four diagnostic lines are preserved. All18 runtime/test file blobs are unchanged; formatting and fresh whole-branch Codex P0 review passed. CI33413428719 completed successfully on the preceding head; CI33415464804 is attached to this new exact head.The complete isolated CLI flow was repeated on the latest head after a39.19-second successful normal runtime build; both stamps match
ad59723dfd7fc8d3392dfbaecf5b9aecc09421d5. Results remain Doctor0 with the bounded warning, source bytes preserved/no marker leak, approvals get1; after changing only the indicated field, Doctor0/import/source retirement and get0/corrected policy. Synthetic state was cleaned. The maintainer accepted the corrected Doctor0 warning contract; the original failed harness expectation remains preserved separately. No exit policy or production code was changed to force that expectation.Required CI follow-through at
ad59723d: UI E2E job99565202388 passed82 cases and failed the held-touch fixture atscrollIntoViewIfNeeded, where the selected bubble detached during the tool projection. The working indicator was already visible before the tool event; it did not prove that the deferred tool card had rendered. Direct Playwright source inspection confirms that this scroll method retains one element handle. A controlled real-browser probe on both viewports showed the already-visible indicator and the old bubble becoming disconnected, then reproduced the same scroll error. The fixture now waits for the specific tool card before selecting the touch target (+3 test lines, no production change). All12 streaming E2E cases passed, and fresh Codex P0 autoreview was scoped-clean. Original footer, held-touch, recovery, identity, and timestamp assertions and all deadlines remain unchanged. The full selected check-changed command passed. The correction is committed as4ac68682a089bf279ba6fcf889ac6e899162352f; exact-head CI and native preparation have now completed successfully. This establishes the faulty fixture boundary; the hosted run did not retain the precise browser callback ordering.Final prepared head:
4ac68682a089bf279ba6fcf889ac6e899162352f. CI33416971947 completed successfully with184 successful jobs and13 intentional skips; Workflow Sanity33416972078 also passed.OPENCLAW_TESTBOX=1 scripts/pr prepare-run 133952completed successfully using exact-head evidence, with no rebase, source change, or extra push. All ClawSweeper rank-up moves are addressed by green exact-head CI and maintainer scope acceptance. The final prepared-head merge decision remains separate.