Repository navigation
refactor(agents): simplify completed-run bookkeeping - #174838
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: 561cad88fa
ℹ️ 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".
|
Codex review: needs changes before merge. What this changesThis PR removes redundant agent bookkeeping and adopts documented best-effort behavior for exceptional recovery, cancellation, and streaming cases. Example: A CLI executable changes after successful inference completes.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Needs changes before merge - 6 items remain Keep open: this maintainer-approved simplification has useful scope, but a compaction regression and several diff-caused CI failures need repair before merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherAgent runners consume admitted turns and credentials, execute tools or inference, and publish transcripts, completion results, recovery state, and child cleanup outcomes. flowchart TD
A[Admitted turn] --> B[Agent runner]
B --> C[Inference and tools]
C --> D[Completion settlement]
D --> E[Session storage]
D --> F[Replies and observers]
B --> G[Recovery and child cleanup]
Technical reviewBest possible solution: Preserve the accepted simplifications while preventing missing-store creation and completing the affected test and baseline updates. Do we have a high-confidence way to reproduce the issue? The missing-store path is traceable through the production writer and confirmed by exact-head CI; the remaining listed failures have matching test inputs and annotations. Is this the best way to solve the issue? The simplification follows the repository's ownership guidance and recorded maintainer direction, provided validation does not initialize absent storage and tests follow the accepted contracts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1313c3871a21. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -515, Tests -290. Total -805 across 46 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 16, 2026, 8:04 PM ET / October 17, 2026, 00:04 UTC. |
|
Landing exception for exact reviewed head Independent initial and repaired-head reviews completed scoped-clean at P0–P2; repair confidence0.93. Narrow lint/format and suppression audit3/3 pass. Production delta against pinned basefacbe21ddf986047e97c39a5a0de2471f16c5bed is +158/-646:488net lines removed. Security/approval effect boundaries, durable accepted work, FIFO and ordinary shutdown settlement remain. Phase E memory is untouched. All143 exact-head check runs were individually enumerated.85success,54skipped,1neutral,2failures,1superseded metadata cancellation. The only failing behavior job is inherited:
Security-fast117267816370 passes. Current dependency/security statuses are SUCCESS; required CI status is FAILURE solely for the attributed job. No CI rerun, speculative retry or green-only push was made. The latest six completed scheduled-main runs and current flake registry were inspected; the newest schedule supplies direct matching-signature evidence. Two native workflow attempts failed before merge intent: review-init first lost its managed-worktree allocation lease when heartbeat startup exceeded60005ms; lock/process cleanup confirmed. The second failed provisioning with EPIPE and reports operation-complete. No managed PR worktree or retained merge outcome exists. Under coordinator-authorized campaign rule10, use direct squash merge pinned to this exact SHA after posting this evidence. This bypasses broken tooling, not security/review gates. CI is not claimed green. Review comment4300279793's observer-isolation suggestion is declined as an explicitly accepted best-effort case: a plugin violating the observation contract may mutate completed args/results before projection. The hook reference requires explicit modifications rather than relying on in-place mutation; ignored return values and hook shapes stay unchanged. Approval/before-tool isolation and live effect authority remain. No human incident is cited for this particular defensive copy. |
Main hourly 38995631641 exposed two stale assertions. The deliberate f6f54db (#174838) tradeoff no longer reconstructs historical chunk boundaries after an authoritative native item rewrite. Assert the complete corrected body exactly while retaining once-only early-prefix checks; ordinary append, directive, voice and source-occurrence cases stay intact. c0e26d5 (#174964) intentionally balances unfinished fences during a forced flush. Expect the synthetic closer at early and terminal delivery, with the literal MEDIA line preserved as code and no media attachment. No production behavior changes. Both original failures reproduced on main 789c8c0. Focused proof: 31 tests pass with --maxWorkers=1; owning agents-root test types, targeted type-aware lint, formatting, and independent P2 review pass. No CI dispatch, rerun, skip, retry, or timeout change.
PR #174838 removed broad session-change invalidation, but retained run contexts have no admission-release promise. Command cleanup can release its admission before awaited cleanup clears the run context, leaving a recovery attempt without its next wake. Observe only runtime/agent-run changes for retained owners, and schedule the existing one-second wake once their current ownership ends. Preserve admission-release wakes, bounded deferred retries and effect authority. Unsubscribe on reset and account for release during the recovery read. Extend the existing ownership table with staggered admission/run release. Main reproduces the retained-run failure; #174838's parent passes both original cases. Fixed recovery and sweeper files pass 127 tests with maxWorkers=1 (61.05s and 76.55s wrappers). Targeted types, lint, formatting, docs MDX and isolated P2 review pass. No CI dispatch or rerun.
* refactor(agents): simplify completed-run bookkeeping * refactor(agents): retain native snapshot prefixes and align recovery proof
Main hourly 38995631641 exposed two stale assertions. The deliberate a7855f2 (openclaw#174838) tradeoff no longer reconstructs historical chunk boundaries after an authoritative native item rewrite. Assert the complete corrected body exactly while retaining once-only early-prefix checks; ordinary append, directive, voice and source-occurrence cases stay intact. 367e8a0 (openclaw#174964) intentionally balances unfinished fences during a forced flush. Expect the synthetic closer at early and terminal delivery, with the literal MEDIA line preserved as code and no media attachment. No production behavior changes. Both original failures reproduced on main 26e1077. Focused proof: 31 tests pass with --maxWorkers=1; owning agents-root test types, targeted type-aware lint, formatting, and independent P2 review pass. No CI dispatch, rerun, skip, retry, or timeout change.
…175044) PR openclaw#174838 removed broad session-change invalidation, but retained run contexts have no admission-release promise. Command cleanup can release its admission before awaited cleanup clears the run context, leaving a recovery attempt without its next wake. Observe only runtime/agent-run changes for retained owners, and schedule the existing one-second wake once their current ownership ends. Preserve admission-release wakes, bounded deferred retries and effect authority. Unsubscribe on reset and account for release during the recovery read. Extend the existing ownership table with staggered admission/run release. Main reproduces the retained-run failure; openclaw#174838's parent passes both original cases. Fixed recovery and sweeper files pass 127 tests with maxWorkers=1 (61.05s and 76.55s wrappers). Targeted types, lint, formatting, docs MDX and isolated P2 review pass. No CI dispatch or rerun.
What Problem This Solves
Agent bookkeeping grew extra ownership protocols around already-owned work: repeated recovery repairs, detached cancellation custody, retry-cache publication fences, completed-result freshness rescans, and mutable-generation bookkeeping. The introducing changes described forced interleavings rather than human-reported failures for these particular guards.
User Impact
No new feature or configuration is introduced. Rare recovery, callback, and streaming interleavings use the best-effort behavior listed below; security, durable accepted work, FIFO, and ordinary shutdown settlement remain protected.
What changed
Use one awaited idempotent recovery repair and one bounded failed-registration cancellation. Let the existing Gateway own actual child execution and shutdown. Keep the measured recovery cache and bounded retries, but remove observer invalidation/facts-vector admission around that cache. Completed Stop and CLI results no longer become failures solely because their old resolver or executable changed afterward.
Use a plain unique-entry sandbox registration stack, captured auth-state identity, typed private history projection, and existing canonical membership/selected draft facts. MCP turn completion drains admitted work without a speculative late-arrival quiet window. Remove repeated observer/result copies under the existing by-reference contract and historical reconstruction of already-delivered streaming source rewrites.
Security/approval effect revalidation, credential ownership, external parsing, durable accepted input/transcripts/retry ceilings, ordinary awaited shutdown settlement, and FIFO remain. Phase E standalone memory backend, factory, registry/expiry/federation machinery, and tests are untouched. No config, schema, protocol, dependency, or public SDK change.
Best-effort tradeoffs accepted
pendingInputscan be silently retained ininterruptedstate with no automatic replay and no bilateral warning #144594 accepted-input FIFO remains.Evidence
Current repaired production diff against pinned base facbe21: +158/-646, 488 net lines removed across29 production files;48 total changed paths. Test/support/generated/declaration files excluded from this production measure. No production z04 exclusion overlap; the assertion baseline receives only the explicitly authorized shrink-only ratchet update. Necessary native-prefix handling was restored after CI rather than padding the cut to the normal size floor.
The initial whole-change review and fresh six-file repair review both completed scoped-clean at P0–P2 (repair confidence0.93, final source verification completed). Original46-path type-aware lint and suppression audit3/3 passed; final five-path repair type-aware lint and the fresh suppression audit3/3 also pass (188.99s Vitest;259.04s wrapper). Formatting and whitespace pass. The production diff adds no module import specifier. Check-changed dry-run classified the initial46 paths; broad graph checks remain hosted-CI proof under the campaign host budget.
CI38982486674 on561cad88 failed on five attributable jobs: assertion-baseline shrink; obsolete reservation cleanup retry expectations; obsolete admitted-restoration retries; streaming native-prefix handling; and an added actual-write missing-store expectation beyond the original no-op owner contract. This repair shrinks only the ratchet, replaces retry-only proof with one-shot warning/durable-state and successful refund/no-dispatch coverage, restores native-prefix/shortened-fence behavior and its original test, and retains the original read-only missing-store regression. These are our failures, not inherited-red claims. The body-context failure has successful same-head replacement38983087434.
The repair's four-suite isolated replay spent1053.364s compiling workers, then another ten minutes in Vitest without a case result. Its owned runtime was interrupted and joined; wrapper exited130 after1817.52s and retained completed compiler outputs. That is neither passing proof nor an assertion failure. Earlier full runtime-cycle scanning likewise produced no graph result under shared host load; no production import edge is added. No timeout, retry, skip or suppression was added. Exact-head hosted CI is the broad behavior/type/cycle gate. All runtime/test commands use isolated HOME/OpenClaw/XDG state, maxWorkers1, and serial execution.
Admin exception: inherited CI failure
Repaired-head CI38989171245 has one non-aggregate failed job: checks-node-changed-compact-small-20-1 (117267817193), with two unchanged Gateway accepted-facts tests reporting
Drain bypassed the pending ACP readat line429. Both identical cases and assertion fail on completed scheduled main38988964265, head2354224e994429dbb63cd5c09fc96e245aec1488, job117267060121. The failing test is byte-identical between PR and that main head. This is direct scheduled-main evidence, not an import-graph or local-timeout inference. The CI gate117269579233 is its downstream aggregate. No PR-caused failure remains on this head.All143 exact-head check runs were enumerated:85success,54skipped,1neutral,2failures above, and one superseded metadata cancellation. PR-context cancellation117267450406 has successful same-head replacement117267548035; no behavior suite is missing. Security-fast117267816370 and current dependency/security statuses pass. No CI rerun or green-only push was made.
Two native review-init attempts failed before any merge intent: state-lease heartbeat startup timeout60005ms, then managed-worktree provisioning EPIPE. The first released its operation lock and all known children exited; the second reports operation-complete and leaves no managed PR worktree or merge outcome. Campaign rule10 authorizes the exact-head guarded REST squash route after the evidence comment. Failed CI remains accurately labeled inherited, not green.
Review disposition: the after-tool observation isolation suggestion is declined under the campaign's explicit best-effort tradeoff above. The hook reference requires explicit modifications rather than relying on in-place mutation; after-tool return values remain ignored. No authorization/approval effect check is removed, and no human incident is cited for an observer mutating completed data. Public hook/event shapes are unchanged.