Repository navigation
fix(codex): recovered dashboard turns fail before reaching the model - #176707
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. |
Restart recovery resumed an interrupted Control UI dashboard session on the Codex harness, and the turn failed with "Session capability metadata requires worker preparation", leaving the session stranded. Codex's dynamic tool build called the synchronous resolveWebSearchToolPolicy on every turn that resolves hosted web_search. For dashboard and subagent keys that policy reads the stored session envelope, which succeeds only inside a prepared capability read or when the Gateway session projection can serve the row. Ordinary turns usually found the projection warm; a turn resumed during startup, on a row recovery had just rewritten, did not. The prepared-read requirement arrived in #169622 and missed this caller. Add resolveWebSearchToolPolicyAsync, which prepares the stored facts before resolving, export it from the agent-harness SDK beside the unchanged sync resolver, and have Codex await it. No fallback reader is added. The regression runs a full Codex attempt for a recovered dashboard turn with hosted search on; it fails on the base with the production error and passes with the fix.
|
Codex review: needs changes before merge. What this changesThe PR makes Codex await worker-prepared web-search policy so recovered dashboard turns can start without a warm session projection. Example: Restart recovery resumes agent:main:dashboard:recovered before its session projection is available.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (failure trace). No predecessor PR is attributed. Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: current main retains the unprepared Codex policy read, and the patch supplies a focused repair with no definite introduced code defect found. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherRestart recovery enters the Codex harness, whose dynamic-tool builder resolves core session and requester policy before configuring the native thread and starting the model turn. flowchart TD
A[Restart recovery] --> B[Codex attempt]
B --> C[Dynamic tool builder]
C --> D[Core web search policy]
D --> E[Session capability worker]
E --> D
D --> F[Native thread and turn]
Technical reviewBest possible solution: Prepare the session facts through the existing worker owner before Codex resolves search policy, preserving the supported synchronous SDK contract. Do we have a high-confidence way to reproduce the issue? The incident stack matches the current synchronous lookup and the session store's preparation requirement; the supplied regression targets that path, but this read-only review executed no target code. Is this the best way to solve the issue? The patch is a small owner-level repair: it reuses worker preparation, preserves policy calculation and public compatibility, and adds one distinct attempt regression without unnecessary production machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 44aa4e155b1d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +12, Tests +26, Docs +8, Other +2. Total +48 across 10 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, 9:03 PM ET / October 19, 2026, 01:03 UTC. |
241ac80 to
de28c65
Compare
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. |
|
|
Merged via squash.
|
…penclaw#176707) Restart recovery resumed an interrupted Control UI dashboard session on the Codex harness, and the turn failed with "Session capability metadata requires worker preparation", leaving the session stranded. Codex's dynamic tool build called the synchronous resolveWebSearchToolPolicy on every turn that resolves hosted web_search. For dashboard and subagent keys that policy reads the stored session envelope, which succeeds only inside a prepared capability read or when the Gateway session projection can serve the row. Ordinary turns usually found the projection warm; a turn resumed during startup, on a row recovery had just rewritten, did not. The prepared-read requirement arrived in openclaw#169622 and missed this caller. Add resolveWebSearchToolPolicyAsync, which prepares the stored facts before resolving, export it from the agent-harness SDK beside the unchanged sync resolver, and have Codex await it. No fallback reader is added. The regression runs a full Codex attempt for a recovered dashboard turn with hosted search on; it fails on the base with the production error and passes with the fix.
What Problem This Solves
Fixes: after a Gateway restart, an interrupted Control UI session running on the Codex harness is "resumed" by restart recovery but its turn fails within seconds with
Session capability metadata requires worker preparation, and the session stays stranded.User Impact
User impact: restart recovery now actually resumes interrupted Control UI (dashboard) sessions on the Codex harness instead of starting a turn that dies before reaching the model. Ordinary Codex turns on dashboard and subagent sessions no longer depend on the Gateway's session projection being warm. No config, schema, stored-data, or update change.
Why This Change Was Made
Codex resolves hosted
web_searchpermission on every turn. It called the synchronousresolveWebSearchToolPolicy, which, for dashboard and subagent session keys, reads the session's stored delegation envelope. That read only succeeds inside a prepared capability read or when the Gateway session projection can serve the row. Normal turns usually found the projection warm. A turn resumed during startup, on a row recovery had just rewritten, did not, so the read threw. The prepared-read requirement arrived in #169622, and this caller (from #93446) was missed.The policy owner now offers
resolveWebSearchToolPolicyAsync, which prepares those stored facts before resolving, and Codex awaits it. No fallback reader is added; the synchronous SDK export is unchanged. Restart recovery itself was already correct (it started the run); the defect was entirely inside the harness turn.Every other core caller of this policy was checked and is already covered: a prepared wrapper, a pre-resolved requester policy, or no session key.
SDK surface: one additive export on
openclaw/plugin-sdk/agent-harness, so the export and callable budgets inscripts/plugin-sdk-surface-report.mtsgo up by 1 each. The bump was flagged to Peter before landing and accepted with the land instruction.Incident trace
Seen on a production Gateway on 2026-10-18 after
openclaw gateway restart --force. Main-session restart recovery loggeddecision=started,nextOwner=background-lanefor anagent:main:dashboard:<uuid>session. About 2.6 s lateragents/harnessloggedCodex agent harness failed; not falling back to embedded OpenClaw backendwith the error above, and the lane task errored. The failing stack isbuildDynamicTools→resolveWebSearchToolPolicy→resolveRequesterToolPolicies→resolveDelegatedPolicy(the senderless own-envelope read) →createSubagentSessionStore().get→readDurable. Startup at that moment showed agent-database queue waits around 9 s.Release note: Codex sessions resumed by restart recovery no longer fail with "Session capability metadata requires worker preparation".
Evidence
run-attempt.dynamic-tools.test.ts› "prepares hosted search policy for a recovered dashboard turn". It runs a full Codex attempt with a fake app-server, using a recovered dashboard turn: restart-recovery provenance, hosted search enabled, no projection. On the base it fails with the production error and stack. With the fix the turn is accepted and completes. That also shows this was the only unprepared capability read on the recovered Codex attempt path.run-attempt.dynamic-tools.test.ts: 11 tests, about 69 s for the file on a loaded host; the new case takes about 6 s.dynamic-tool-build.test.ts: 74 tests.dynamic-tool-build.web-search.test.tsanddynamic-tool-build.sandbox.test.ts: 21 tests.tsgo:coreplugin-sdk:check-exportsplugin-sdk:surface:checkcheck:import-cycleseslint-plugin-solid.tsgo:extensions: one unrelatedqa-labmodule-resolution error from the partial install; no errors in the touched files.