Repository navigation
refactor(agent-runner): split run policy ownership - #122209
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 3:54 PM ET / 19:54 UTC. ClawSweeper reviewWhat this changesThe branch splits embedded agent-runner stream and incomplete-turn policy into focused modules, repoints callers, and divides the related tests into dedicated shards. Merge readinessNo remaining blocking patch defect found. The prior serial-test-routing finding is fixed at the latest head; keep this protected maintainer PR open until exact-head checks finish and a maintainer decides to merge. Priority: P3 Review scores
Verification
How this fits togetherEmbedded agent runs turn provider stream output into tool calls and decide whether incomplete responses are retried, surfaced to users, or recorded as terminal. Those decisions feed delivery evidence, run liveness, and recovery behavior. flowchart LR
A[Provider stream] --> B[Tool-call normalization]
B --> C[Embedded run attempt]
C --> D[Incomplete-turn policy]
D --> E[Retry or terminal decision]
E --> F[Delivery and run state]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +260, Tests +251, Other -2. Total +509 across 47 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve the direct extracted-owner imports and enumerated serial test list, then merge after exact-head agent-runtime validation is green. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-neutral refactor, and the relevant verification is source-equivalence plus focused test-project routing coverage rather than a user failure reproduction. Is this the best way to solve the issue? Yes. The split keeps composition at the existing stream and terminal callers while moving independent policy leaves into direct owners; retaining the oversized monolith or adding a compatibility barrel would not improve the boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7a1d5a86c7ba. LabelsLabel 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 (1 earlier review cycle)
|
|
Merged via squash.
|
* refactor(agent-runner): split tool-call normalization ownership * refactor(agent-runner): split incomplete-turn ownership * test(agent-runner): hide incomplete-turn test helper * test(ci): route split incomplete-turn tests * test(ci): enumerate split incomplete-turn tests * test(vitest): route split incomplete-turn tests to their serial shard
What Problem This Solves
Two grandfathered embedded-run owners still mixed independent policy concepts in oversized production modules and tests, requiring four
max-linessuppressions. This is wave 3 PR 2 of the ownership-split campaign, following #122148.Why This Change Was Made
This behavior-neutral refactor separates tool-call name resolution, replay sanitization, live stream normalization, and text promotion into distinct owners while preserving the exact wrapper composition order in
attempt-stream.ts. It also separates incomplete-turn classification, terminal evidence, payload/liveness resolution, and retry recovery so classification and evidence remain dependency leaves and recovery never depends on resolution.All callers now import the owning module directly; no compatibility barrels were added. The deferred argument-repair split remains intentionally untouched.
Module line counts after the split:
The four completed production/test suppressions and their
config/max-lines-baseline.txtentries are removed.User Impact
None. Tool-call replay, promoted IDs, provider transcript validation, tool-result pairing, retry eligibility, delivery evidence, run liveness, and user-visible incomplete-turn messages are unchanged.
Evidence
attempt.test.ts, and three subscribe lifecycle files.normalizeToolPolicyNamerename into the extracted owners.local-containerproof (cbx_ae9fc2af6bf8,tidal-krill):pnpm check:changedpassed the selected formatting, dead-export, production/test typecheck, full core lint, boundary, and import-cycle gates;pnpm buildpassed in 4m21s. Blacksmith Testbox and brokered AWS were unavailable on this host, so this is container proof rather than remote proof.pnpm check:import-cycles: 0 runtime value cycles.pnpm check:madge-import-cycles: 0 cycles.pnpm plugin-sdk:surface:check: 152 public entrypoints and 4,868 public exports unchanged.pnpm check:max-lines-ratchet --base origin/main: passed with 945 grandfathered suppressions; this branch removes four entries.git diff --check: passed.origin/main: clean, no accepted/actionable findings.Raw move-aware classification from
git diff --numstat origin/main...HEAD: