Repository navigation
fix(agents): classify code mode aborts separately from timeouts - #102494
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 7:20 AM ET / 11:20 UTC. Summary PR surface: Source +30, Tests +168. Total +198 across 5 files. Reproducibility: yes. Source inspection shows current main returns Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the split after maintainers accept the failure-code taxonomy change and exact-head guards pass, keeping deadline expirations as Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main returns Is this the best way to solve the issue? Yes. The latest head fixes the shared headless Code Mode and cron error boundary instead of adding a caller-side workaround, while preserving deadline ownership after earlier review findings. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 09a6b5e5c849. Label changesLabel justifications:
Evidence reviewedPR surface: Source +30, Tests +168. Total +198 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (4 earlier review cycles)
|
eece6b3 to
3084a68
Compare
|
Land-ready after maintainer refactor.
Proceeding through the repository-native exact-head prepare and merge guards. CI follow-up on exact head
|
3084a68 to
d69a01f
Compare
|
Merged via squash.
|
…claw#102494) * fix(agents): classify code mode aborts separately from timeouts * fix(cron): accept aborted code mode trigger failures * fix(agents): keep code mode wall-clock timeouts classified * fix(cron): preserve abort and timeout ownership * test(cron): preserve typed abort reasons --------- Co-authored-by: Peter Steinberger <[email protected]>
* refactor: consolidate command and cron preparation paths Keep one sub-CLI metadata/registration catalog, common cron payload updates, canonical agent migration visitors, and shared account-state projection. Trust typed internal adapters while retaining external validation, effect authority, cancellation settlement, supported migrations and path containment. Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files). Branch-only handoff for the coordinator's bundle; no standalone PR. Best-effort tradeoffs accepted: - Cron mid-setup reload recovery (#146582): synthetic retirement, no human incident. Setup may fail; the next invocation refreshes the cache. - Recursive shared preparation retry (#102494/#138337): synthetic concurrent callers; production serializes same-job work. Duplicate direct callers may share cancellation. Failed-owner eviction preserves the next sequential run. - Progress publication generation (#143621): synthetic held update/reset. Presentation dedupe may briefly be stale until a subsequent render/reset. - Doctor adapter schema mirror (#69919): malformed synthetic hooks. Invalid executable adapters fail visibly; missing-hook fallbacks and config checks stay. - Setup adapter schema mirror (#165492): typed internal union. Invalid internal adapters fail when used; both supported wizard forms remain. - Injected process schema mirror (#84381): malformed injection was not human SIGTERM report #71710. Invalid adapters fail registration; cancellation stays. - Loaded registry row revalidation/copy (#114942/#158830/#114476): rows already admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays. - Custom compatibility duplicate check (#14223): all callers parse/type it. Hand-crafted invalid JS uses the default branch; external flags still reject it. - Log probe identity matching (#88159, superseded by #168587): abort now joins the sole probe, so replacement cannot race its result. Recovery/settlement stay. - Whole-config deep copy (#71218): no detached-copy incident. Structural copy updates agents/defaults; unrelated future mutation must respect config ownership. - Repeated plugin-root probes (#70012): no disappearing-root incident. Resolve roots once; root replacement can fail discovery. Symlink containment stays. - Second payload getter read (#135319): synthetic review/corpus, not a human report. Ordinary decoded records are read once; stateful accessors may differ. Proof: fresh independent review clean; core types, targeted lint/format, runtime and static cycles, assertion/line-cap ratchets, and suppression suite passed. Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup and cold-import checks passed. Cron and commands cohorts were interrupted after partial results; complete owner tests, payload merging, test-graph types, broad check-changed and build/smoke remain unproved at commit preparation. Unattributed local 120-second timeouts retained: two root-command-descriptions catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout, retry, skip or kept-behavior expectation changes. Env-name budget mismatch (455 vs 454) also exists at original HEAD and pinned main 7dccff5. All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched. * refactor: consolidate cron payload and lazy CLI paths Share daemon and cron method forwarding through the existing lazy binder, remove the cron CLI reexport shim, and consolidate normalization and merge handling without changing public fields, explicit clears, or effect authority. Remove the obsolete bundled discovery reentry mechanism and impossible Doctor issue helper. The full lane now removes 475 net production lines. Best-effort tradeoffs accepted: - Unknown Doctor issue variants supplied by hand-crafted JavaScript return the invalid value rather than a custom error. Typed local producers and exhaustive switches remain; reporting feature #95979 cites no human unknown-kind incident. - Synchronous bundled-module self-discovery may fail through the existing loader diagnostic instead of returning empty inventory. Commit 65f18d6 only pins injected Jiti reentry, not a human incident; ordinary caches remain. - Cron defaults trust staggerMs normalized earlier in the same synchronous call. No await or mutation boundary intervenes; externally supplied invalid values remain rejected by the normalizer. * fix(channels): retain replacement preview deduplication Withdraw the progress compositor generation removal after the Mattermost retiring-publication case failed CI and bounded serial head/base replays remained inconclusive under load. Restore that file exactly to the branch base and keep all Mattermost tests unchanged, following the campaign fallback. Prune the single obsolete mock-export allowance left by the removed bundled discovery reentry fixture. The local mock ratchet passes with 9586 factories. The remaining lane reduction is 471 net production lines across 25 paths.
…#173036) * refactor: consolidate command and cron preparation paths Keep one sub-CLI metadata/registration catalog, common cron payload updates, canonical agent migration visitors, and shared account-state projection. Trust typed internal adapters while retaining external validation, effect authority, cancellation settlement, supported migrations and path containment. Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files). Branch-only handoff for the coordinator's bundle; no standalone PR. Best-effort tradeoffs accepted: - Cron mid-setup reload recovery (openclaw#146582): synthetic retirement, no human incident. Setup may fail; the next invocation refreshes the cache. - Recursive shared preparation retry (openclaw#102494/openclaw#138337): synthetic concurrent callers; production serializes same-job work. Duplicate direct callers may share cancellation. Failed-owner eviction preserves the next sequential run. - Progress publication generation (openclaw#143621): synthetic held update/reset. Presentation dedupe may briefly be stale until a subsequent render/reset. - Doctor adapter schema mirror (openclaw#69919): malformed synthetic hooks. Invalid executable adapters fail visibly; missing-hook fallbacks and config checks stay. - Setup adapter schema mirror (openclaw#165492): typed internal union. Invalid internal adapters fail when used; both supported wizard forms remain. - Injected process schema mirror (openclaw#84381): malformed injection was not human SIGTERM report openclaw#71710. Invalid adapters fail registration; cancellation stays. - Loaded registry row revalidation/copy (openclaw#114942/openclaw#158830/openclaw#114476): rows already admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays. - Custom compatibility duplicate check (openclaw#14223): all callers parse/type it. Hand-crafted invalid JS uses the default branch; external flags still reject it. - Log probe identity matching (openclaw#88159, superseded by openclaw#168587): abort now joins the sole probe, so replacement cannot race its result. Recovery/settlement stay. - Whole-config deep copy (openclaw#71218): no detached-copy incident. Structural copy updates agents/defaults; unrelated future mutation must respect config ownership. - Repeated plugin-root probes (openclaw#70012): no disappearing-root incident. Resolve roots once; root replacement can fail discovery. Symlink containment stays. - Second payload getter read (openclaw#135319): synthetic review/corpus, not a human report. Ordinary decoded records are read once; stateful accessors may differ. Proof: fresh independent review clean; core types, targeted lint/format, runtime and static cycles, assertion/line-cap ratchets, and suppression suite passed. Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup and cold-import checks passed. Cron and commands cohorts were interrupted after partial results; complete owner tests, payload merging, test-graph types, broad check-changed and build/smoke remain unproved at commit preparation. Unattributed local 120-second timeouts retained: two root-command-descriptions catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout, retry, skip or kept-behavior expectation changes. Env-name budget mismatch (455 vs 454) also exists at original HEAD and pinned main 89f8219. All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched. * refactor: consolidate cron payload and lazy CLI paths Share daemon and cron method forwarding through the existing lazy binder, remove the cron CLI reexport shim, and consolidate normalization and merge handling without changing public fields, explicit clears, or effect authority. Remove the obsolete bundled discovery reentry mechanism and impossible Doctor issue helper. The full lane now removes 475 net production lines. Best-effort tradeoffs accepted: - Unknown Doctor issue variants supplied by hand-crafted JavaScript return the invalid value rather than a custom error. Typed local producers and exhaustive switches remain; reporting feature openclaw#95979 cites no human unknown-kind incident. - Synchronous bundled-module self-discovery may fail through the existing loader diagnostic instead of returning empty inventory. Commit ca10460 only pins injected Jiti reentry, not a human incident; ordinary caches remain. - Cron defaults trust staggerMs normalized earlier in the same synchronous call. No await or mutation boundary intervenes; externally supplied invalid values remain rejected by the normalizer. * fix(channels): retain replacement preview deduplication Withdraw the progress compositor generation removal after the Mattermost retiring-publication case failed CI and bounded serial head/base replays remained inconclusive under load. Restore that file exactly to the branch base and keep all Mattermost tests unchanged, following the campaign fallback. Prune the single obsolete mock-export allowance left by the removed bundled discovery reentry fixture. The local mock ratchet passes with 9586 factories. The remaining lane reduction is 471 net production lines across 25 paths.
What Problem This Solves
Code Mode aborts were being reported as timeouts, which made caller cancellation look like the worker had exceeded its deadline. That misclassified the failure mode and blurred the difference between a user-requested abort and a real timeout.
Why This Change Was Made
runCodeModeWorker()now returns a distinctabortedfailure code when the parent signal cancels the worker leg, while actual timer expiry still usestimeout. The headless regression test now asserts that aborts surface asabortedwith the dedicated abort message instead of the timeout path.User Impact
Users and operators can now tell the difference between a manual/caller-driven cancellation and an actual Code Mode timeout, which improves diagnosis and downstream retry behavior.
Evidence
node scripts/run-vitest.mjs src/agents/code-mode-headless.test.ts[test] starting test/vitest/vitest.agents.config.tsRUN v4.1.9 /home/0668000995/10288592/git-hub/codex/openclawTest Files 1 passed (1)Tests 10 passed (10)Duration 43.61s (transform 18.12s, setup 1.97s, import 21.88s, tests 19.01s, environment 0ms)[test] passed 1 Vitest shard in 55.92s