Repository navigation
refactor: deduplicate agent runner test fixtures - #118176
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 4:20 PM ET / 20:20 UTC. ClawSweeper reviewWhat this changesThis PR replaces repeated agent-runner test parameter objects in three execution suites with local helpers that start from the shared minimal fixture and apply typed overrides. Merge readinessKeep this maintainer-labelled test-only refactor open for the normal exact-head merge gate: current main does not contain the branch, and source review found no discrete correctness defect in the local fixture consolidation. Priority: P3 Review scores
Verification
How this fits togetherThe agent runner receives a prepared turn request from reply handling, executes an embedded agent, and returns lifecycle events, replies, or normalized failure outcomes. These tests mock that execution boundary and assert its reply, progress, compaction, and provider-failure behavior. flowchart LR
A[Reply request] --> B[Agent turn parameters]
B --> C[Agent runner]
C --> D[Embedded agent events]
D --> E[Reply and progress handling]
E --> F[Test assertions]
G[Shared minimal test fixture] --> B
Decision needed
Why: The patch does not alter production execution, but repository policy requires direct inspection of cited Codex contracts before a Codex merge verdict, and that sibling checkout was unavailable in this read-only environment. Before merge
Agent review detailsSecurityNone. PR surfaceTests -471. Total -471 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the helpers local to these test suites and merge after the exact-head gate completes, with the maintainer either supplying the required direct Codex-source audit or explicitly confirming that it is out of scope for this fixture-only change. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors test setup rather than fixing a reported user-facing failure. The supplied focused Testbox result is the relevant execution proof for the affected test behavior. Is this the best way to solve the issue? Yes: composing the existing canonical fixture with typed, per-test overrides is the narrowest maintainable solution, and it avoids creating a production abstraction or compatibility path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against aae0342f7c53. 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
|
|
Merged via squash.
|
* origin/main: feat(gateway): track event-loop degradation persistence and add concurrency benchmark (#118193) fix(config): preserve secret ownership when configuration rows move (#118149) fix(cron): deliver failure alerts after persistence (#118200) chore(lint): clear 172 lint:all baseline violations in five batches (#118098) perf(gateway): remove streaming hot-path rescans (#118192) test(gateway): use in-memory task registry (#118191) test(macos): fix three races in the bounded process suites (#118196) refactor(migrate-hermes): consolidate test fixtures (#118182) test(android): share Wear transport fixtures (#118177) test(ui): deduplicate control UI e2e setup (#118180) fix(plugins): unblock prerelease validation (#118103) test(cli): reduce redundant process launches (#118141) test(gateway): compact terminal observer fixtures (#118179) fix(agents): make requested threads sidebar-visible (#118073) test(plugins): canonicalize native resolver fixtures (#118174) test: deduplicate agent runner fixtures (#118176) refactor(policy): consolidate doctor test fixtures (#118173) fix(plugins): remove disabled channel plugin configuration on uninstall (#118127) refactor(matrix): consolidate monitor test fixtures (#118175)
* origin/main: feat(gateway): track event-loop degradation persistence and add concurrency benchmark (openclaw#118193) fix(config): preserve secret ownership when configuration rows move (openclaw#118149) fix(cron): deliver failure alerts after persistence (openclaw#118200) chore(lint): clear 172 lint:all baseline violations in five batches (openclaw#118098) perf(gateway): remove streaming hot-path rescans (openclaw#118192) test(gateway): use in-memory task registry (openclaw#118191) test(macos): fix three races in the bounded process suites (openclaw#118196) refactor(migrate-hermes): consolidate test fixtures (openclaw#118182) test(android): share Wear transport fixtures (openclaw#118177) test(ui): deduplicate control UI e2e setup (openclaw#118180) fix(plugins): unblock prerelease validation (openclaw#118103) test(cli): reduce redundant process launches (openclaw#118141) test(gateway): compact terminal observer fixtures (openclaw#118179) fix(agents): make requested threads sidebar-visible (openclaw#118073) test(plugins): canonicalize native resolver fixtures (openclaw#118174) test: deduplicate agent runner fixtures (openclaw#118176) refactor(policy): consolidate doctor test fixtures (openclaw#118173) fix(plugins): remove disabled channel plugin configuration on uninstall (openclaw#118127) refactor(matrix): consolidate monitor test fixtures (openclaw#118175)
What Problem This Solves
Agent-runner execution tests repeatedly reconstructed the same large turn-parameter fixture. That duplication made routine contract updates noisy and made semantically identical cases easier to drift apart.
Why This Change Was Made
Each affected suite now composes the canonical fresh minimal turn fixture with a typed
Partial<AgentTurnParams>override. The consolidation stays local to tests, preserves explicit command bodies and fake-timer-sensitive execution ordering, and adds no production abstraction or compatibility path.Architectural owner: the production agent-runner execution, event, and error handlers remain unchanged. This change only removes duplicate test setup around those owners.
User Impact
No user-visible behavior changes. Maintainers get smaller, more consistent agent-runner tests with 471 fewer lines.
Evidence
+225/-696, net-471; production/config/schema delta0.src/agents/cli-runner.context-engine.test.tspassed 14/14 on rerun. The exhaustive run also ended with a late Vitest worker exit after hundreds of green files; no changed-path failure was observed.check:changed: core-test typecheck, formatting, lint, dead-code scan, dependency/boundary checks, and ratchets passed.2026-08-02T20:09:04.804Z.Direct dependency contracts checked in sibling Codex source include response SSE terminal/error mapping, provider diagnostics, context-compaction lifecycle items, compact request handling, and session/abort behavior (
codex-rs/codex-api/src/sse/responses.rs,codex-rs/protocol/src/error.rs,codex-rs/app-server-protocol/src/protocol/v2/item.rs,codex-rs/app-server/src/request_processors/thread_processor.rs,codex-rs/core/src/compact.rs).