Repository navigation
refactor(tests): share worker probes in agent tests - #167541
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 maintainer review before merge. What this changesThis PR shares database-worker interception helpers across agent regression tests while preserving their scenarios and assertions. Review scores
ProductKind: Test only · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR remains useful, distinct test maintenance. The integration concern is resolved, current-head CI passed, and no actionable patch defects remain. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAgent regression tests exercise background database workers while injecting cancellation, ownership changes, and delayed acknowledgments. The shared probe forwards operations through the existing workers and leaves scenario decisions with each test. flowchart TD
A[Agent regression scenario] --> B[Shared test probe]
B --> C[Admission interception]
B --> D[Command interception]
C --> E[Existing database worker]
D --> E
E --> F[Results and regression assertions]
Technical reviewBest possible solution: Share only interception mechanics, keeping domain-specific fault injection, assertions, and cleanup with their existing test owners. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR consolidates existing test wiring rather than repairing a reported product defect. Is this the best way to solve the issue? Yes: the narrow shared adapter removes repeated forwarding code while preserving existing callbacks, worker boundaries, and cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4fe38b91ec98. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceTests -148. Total -148 across 37 files. Added test files: 2. View PR surface stats
LabelsLabel changes: No label 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 HistoryReview history (6 earlier review cycles)
Reviewed October 9, 2026, 1:13 AM ET / 05:13 UTC (Revision 7). |
Preserve main's worktree interception helpers and auth bootstrap scenarios while routing the bootstrap forwarding through the shared probe. Production remains unchanged against main. Focused integration proof: 26 tests; five selected test typecheck lanes; formatting; clean P2 review. Madge reports an inherited model-catalog cycle in unchanged production files.
Merge current main and keep its incognito actor probe separate from the shared worker admission probe. Preserve both helpers and all assertions. Focused proof: 21 incognito tests, selected session test types, formatting, zero Madge cycles, and clean P2 review.
|
Merged via squash.
|
What Problem This Solves
Agent worker-boundary regressions repeat the same admission and command spy wiring in 35 files, making their domain scenarios harder to read.
User Impact
No user-visible change. Authority, freshness, FIFO, settlement, durability, and SDK contracts are unchanged.
Why This Change Was Made
A small infrastructure test probe now installs the existing synchronous admission and command forwarding adapters. The 47 migrated intercepts preserve their domain behavior, awaits, assertions, test names, and cleanup. Two mocked-module cases pass their explicitly imported native originals; nonmatching settlement adapters stay local.
Deslop
Collapsed 27 admission wrappers and 20 command wrappers. Main already consolidated three incognito revocation adapters into one owner; this PR preserves that consolidation and migrates that owner once. Removed the unused original-function aliases.
The shared helper and its contract proof are included in these totals. No domain assertion or regression was deleted.
The command-probe contract test is intentionally retained: it independently protects direct Promise identity, AsyncLocalStorage continuity, the original scope receiver, explicit-original selection, and operation-level one-shot cardinality. The migrated T1.1 callers use persistent spies, so their domain cases do not cover the one-shot contract required by the later selected callers.
Integration
Initial main integration at
ae64a98a4eb1preserves the landed consolidation in #167554. The two worktree files now match that main commit exactly. The auth bootstrap scenarios keep the landedinterceptBootstraphelper, which delegates its forwarding through the shared probe. This is test-only conflict resolution; production behavior, SQL, and assertions are unchanged.A second integration at
ec7c8bb9454baddresses the overlap with #167533: main's incognito actor helper keepsprobe, while the shared worker import and its two admission calls useworkerProbe. Both helpers and all assertions remain intact. This resolves ClawSweeper's integration prerequisite.Released Plugin SDK check: no SDK exports,
api.runtimecontracts, documented subpaths, or production signatures change. The new probe is internal test support. SQL is neutral by construction because the production diff is empty; no SQL measurement was repeated at landing.Evidence
192b501ff17d8e6d86edbf4b2b93935d2cab60c9. No inherited-failure override is needed for this head. The earlier timer-count failure did not recur; no timer fix is claimed from that passing replay.--maxWorkers=1(461.86 s wrapper, 208.01 s Vitest); the selectedagents-sessionstypecheck passed in 25.1 s; formatting passed; Madge reported zero cycles; fresh isolated P2 autoreview was scoped-clean.check-guards-architecturereports the same model-catalog cycle;checks-node-changed-4reportssubagent-registry-lifecycle.test.ts→keeps a required final scheduled after detached cleanup failures (expired during failure recovery), expected one fake timer but saw two atsubagent-registry-lifecycle-cleanup.test-support.ts:559. The failing file, cleanup/controller fixtures, and production timer owners are unchanged. The failing retry cases register before the changed terminal-state cases, and the new probe module imports only Vitest at runtime and creates no timers. The precise extra-timer owner is not claimed. All other CI jobs completed without additional failures or cancellations, andsecurity-fastpassed. These failed conclusions are retained as historical evidence; the latest main integration and CI are reported separately.shared-store-bootstrap.async.test.ts,registry-read.test.ts, andrun-end.worker.test.tswith--maxWorkers=1. Wrapper wall time was 1,041.59 s, including cold compiled-worker preparation; Vitest projects took 329.02 s and 329.51 s. This is loaded-host proof, not a speedup claim.agents-root,agents-other,agents-tools,state-logging, andagents-sessions(127.5 s total reported shard time). Formatting passed for the three resolved files. Fresh isolated P2 autoreview is scoped-clean with no actionable findings.src/agents/prepared-model-catalog-fingerprints.ts↔src/agents/prepared-model-catalog-worker.ts. Both files are byte-identical to integrated mainae64a98a4eb1; the PR changes no production files or graph configuration. The recent main CI run 37876418821 also has a failed architecture job, but its log download failed, so that run is not claimed as same-cycle proof.Inherited Knip findings
Production scanning reports all four; full-tree scanning reports the last two. The script export scan passes.
Focused CI file-runner wall seconds
These are file-runner wall times including setup, not a before/after speedup claim.