Repository navigation
refactor(agent-runner): split run leaf ownership - #122148
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 12:55 PM ET / 16:55 UTC. ClawSweeper reviewWhat this changesThe PR splits embedded agent-run tool-warning policy and model-call diagnostic lifecycle/observation logic into smaller modules while preserving the existing public entrypoints and tests. Merge readinessNo blocking source-level defect found: the split keeps the existing diagnostic and payload entrypoints while moving their private policy and lifecycle bodies into focused owners. Keep this maintainer-authored PR open for its normal final merge-result and exact-head CI checks. Priority: P3 Review scores
Verification
How this fits togetherEmbedded agent runs wrap model streams to emit diagnostics and turn final results into channel reply payloads. This change reorganizes the private helpers behind those two boundaries without changing their callers. flowchart LR
A[Model stream] --> B[Diagnostic entrypoint]
B --> C[Lifecycle owner]
B --> D[Observation owner]
C --> E[Events and hooks]
A --> F[Reply payload builder]
F --> G[Tool warning policy]
G --> H[Channel reply payload]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +101, Tests +210, Other -4. Total +307 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the existing two entrypoints as composition facades, keep warning, observation, and lifecycle state in their extracted private owners, and land after final exact-head validation. Do we have a high-confidence way to reproduce the issue? Not applicable: the PR reorganizes existing internal ownership rather than repairing a reported user-facing failure. Is this the best way to solve the issue? Yes: extracting the private policy and lifecycle seams while preserving the callers’ established entrypoints is the narrowest maintainable way to remove the max-lines debt. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 82ba647673f9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* refactor(agent-runner): split payload warning ownership * refactor(agent-runner): split model diagnostic ownership
What Problem This Solves
Two grandfathered embedded-run owners mixed independent policy and lifecycle concepts in oversized modules and tests, requiring four
max-linessuppressions. This is wave 3 PR 1 of the simplification campaign, following the wave 1/2 ownership splits in #121929, #121974, #121995, and #122002.Why This Change Was Made
This behavior-neutral refactor extracts payload tool-warning policy into
tool-error-warning.ts, and separates model-call observation, lifecycle, and stream-proxy ownership behind the existing diagnostic entrypoint. Matching oversized tests are split along the same concepts. Existing public imports and mock seams remain onpayloads.tsandattempt.model-diagnostic-events.ts.The planned argument-repair split is intentionally excluded: its structured-message tool-name normalizer is shared by the proposed parser and stream owners, so the approved single-export seam would require either a second internal export or a non-verbatim adapter. The work order's escape hatch keeps that file, suppression, and baseline entry unchanged.
Module line counts after the split:
payloads.ts: 552tool-error-warning.ts: 392payloads.errors.test.ts: 474tool-error-warning.test.ts: 730attempt.model-diagnostic-events.ts: 219attempt.model-diagnostic-observation.ts: 391attempt.model-diagnostic-lifecycle.ts: 440The four completed production/test suppressions and their
config/max-lines-baseline.txtentries are removed.User Impact
None. Reply payload text, warning policy, diagnostic event ordering, trace propagation, hook behavior, byte accounting, stream cleanup, and public exports are unchanged.
Evidence
node scripts/check-changed.mjs: passed all selected core, core-test, lint, dead-export, formatting, architecture, and tooling gates locally after no remote backend was available.pnpm build: passed in 14m12s; noINEFFECTIVE_DYNAMIC_IMPORTwarning.pnpm check:import-cycles: 0 runtime value cycles.pnpm check:madge-import-cycles: 0 cycles.pnpm plugin-sdk:surface:check: passed; 152 public entrypoints and 4,866 public exports unchanged.pnpm check:max-lines-ratchet --base origin/main: passed with 956 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: