Repository navigation
refactor(agents): consolidate embedded runtime variants - #167186
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. |
Per-file implementation coverage (1/2)Base P1 merged reductions plus this candidate contribute 2,173 runner-only lines (3.2521% of the original 66,818-line baseline) and 2,477 production lines including adjacent code. PR2 contributes 453 runner lines and 766 total; independently landed upstream changes are excluded. Conflict resolution preserved main’s Retained full-test receipt: 441 files / 5,816 cases at At final head The final mandatory lint-suppression test FAILED: 2 passed / 1 failed. The exact same missing allowlist record for two Unprefixed paths are relative to
|
Per-file implementation coverage (2/2)Base P1 merged reductions plus this candidate contribute 2,173 runner-only lines (3.2521% of the original 66,818-line baseline) and 2,477 production lines including adjacent code. PR2 contributes 453 runner lines and 766 total; independently landed upstream changes are excluded. Conflict resolution preserved main’s Retained full-test receipt: 441 files / 5,816 cases at At final head The final mandatory lint-suppression test FAILED: 2 passed / 1 failed. The exact same missing allowlist record for two Unprefixed paths are relative to
|
|
|
Codex review: blocked before merge. Reviewed October 8, 2026, 7:18 AM ET / 11:18 UTC. ClawSweeper reviewWhat this changesThe branch consolidates repeated agent preparation, recovery, streaming, compaction, and transcript operations while migrating callers away from an internal forwarding module. Review scores
ProductKind: Refactor · Worth it: Yes Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this maintainer-authored PR contains distinct consolidation work that current main does not already cover. No concrete introduced regression was found; confidence is limited by test-based runtime evidence and partially unavailable history. Priority: P3 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe embedded agent runtime turns conversation history, selected models, credentials, and tools into model requests, streamed replies, and transcript updates. This consolidation shares existing operations within that runtime. flowchart TD
A[Conversation and settings] --> B[Prepare agent run]
B --> C[Select model and credentials]
C --> D[Execute model and tools]
D --> E[Stream replies]
D --> F[Recovery and compaction]
F --> D
E --> G[Settle and update transcript]
Technical reviewBest possible solution: Keep the existing runtime owners and consolidate only equivalent operations, preserving explicit variant ordering and public contracts. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes behavior-preserving consolidation rather than a reported runtime defect. Is this the best way to solve the issue? Yes: sharing operations inside their existing owners and removing the migrated forwarding path is a maintainable approach; the reviewed hunks retain the relevant ordering and policy distinctions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 814046efacad. Provenance checked
TestingProof path: unit tests only. Added test files: 16. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. Stored data modelPersistent data-model change detected: 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 |
|
Review checklist disposition for
The review reports no concrete finding. Its config/data-model checklist was triggered by incomplete file metadata and the compaction filename, rather than a demonstrated contract change. The complete diff, source inspection, compatibility assessment, and test evidence resolve those items. The inherited local lint-suppression failure remains explicitly documented and reproduced on current main; this PR does not change either implicated file. |
) * refactor(agents): consolidate embedded runtime variants * chore: shrink agent assertion safety baseline * test(agents): preserve tool-start mock exports * test(agents): remove stale settlement fixture inputs * refactor(agents): keep patch activity type local * test(agents): observe recovery profile dispatch * refactor(agents): preserve lint-safe runtime forms
What Problem This Solves
The embedded agent runtime still repeated preparation, recovery, streaming, and compaction work after the first consolidation pass.
User Impact
No user-visible change. Features, text, authority checks, cancellation, replay, configuration, SDK contracts, and persisted shapes are preserved.
Why This Change Was Made
Shared implementations now handle repeated provider matching, compaction preparation, subscriber delivery, and transcript metadata while keeping variant-specific inputs and ordering explicit. Internal preparation interfaces are narrower, and all callers and mocks have migrated from the removed tool-handler forwarding barrel.
This second d03 pass removes 766 net production lines (1,240 added / 2,006 removed across 105 production paths). The 128-minute implementation pass records 357 per-file decisions, including measured rejected prototypes, in the accompanying coverage comments. It uses the campaign’s 500–999-line exception. Tests changed only for removed internal seams; assertions and scenarios remain intact.
Together with the first merged pass, the lane removes 2,173 runner lines (3.25%) and 2,477 production lines including adjacent owners. Independently landed upstream reductions are excluded. A further 39-line run-entry cutover remains a proposal because it requires a prohibited cron caller.
Evidence
4e1055ae779. Three normally excluded live-provider files are not counted as proof.262890b6665f47ed73535312a1646f377fae1317(7954898a206).d12224379b2729e2bff6500f63b2b962f457db46preserves main’s image-decoding and interactive-payload fixes. 8 files / 172 tests, production and affected agent test types, formatting, lint, and both zero-cycle checks passed. Whole-branch independent review completed scoped-clean at P3.node scripts/run-vitest.mjs <18 changed/seam-consumer files> --maxWorkers=1. 18 files / 432 tests passed; summed Vitest duration 133.11s, wrapper wall 626.71s including runtime artifact preparation. This used CI mode on an 8-vCPU Linux host.The mandatory lint-suppression test was run and is inherited red: 2 passed / 1 failed. It reports two unlisted
typescript/prefer-promise-reject-errorssuppressions in untouchedsrc/config/sessions/session-transcript-lock-settlement.ts(79 actual entries versus 78 expected). A fresh frozen install of current main9c763cb168e9461f76e9c3a9059c7b38838a7d3breproduces the identical failure. Both that file andtest/scripts/lint-suppressions.test.tsare byte-identical across base, head, and current main. This lane adds no suppressions and does not change the allowlist or its assertions.