Repository navigation
test(system-agent): isolate chat fixtures from provider discovery - #122360
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 9:11 PM ET / August 12, 2026, 01:11 UTC. ClawSweeper reviewWhat this changesThe PR preloads the provider-ownership mock before six system-agent chat test fixtures load, and updates a Gateway prewarm test to assert request-visible title behavior rather than internal probe timing. Merge readinessNo blocking findings. This focused, maintainer-labelled test cleanup remains useful and should proceed through normal exact-head CI review; likely related people are Peter Steinberger, Josh Lehman, and Erick Kinnee. Priority: P3 Review scores
Verification
How this fits togetherSystem-agent chat tests create verified inference fixtures that consult provider ownership before exercising router and setup flows. Gateway startup prewarms lightweight session data, while request-time session listing adds optional transcript-derived titles. flowchart LR
A[Chat test file] --> B[Preloaded fixture mock]
B --> C[Provider ownership resolver]
A --> D[Chat engine fixture]
D --> E[Router and setup tests]
F[Gateway startup prewarm] --> G[Session snapshot]
G --> H[Request-time title result]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests -10. Total -7 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the preloaded mock as the canonical test-only isolation boundary and retain the Gateway test’s request-visible title assertion; land once the exact head’s normal checks are green. Do we have a high-confidence way to reproduce the issue? Not applicable: the PR repairs test-fixture import timing rather than an end-user failure; its body supplies focused before/after test runs. Is this the best way to solve the issue? Yes. Moving the existing ownerless mock ahead of the shared fixture fixes the actual import-order boundary, while the Gateway follow-up removes an assertion contrary to the request-driven title-prewarm contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ff73a14f5ae7. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Land-ready proofExact-head CI is green for Hosted timing against the immediately preceding main baseline:
No CI workers or jobs were added. The first exact-head run also exposed a shared-order gateway test failure unrelated to the system-agent change. The assertion spied on a low-level helper after another file could already have imported it, so it failed twice in the hosted shard while passing 5/5 isolated local runs. The test now asserts observable Focused repair proof:
ClawSweeper's only rank-up move was to wait for exact-head CI; that is now complete and green. |
|
Merged via squash.
|
…enclaw#122360) * test(system-agent): isolate chat fixtures from provider discovery * test(gateway): avoid import-order prewarm assertion --------- Co-authored-by: Amp <[email protected]>
What Problem This Solves
Six chat-engine test files build verified inference fixtures, but their provider-owner mock lived inside
chat-engine.test-support.ts. By the time that helper module executed the mock declaration, its production dependency graph was already instantiated. Router tests therefore rediscovered and fingerprinted the full bundled plugin registry even though provider/plugin ownership is not their contract.CPU profiling attributed roughly 65.6 seconds of the operations file to plugin registry/index discovery, dominated by
lstatandexistsSynccalls.Why This Change Was Made
Preload the existing ownerless provider fixture mock from a dedicated test-support module before importing the chat-engine helper. The six consumers now isolate route, approval, OAuth, CLI-loop, wizard, and hosted-setup behavior from unrelated plugin inventory discovery. Provider ownership and verified-inference owner binding remain covered by their owning tests.
The old helper-local mock is removed because it did not intercept the already loaded dependency. One exact handoff test is also removed because the adjacent test proves the same action/handoff result plus the stronger invariant that no inference turn is consulted.
User Impact
No runtime behavior, production code, CI jobs, workers, or shard count changes. The affected test surface becomes substantially faster and does less filesystem work.
Evidence
All commands used Node 24.15.0 and one Vitest worker.
node_modules/.bin/oxfmt --check <8 changed files>node scripts/run-oxlint.mjs <8 changed files>git diff --checkcodexexecutable.Test/support delta: +15/-17. Production delta: +0/-0.