Repository navigation
refactor: simplify internal error and recovery paths - #176987
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 566808e2a0
ℹ️ 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".
| await createNodeInvokeResponder(invocationClient, frame).error( | ||
| "UNAVAILABLE", | ||
| "node invocation failed", | ||
| ); |
There was a problem hiding this comment.
Consume failures while sending fallback invoke responses
When dispatch fails while the Gateway connection is also unavailable, this fallback node.invoke.result request rejects and now escapes handleInvoke. The worker entry point launches runtime.invoke(...) with void in src/node-host/worker.ts, so the escaped rejection is unhandled and can terminate the node-host worker instead of merely dropping the unsendable terminal response; the existing invoke.test.ts case with a rejecting client also expects handleInvoke to resolve. Restore a catch around the fallback send so transport failure remains terminal only for this request.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Thanks for checking this path. I am retaining the catch removal: createNodeInvokeResponder in src/node-host/client.ts catches both payload construction and the awaited Gateway request, and .error() delegates to that sender. Its implementation is unchanged from main. The existing invoke.test.ts regression, “consumes a failed terminal response after approval resolution rejects,” exercises the rejecting Gateway plus approval failure and verifies the handler resolves; the selected control passed on this branch. The removed outer catch cannot observe that already-consumed request rejection, so restoring it would duplicate the owning responder boundary.
|
Codex review: blocked before merge. What this changesThis PR simplifies internal error and recovery handling and makes Doctor report invalid legacy managed-image directories. Example: The legacy media/outgoing/records path contains a regular file.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep this maintainer-authored PR open: the cleanup has value, but removing cache invalidation breaks a current-main consumer, and an unchanged Session Share test contradicts the accepted behavior. Priority: P2 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherGateway, plugin, and Doctor callers submit reads and recovery work to existing worker, cache, and migration owners, which return results while retaining cleanup and transaction responsibilities. flowchart TD
A[Gateway and plugin callers] --> B[Existing worker pool]
B --> C[State and usage readers]
C --> D[Results and cleanup]
A --> E[Retained cache]
F[Doctor] --> G[Legacy migration owners]
G --> H[Committed state and diagnostics]
Technical reviewBest possible solution: Retain the simplification while restoring the cache methods used by main and aligning the Session Share integration test with the accepted display behavior. Do we have a high-confidence way to reproduce the issue? The cache failure is established by the verified merge candidate and matching CI traces; the Doctor defect is source-reproducible and has a reported base-failing regression, but no target code was executed during this review. Is this the best way to solve the issue? The existing Promise, worker-pool, and migration owners support the simplification, provided still-used cache invalidation and affected consumer tests are preserved. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 572cb278b243. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource -521, Tests -174, Docs +2, Other -1. Total -694 across 56 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 19, 2026, 2:07 AM ET / 06:07 UTC. |
|
Exact-head inherited-only landing evidence for
Metadata cancellation117924336386 is superseded by successful117924396404, not missing test coverage. No CI rerun, dispatch, green-chasing push, retry, timeout increase, or new skip. Native evidence binds the exact checkout/ordered parents, complete checks and retained hashed failure/replay logs. All failed source inputs are checked against baseline and tested merge by the native verifier. The earlier owned cache regressions and obsolete synthetic display test were repaired before this exact head. Repair types/lint and52 unique focused tests passed; independent P0–P2 review is clean. The PR preserves investigated historical local deadlines as explicit gaps, not passes. The standing campaign instruction authorizes the native inherited-only admin exception after complete attribution; no other admission or security gate is waived. Net504 production lines removed. Phase E remains untouched. |
cd83ae6 to
c7b15fa
Compare
|
Merged via squash.
|
* refactor: simplify internal error recovery owners * refactor: remove unused retained-cache invalidation methods * refactor: trust the node invoke response error boundary * refactor: return agent refresh admission as a boolean * refactor: use promises for asynchronous state read transport * refactor: simplify workspace and usage error handling * fix: retain cache invalidation and drop obsolete display race test
What Problem This Solves
Simplifies internal error handling and recovery paths, and fixes Doctor silently overlooking an invalid legacy managed-image directory.
User Impact
Normal workflows, public contracts, stored data, and security checks remain unchanged. Doctor now reports an invalid legacy image-record directory instead of treating it as absent. Two rare recovery cases become explicitly best-effort: unfinished Buzz profile-label reads may be replaced, and stale Git ref locks require manual repair rather than automatic deletion.
Why This Change Was Made
Use existing Promise and worker-pool rejection paths instead of private result/error round trips. Remove unused failure variants, duplicate boundary validation/catches, immediate rereads of committed writes, and optional compound-failure recovery machinery. Native retirement, accepted-write settlement, transaction commits, external-source verification, current authority, ordinary missing-tip recovery, and bounded resource protections remain. Cache invalidation methods used by the new task-PR and metadata consumers remain intact.
Net production delta: 142 added / 646 removed = 504 lines removed. Tests, test support, fixtures, declarations, generated files, docs, and inventories are excluded. Phase E standalone session memory is untouched.
Best-effort tradeoffs accepted
828f88c5,b4898479,befa225e) and #130300 provide controlled callback proof, not an identified human incident requiring this queue. New keys replace unfinished reads; labels remain best-effort. Snapshot completion, finite query limits, room authority, and socket teardown stay.util.inspectrather than a fallback for a missing builtin; unsupported runtimes without that builtin are not accommodated.Evidence
Current head
c7b15fa214a2ea170dda5c4e1845dba4ae125c2chas green exact-head CI: 39219775350. All181 check runs are accounted for, with no failed or unfinished checks. The cancelled metadata check117952077026 has successful same-head successor117952282137; no selected suite is missing. Current dependency, security, and CI commit statuses are all successful. No admin exception is needed for this head. Prior-head failures below remain historical attribution, not a claim that failed CI passed.Conflict-only rebase and current proof
The native inherited-only submission for
cd83ae6daborted before dispatch after GitHub reported a conflict in the managed-image migration test. Conflict-only rebase ontoec07b0d9c646b85565da2885586c7d4dc89cad5fproduces signed headc7b15fa214a2ea170dda5c4e1845dba4ae125c2c. Range-diff shows six identical commits; the remaining commit only adapts two calls in the added regression to main's captured-state-directory fixture. Main's tests/names and all production changes are preserved. No merge request was sent for the old head.Conflicted-graph native types, canonical test lint, formatting and whitespace checks pass. All nine migration owner cases pass (327.50s Vitest,96% transform). The suppression guard passed13 cases and failed its static allowlist: main added native-MCP suppressions and removed a provider-HTTP suppression without matching the list. Those two production files and the guard are unchanged by this PR; this diff adds no suppression. The allowlist was not changed. The green current-head hosted CI above supplies broad proof; prior-head CI below is attribution history, not proof for the rebased head.
Prior-head CI attribution (before conflict rebase)
Run 39211070900 tested old head
cd83ae6df2609661f9b454d62f781296754a3072as merge1995e2a06ec0fa467023948f389a4e67204ad730onto base49f3f77873eebaa3ad999dad22c4eea08a153664. Complete check enumeration: 128 success, 54 skipped, four failures, one neutral, one superseded metadata cancellation. Both PostgreSQL lanes pass. Failed CI remains failed. This table does not qualify a different head for the inherited-only exception.skill-library-bob-worker-firststatuserror, matching scheduled main 39205204421.AGENT_SELECTION_REQUIRED, session belongs tomain, notwork. Serial replays of the exact tested merge and exact base both reproduce the identical error and agent-scope→web-search-policy stack. Main #174774 introduced that preparation; its fixture defaults toworkwhile supplying amainsession key. No policy/security changes here.The cancelled metadata check is superseded by a successful same-head metadata check, not missing test coverage. No CI rerun, speculative test repair, timeout increase, skip, or push solely to obtain green was used. Replays selected only the failing policy row with one worker and isolated state; they are failure attribution, not passing proof.
The first exact-head CI run (39206483937) exposed owned regressions: removing retained-cache clear/delete broke newer task-PR/metadata consumers, and one synthetic Session Share test still required the removed display-timing guard. The repair restores the cache helper byte-for-byte to main and removes only that obsolete synthetic test. Repair proof passes targeted native types, canonical two-file lint, 3 retained-cache tests, 12 Session Share integration tests, 23 subscription-consumer tests, and the 14-test suppression guard (52 unique tests; focused wrapper 563.79 seconds). No inherited-only attribution or passing-CI claim is made for the original head; new exact-head CI is the broad gate.
Targeted native types and canonical type-aware lint pass for the final eleven-file delta. Fresh independent P0–P2 reviews are clean, including final usage test relocation and all retained settlement/cleanup boundaries. The author simplification pass found no additional necessary architecture.
The actual managed-image detector→migration regression fails on original production at the missing-warning assertion, while preserving file bytes. The usage control passes on original production through a real worker/pool, retaining the original host Error and subsequent report recovery.
Earlier private slices have focused owner/consumer proof recorded locally: the async read transport slice passed 188 unique tests across 15 files (one existing platform skip), including configured Bun native cleanup and an isolated Gateway pairing startup/read/close path; the TUI slice passed 225 owner tests plus the 14-test suppression guard. Other slice proof includes 124 focused tests and retained-cache/subscription controls. These are separate runs, not one claimed full-suite pass.
Final seven owner/sibling suites passed 97 tests, with only the old synthetic workspace success expectation failing; the 14-test suppression guard passed. That test injected setup completion from a filesystem spy outside the preparation queue. It now requires the deliberately accepted visible refusal, completed setup state preserved, and all original optional-file absence checks. The repaired case passes, with targeted native types and canonical lint also passing. Production is unchanged by that test adaptation.
The final retired-symbol audit also found two generated runner fixtures that TypeScript cannot inspect. Both now use the new Promise/owned-task surface directly; targeted native types, canonical lint, and their independent review pass. Their actual nested runner hit its existing 120-second deadline after the earlier scheduled-close fixtures, before the edited read-pool fixtures ran. The managed child was aborted and joined; the diagnostic fixture was retained. This remains an unresolved runtime gap, not a load diagnosis or passing proof. Existing retirement assertions, report counts, and the intentionally exercised runtime skip are unchanged; no timeout/retry/skip was added. Exact-head CI must supply the remaining broad proof.
Known local gaps: catalog owner attempts reached their existing deadlines without a conclusive runtime verdict; no timeout/retry/skip was changed and no catalog pass is claimed. The earlier full node-invoke owner run passed 27 tests but failed the default-policy CLI subprocess case (exit 124 versus 0); the exact original-production replay failed identically. The changed terminal-response control subsequently passed on this branch; that is not a current full-owner pass or a diagnosis of the historical deadline failure. Broad builds, whole-graph types, and cycle suites are deferred to exact-head PR CI under the shared-host CPU constraint. The only added production import edge is migration→
errno.ts, whose owner has no relative return edge; other production edges are removed.