Repository navigation
fix: user turns fail when the runtime changes during preparation - #185573
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: needs changes before merge. What this changesThis PR adds regression coverage for runtime replacement during turn preparation, auth refresh, reply dispatch, and config reload. Example: A config publication changes responsePrefix from "before" to "after" while a turn's runtime is preparing.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Needs changes before merge - 1 item remains Keep this maintainer-owned draft open: the regressions address a current preparation failure, but this head does not implement the intended fix. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway and reply admission acquire prepared model runtimes from shared lifecycle owners, which coordinate config publications, credentials, plugin generations, and retained execution leases. flowchart TD
A[User turn] --> B[Gateway or reply admission]
B --> C[Prepared runtime lease owner]
D[Config and auth publications] --> C
C --> E[Retained plugin generation]
E --> F[Reply execution and nested work]
Technical reviewBest possible solution: Use the existing runtime owners to retry unfinished admission once while preserving admitted generations, bounded auth recovery, and deferred reload settlement. Do we have a high-confidence way to reproduce the issue? Current source directly rejects superseded preparation and stale captured dispatch generations; no assertion-level execution of the new regressions was verified. Is this the best way to solve the issue? The tests target distinct lifecycle boundaries and reuse existing fixtures, but the production repair must be reviewed before its completeness or safety can be established. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 63af7b4ea42c. Provenance checked
TestingProof path: none. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +157. Total +157 across 4 files. Added test files: 0. View PR surface stats
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 27, 2026, 2:46 AM ET / 06:46 UTC. |
Retry unpinned preparation on the current generation before execution while preserving admitted generations for running and nested work. Bound auth publication retries and defer automatic reloads until admitted plugin work and cleanup settle.
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 explicitly authorized admin squash with attributed pre-existing CI failures.
|
…nclaw#185573) * test: cover runtime replacement during turn preparation * test: provide persisted hashes for reload deferral proof * fix: retry runtime preparation superseded before execution Retry unpinned preparation on the current generation before execution while preserving admitted generations for running and nested work. Bound auth publication retries and defer automatic reloads until admitted plugin work and cleanup settle. * test: acquire fresh registries for auth recovery proof
…5573) * test: cover runtime replacement during turn preparation * test: provide persisted hashes for reload deferral proof * fix: retry runtime preparation superseded before execution Retry unpinned preparation on the current generation before execution while preserving admitted generations for running and nested work. Bound auth publication retries and defer automatic reloads until admitted plugin work and cleanup settle. * test: acquire fresh registries for auth recovery proof (cherry picked from commit a59112f) Co-authored-by: RomneyDa <[email protected]>
…s lane FRV tests (#187567) * docs(secrets): include Beam mirror token in credential matrix (cherry picked from commit dfa7774) * test(infra): supply versions list in astral ClawHub detail fixture The backport of #182753 (74e414a) dropped the versions: { items: [] } default that main's readDetail helper supplies, so the release-branch fixture fails the versions response guard. * test(web-search): carry #179703 envelope bound into release security test Main's 47c1c2a raised the aggregate JSON envelope bound from 22,000 to 23,000 because rows now keep their titles and site names (more wrap envelopes); the 20,000-char untrusted content cap is unchanged. The release backport 2b35452 put the new tests in web-search-budget.test.ts and missed this assertion in the release-only security test file. * test(auto-reply): expect preserved multiline /side input in registry test Backport 9b93c22 (#176293, main d7359a7) intentionally preserves multiline /btw, /side and /loop arguments. The release-only registry test still asserted the old first-line truncation for /side; main no longer has that assertion. * test(pdf): hold a Codex OAuth login in the ChatGPT PDF fixture Backport f41ea65 (#181356, main f64e38f) intentionally resolves a ChatGPT catalog row with only an API key as stale, routing it to the Platform contract. Port main's matching fixture update from 280c7c7 (shipped inside an unrelated visitor-access commit) so the test exercises the Codex subscription route it names. * test(auto-reply): expect agent inventory workspace for reply runtime Release backports 23e702a (#185573) and 59b6c10 (main 786cfd7) together adopt #185512's design: replies prepare the configured agent inventory workspace (preserveWorkspaceDirOnRefresh: false) and nested runs borrow it, while the reply workspace stays the execution boundary. Main's copy of this test no longer asserts the acquire input (db8180b). * test(agents): expect unverifiable stateless reasoning to be omitted Backport c93fe0b (#185774, main 86ddabd) intentionally stops replaying reasoning that has neither a replay ID nor authorized encrypted state when store is disabled. Main removed this test earlier (542e074); the release copy still expected the unverifiable item. * fix(plugins): allow retained registrations on reused inspections Catalog scope growth can reuse the same physical registry inspection. Keep its already-owned registrations in place instead of transferring them into their own resource map and failing with a duplicate-custody error. Preserve live-owner validation and all distinct-inspection transfer and disposal behavior. Extend the resource-backed lifecycle regression with self-adoption before abandoned growth and promotion. Proof: regression fails on unchanged production; fixed resource lifecycle and all seven selected catalog cases pass. Targeted native types, typed lint, format, suppression tests, runtime/static cycles and planner pass. Independent review found no actionable P0-P2 findings. (cherry picked from commit 52df852) * test(agents): seed the worker catalog in the isolated-completion owner test Backport 0c77c1d (#182952, main 4c3bf18, which shipped no test) carried a test adapted from another line that seeded discovered rows only through the in-process catalog builder. On this branch Gateway-configured agents load their full catalog through the catalog worker, so the setup never saw the row and the test failed from the commit that added it. Seed the worker mock too and match the row by its own fields (the catalog adds provenance). Verified: the test fails at the lease assertion when #182952's runtimePluginPurpose normalization is removed and passes with it. --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
User turns can fail when a plugin or model runtime is replaced during preparation. A stale reply-dispatch selection can reject the turn before execution, and auth refresh can stop after another publication supersedes its first fresh-generation retry. Automatic config reloads also log a terminal failure while admitted plugin work is still settling.
User Impact
Unpinned preparation retries once against the current generation. A stale reply-dispatch pin is dropped only before execution. Executing turns and nested work keep their admitted generation; model/tool execution is never replayed. Auth publication retries supersession on up to two fresh generations, then fails visibly and retains catalog recovery for a later read. Other auth lifecycle failures retain their existing one-retry bound.
Automatic reload keeps its bounded failed writer receipt, then retries the saved configuration after admitted plugin work and cleanup settle. Keeping that receipt open could deadlock a writer that itself holds admitted work. Explicit lifecycle requests retain bounded errors. Work that never settles leaves the saved configuration pending while the previous runtime serves.
Why This Change Was Made
Retry belongs at preparation admission, before execution has effects. Reload deferral belongs at the automatic reload owner after rollback and writer settlement. The previous automatic retry observer is removed from the shared application path. Duplicate candidate cleanup in an inner
finallyis removed because the outerfinallyowns the same cleanup on every exit; no line cap or baseline is changed.Evidence
CI is the behavioral proof channel because the loaded local host did not reach Vitest assertions and the supported remote route failed during setup. Neither setup failure is counted as red evidence. Local validation is limited to touched-file formatting/lint and the production, agents-other, and gateway-root typecheck lanes.
Test-only head
7cb8b029b90ab4cc969d5498ac3bddd194d840cd, run 40464146623:checks-node-changed-1: preparation, auth, and reply regressions fail at assertions. The reply test rejects with the superseded-generation error instead of completing its reply, before execution.checks-node-changed-compact-large-45: Node and Bun reach settlement, then fail because reload emits error logs instead of deferral.Baseline
check-dependenciesreports an unlisteduptimeinvocation inscripts/perf/local-workspace-manifest-measure.ts, unusedencodeLocalWorkspaceTreePacks/LocalWorkspaceTreePackexports insrc/gateway/worker-environments/local-workspace-cas.ts, and three unused perf scripts (chat-history-response-page-measure.mjs,system-prompt-request-measure.ts,worktree-index-metadata-measure.ts). These source files and Knip configuration are unchanged from the base; this is inherited dead-code inventory debt, not an installation or registry failure. No dependency/baseline change is included.P1 autoreview on production head
3528393e652f648627369cd463694bed22c83aafcompleted withscoped-cleanstatus and no accepted/actionable findings. Implementation run 40466480856 passed the preparation, reply, and reload regressions. The exhausted-auth case reached its later recovery assertion, where its mock returned an already-retired registry. The fixture now returns fresh registries unless explicit reuse is requested, matching the production uncached acquisition boundary; assertions and retry bounds are unchanged. That run also reproduces the test-only baseline worker-turn context-engine failures (extrareconcileevent in direct/outer ownership cases). Final-head CI results are recorded below. Test-only CI file durations were 4.64s for leases, 11.34s for auth recovery, and 5.65s for reply fallback; actual test execution remained under five seconds per file. Local wall-time measurements are unavailable under the coordinator's CI-only behavioral-proof instruction.P1 autoreview of the final three-line fixture commit
5f7f1f1cab39d57ad06a502b23f7c43e5f6cd0b4also completed withscoped-cleanstatus. Both reviews used the canonical helper with--max-priority P1,TMPDIRfromgetconf DARWIN_USER_TEMP_DIR, andTMP/TEMPunset.The whole PR changes 11 files (+294/-58, net +236): production +113/-47 (net +66), tests +166/-5 (net +161), docs +15/-6 (net +9). The reload case reuses the existing 145-test shared Gateway suite; its candidate execution was 256ms. That suite's cold baseline duration was 118.04s on Node and 48.92s on Bun; no new per-test Gateway boot was introduced.
Final-head CI
Head:
5f7f1f1cab39d57ad06a502b23f7c43e5f6cd0b4. Run 40468097614 is terminal: failure, with one inherited failing test shard. All newly added regressions pass in the CI-selected Bun lane.reconcileevent; identical assertions fail in unchanged test-only runopenclaw/ci-gateNo rerun, suppression, cap/baseline adjustment, or unrelated worker/dependency repair was used. Final Node behavioral and live Gateway/model proof were not selected/run; local Vitest remains excluded by the coordinator's CI-only instruction. Ready for coordinator review; not merged.