Repository navigation
refactor(agents): fold single-consumer runtime owners - #177005
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: needs changes before merge. What this changesThis PR folds private runtime helpers into their production consumers and migrates their tests. Example: A policy blocks run-1 with “Request blocked.”
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-directed refactor consolidates existing owners without an identified introduced correctness defect. Priority: P3 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherAgent preparation consumes session, routing, tool-policy, and hook context; prompt execution submits admitted requests, finalization records completion evidence, and usage parsing reads transcript accounting. flowchart TD
A[Agent ingress] --> B[Session preparation]
B --> C[Tool catalog]
C --> D[Prompt preparation]
D --> E[Model transport]
E --> F[Attempt finalization]
D --> G[Owned transcript]
G --> H[Usage accounting]
Technical reviewBest possible solution: Land the owner folds after resolving the reported conflict while preserving newer main behavior and passing required checks. Do we have a high-confidence way to reproduce the issue? This PR addresses redundant private implementation surfaces rather than a reported runtime failure; source inspection confirms the extracted paths and their consumers. Is this the best way to solve the issue? The defect is unnecessary private forwarding and projection surfaces. The invariant is unchanged routing, prompt content, authority checks, transcript writes, and completion accounting. Direct folds into the existing consumers provide the smallest complete cutover, with no replacement manager or parallel implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d51ef6ac2b72. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -247, Tests +64, Other -4. Total -187 across 29 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 19, 2026, 2:18 AM ET / 06:18 UTC. |
62d8a2c to
db822d2
Compare
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. |
|
Exact-head inherited-failure attribution for All 236 check runs were enumerated. No checks remain pending. All selected tests, types, lint, build and security checks passed, including
Cancelled earlier dispatch/context jobs have successful same-head successors: dispatch117927070269/117929156712 and context117927072155/117929157242. They are superseded administrative runs, not missing product proof. Before attribution, the coordinator registry and last six completed scheduled-main runs were checked: 39205204421,39200477526,39195750293,39191176869,39186683798,39183785855. Their older chat-budget signature is not claimed to match this new-session failure; the actual same-job base rebuild supplies the direct evidence. The tested merge Git object is retained and verified with exactly the ordered parents above: base0b702b550854, head db822d2. The native inherited-only admin exception is authorized by the z25 campaign and retains the exact-head review, failed attempt, source objects and hashed job logs. No CI rerun, budget/baseline change, retries, skips, or security/review waiver is involved. This is not a green-CI claim. Local conflict proof passed twelve native type roots,152 focused cases, normal type-aware lint and both zero-cycle checks. The earlier ACP fixture failure remains disclosed in the PR; its passing unchanged replay did not prove repair or inheritance. Independent whole-candidate review completed scoped-clean with final source verification. Campaign rule 10 fallback: two native |
What Problem This Solves
Agent preparation and attempt finalization pass data through private modules with one production consumer, leaving redundant exported implementation surfaces.
User Impact
No user-visible change. Public contracts, prompt bytes, lazy imports, authorization, transcript writes and completion evidence remain unchanged. Phase E is untouched.
Why This Change Was Made
Move ACP metadata overlay into the metadata owner, run/conversation preparation into session preparation, tool-search planning into the tool catalog, trajectory classification into attempt finalization, and the active policy gate into prompt preparation. Fold the sole-consumer transcript tool scanners into the usage parser, which now traverses content once for both calls and results. Remove the retired modules and their argument-projection packets. Retained tests now exercise the production owner rather than keeping private helpers exported.
This is the runtime-area slice of a materialized 84-file single-consumer family, split by area under campaign rule 11. Its reply, UI and plugin siblings remain separate for CI attribution. This slice removes 248 net production lines across 15 production paths, 29 total paths after conflict repair; tests/support and exact shrink-only inventory rows are excluded. An unused exported reply-tag return type also becomes module-private; the scanner itself remains separate to keep its 680-line consumer within the file cap.
Measured production delta: +377/-625 against main
572cb278b243dcde95875e671f7ef4355c39a188. Migrated tests/support: +515/-451 (64 net added). Obsolete assertion/mock/native-test inventory rows: four removed, with no expanded allowance.Best-effort tradeoffs accepted
emptyAssistantReplyIsSilentdirectly instead of comparing it withtrue. Its production caller supplies a computed boolean; non-boolean internal inputs contradict the existing type contract and receive no extra defensive equality check.Evidence
Complete source/caller and migrated-test inspection and smallest-complete-cut pass completed. Before conflict repair, independent P0–P2 review of the entire 247-line candidate completed scoped-clean, including final source verification. An earlier unfinished review was stopped before assessment to remove an obsolete assertion allowance and use the existing object-record coercion boundary instead of moving a cast into the parser. Canonical formatting and whitespace checks passed.
Frozen/prefer-offline setup completed in 1m 2.7s using the existing pnpm store with isolated application state. No tracked manifest, lockfile or generated-file changes resulted. Targeted native types passed eleven owner/consumer test roots after fixing the hook fixture's two owned unknown-message type errors with the existing record guard; no cast, assertion, timeout or production behavior changed.
Initial focused proof reached seven files: 198 unique cases passed and one manual ACP elicitation fixture failed its short polling assertion before status publication. The unchanged isolated case then passed (14.5s), which is not proof of repair or inherited failure. An exploratory event-gate fixture change did not produce a verdict and was dropped; the original test and all its assertions remain unchanged. No timeout, retry or skip was added. The initial failure remains disclosed, not relabeled green.
Serial completion proof passed all five previously unreached owner suites: ACP metadata 3, prefix stability 5, prompt/finalization 30, session preparation 22, plus the 14-case suppression suite. This adds 60 distinct owner passes to the original 198; suppression is not double-counted. Five canonical shards took 1,156s on the shared host. Metadata/prefix/attempt shards were dominated by transform/import cost; session preparation took 244s, including about 86s exercising real metadata/skills/plugin/session composition. The migrated tests intentionally exercise those owners instead of restoring private production seams. CI seconds are pending.
Normal type-aware lint found one owned redundant required-boolean comparison in the folded finalization code. After its direct-boolean correction, the finalization owner passed all 12 cases and suppression all 14 again; targeted native types passed all eleven roots with no diagnostics. Those two canonical test shards took 432s, with finalization's 343s dominated by worker compilation (96%). Fresh whole-candidate independent P0–P2 review after this correction completed scoped-clean with final source verification. The one-file typed-lint replay passed; the other fifteen surviving lint targets had no findings. Changed-check planning completed in dry-run mode only, without executing broad gates. Runtime cycle check passed with zero value cycles; Madge passed with zero cycles. Whitespace and retired-path reference checks passed. The serial final proof pipeline exited successfully.
GitHub reported the first draft head conflicting. The repair rebases onto main
572cb278b243dcde95875e671f7ef4355c39a188, retaining Goal continuation after prepared conversation options and before return (#174211), requester recovery identity/custody (#157806), prompt tool-surface persistence, and Gateway publication-failure coverage. Refreshed frozen/prefer-offline setup completed in 24.2s after main's pinned dependency update; no tracked generated, manifest or lockfile changes resulted. Targeted native types passed twelve affected owner/consumer roots, including Goal continuation. Fresh whole-candidate P0–P2 review of the resolved candidate completed scoped-clean with final source verification.Conflict-focused proof passed all 152 cases across six files: Gateway ownership 34, Goal continuation 53, prefix stability 5, prompt phase 18, session preparation 28, and suppression 14. Canonical shard wall times total 1,577.12s on the shared host. Gateway's 720.25s was 94% transform work; session preparation's 144.24s included 23% actual metadata/skills/plugin/session composition, which verifies the real preparation owner rather than reintroducing private test seams. This passing rebase run does not establish a repair or inherited cause for the separately disclosed ACP fixture failure. Conflict-focused type-aware lint passed all five affected files without diagnostics. Runtime and Madge cycle checks both passed with zero cycles, staged whitespace passed, and the serial proof pipeline completed successfully.
Exact-head PR CI is the broad proof; no local broad suite/build/E2E/whole-graph checker or operator-state access is claimed.
CI attribution
On exact head
db822d2fa3eb82da3c467a7c0a4c93c75dc0fbcd, completed CI run 39211942571'scontrol-ui-performancejob 117927530723 fails the new-session boot budget: 1,050,273 B against 1,050,000 B. The job itself builds and compares base0b702b5508545fb70fa5b3c4e72930c3004f26aband candidate merge5ad0899b917af86955e3f8c488ae092c5106ecd6: both produce exactly 1,050,273 B and 20 requests (+0 B, +0 requests). Chat boot and both route CSS totals are also unchanged. This is inherited by direct same-job base comparison, not inferred from the separately listed scheduled-main chat-budget signature. The performance checker, budgets, capture and UI sources are untouched. No rerun or budget/baseline change is requested. The last six completed scheduled-main runs and coordinator failure registry were checked before attribution. All 236 exact-head check runs were enumerated: no checks remain pending, and the only other failure is aggregate job 117929480460, whose log names only this performance leaf. All selected tests, types, lint, build and security checks passed. Earlier cancelled administrative jobs have successful same-head successors. The native inherited-failure exception will retain the failure table and tested merge; failed CI is not called green.