Repository navigation
refactor(agents): deslop agents core second pass - #158378
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: blocked before merge. Reviewed September 26, 2026, 3:07 AM ET / 07:07 UTC (Revision 9). ClawSweeper reviewWhat this changesThe branch consolidates agent execution, provider, prompt, transcript, and workspace paths while preserving plugin environment values on repeated exec preparation and clearing live-test timers after early completion. Merge readiness⛔ Blocked before merge - 4 items remain The earlier agent cleanup is on main, but current main still has two defects addressed here. This branch has distinct, coherent work, so it should remain open. Priority: P2 Review scores
Verification
How this fits togetherThe agent runtime turns model requests and tool calls into provider requests, workspace operations, and replies. Shared preparation and policy code determines what those operations may use and how their results are recorded. flowchart LR
A[Agent turn] --> B[Model and tool preparation]
B --> C[Approval and workspace policy]
C --> D[Provider or tool execution]
D --> E[Result and transcript projection]
E --> F[Reply delivery]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one owner for exec environment preparation and live timeout cleanup, with stable prompt, approval, and transcript behavior in the final main tree. Do we have a high-confidence way to reproduce the issue? Yes for the two included defects: current-main source shows the prepared exec state being replaced on a second pass and the hard timeout surviving early completion. This read-only review did not execute either path. Is this the best way to solve the issue? Yes. The branch repairs those defects at their existing owners and consolidates repeated paths without an identified public contract change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against be531ed2427b. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
3ec6c71 to
e297302
Compare
Keep the foreign generation update on a separate SQLite connection while admitting it through the existing per-store writer queue. This prevents maintenance contention from aborting the fixture before it changes the generation. Mark preparation complete only after the injected change succeeds, so swallowed fixture errors cannot masquerade as an exercised race. Preserve the original assertions, timeouts, and worker policy.
Consolidate repeated execution, provider, catalog, prompt, transcript, lifecycle, and workspace flows under their existing owners while preserving prompt bytes and authority ordering. Retain prepared plugin environment metadata on repeated exec preparation and clear both live completion timeout timers after early settlement. Cover both defects with original-failing regressions.
237510a to
1b96bfd
Compare
e297302 to
d0f2cfb
Compare
* test(skills): bind watcher errors to completed root loss * test(gateway): serialize startup orphan fixture writes Keep the foreign generation update on a separate SQLite connection while admitting it through the existing per-store writer queue. This prevents maintenance contention from aborting the fixture before it changes the generation. Mark preparation complete only after the injected change succeeds, so swallowed fixture errors cannot masquerade as an exercised race. Preserve the original assertions, timeouts, and worker policy. * test(gateway): preserve startup generation fence coverage * refactor(agents): deslop agents core second pass Consolidate repeated execution, provider, catalog, prompt, transcript, lifecycle, and workspace flows under their existing owners while preserving prompt bytes and authority ordering. Retain prepared plugin environment metadata on repeated exec preparation and clear both live completion timeout timers after early settlement. Cover both defects with original-failing regressions.
What Problem This Solves
Maintainer-requested second pass over agents core removes repeated execution, projection, and normalization paths that obscure their existing owners.
Depends on #158619 for the startup-fixture race exposed by CI; land that focused test repair first.
Related: #156311. This pass leaves that PR's touched root files and the excluded runner, tools, sandbox, subagent, session, auth-profile, harness, and failover directories alone.
User Impact
The refactors preserve prompt bytes and ordering, tool contracts, model/provider selection, lifecycle ordering, authority checks, and persistent state. Repeated exec preparation now retains its prepared plugin environment. Live-test completions release both timeout timers after early success or failure.
Why This Change Was Made
Fixes found along the way
Preparing exec arguments twice previously replaced the prepared environment metadata with an empty record, dropping plugin-provided environment values. The preparation owner now returns the already-prepared arguments unchanged. A regression executes the twice-prepared request and checks both effective and requested environment values.
The live completion timeout helper cleared only its abort timer when a provider settled early. It now also clears its hard timeout, and the cache-test path uses the same cleanup owner. Fake-timer regressions cover early success, early failure, and deadline cancellation.
Evidence
3ec6c71d77f9b410612f7b260b8379041fbfe5cf, including 11 routed importer shards. Seven focused/importer suites passed after main reconciliation (52.71s).e297302c20af475ab096a74043e37b540ca142a9,node scripts/check-changed.mjspassed in 1546.05s, including all 25 test-type shards, lint, dead-export scans, and runtime/storage guards.pnpm buildpassed in 440.88s; SDK export metadata and surface checks passed in 0.17s and 3.53s. The saved remote result verifies all 42 phases successful plus a clean-source postflight. The local wrapper was killed after the complete remote result; successful checks were not repeated.Current head is
d0f2cfb6f23390da5dfb273994df2e84b0abbb16, based on Gateway fixture repair1b96bfdeee4b82d47ab985d03253297aa95ea5ed. Compared with the fully testede297302c20atree, only the separate Windows fixture changes; production source, agent tests, and assertion-ratchet bytes are identical. Current-head CI passed: 159 successful jobs, 20 skipped, no failures, includingopenclaw/ci-gate.Two existing fixture failures surfaced in hosted CI and have separate repairs. The linked Gateway repair serializes its foreign SQLite mutation and validates the row so integrity rejection cannot mask generation-fence coverage. Its original historical SQLite error was not logged; a real held-writer control reproduced the contention mechanism. The Windows repair is #158693: recovery completed before an overly specific errno assertion rejected
EPERM. It now binds errors to completed directory loss and retired watcher generations, and passed real Windows CI. Land the Windows repair, then the Gateway repair, then this PR.All execution used Blacksmith Testbox. Initial parity/focused proof used
tbx_01m3cyfjq9m5c690w27276f2yh(run) andtbx_01m3d3kwtd642mmf4hgg2683xb(run). Final integration usedtbx_01m3e22vjgfk1w0c9eyg0tdwj9(run). These leases and the intervening task leases were confirmed stopped. No local tests, builds, or heavy gates ran.Changed-test cost
Remote wall time for
pnpm test <file> --maxWorkers=1includes the wrapper. CI seconds sum the reported case durations on final headd0f2cfb6f23; they exclude shared runner startup and are not directly comparable to standalone wall time:src/agents/)bash-tools.exec.resolve-env-hook.test.tsmodel-scan.probes.test.tsprepared-model-catalog.test.tsprepared-model-runtime.startup-static.test.tsprepared-model-catalog.scoped-thinking.test.tslive-auth-keys.test.tslive-test-helpers.test.tsPersonally inspected Codex source contracts
The exact sibling checkout was inspected at public commit
8f38d5a877da8c5c2c0b5158e72bb5f2290a3157: