Skip to content

refactor: deduplicate agent runner test fixtures - #118176

Merged
steipete merged 1 commit into
mainfrom
codex/goal100k-autoreply-runner-fixture-wave19-2d45
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/goal100k-autoreply-runner-fixture-wave19-2d45

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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

  • Exact diff: +225/-696, net -471; production/config/schema delta 0.
  • Parity: all 58 declarations, 98 expanded runtime cases, and 187 ordered assertion sites preserved.
  • Focused proof, local and Blacksmith Testbox: 3 files, 98/98 tests passed.
  • A failure observed only during the long exhaustive agents run was isolated: src/agents/cli-runner.context-engine.test.ts passed 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.
  • Final Blacksmith check:changed: core-test typecheck, formatting, lint, dead-code scan, dependency/boundary checks, and ratchets passed.
  • Broader adjacent proof completed before the final type-only annotation correction: full auto-reply 176 files / 3,963 tests, combined unit-fast 400 files / 5,028 tests, security 35 files / 238 tests, and focused config/plugin/isolated shards all passed.
  • Two independent xhigh reviews: CLEAN after the final typing correction and direct Codex contract inspection.
  • Latest-main synthetic merge: clean. Central open-PR collision census: zero exact-path matches through 2026-08-02T20:09:04.804Z.
  • Testbox run: https://github.com/openclaw/openclaw/actions/runs/30763538394

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).

@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Aug 2, 2026
@steipete steipete self-assigned this Aug 2, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 4:20 PM ET / 20:20 UTC.

ClawSweeper review

What this changes

This 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 readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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
Reviewed head: 67d30e876a0cec95aa59977b1c9a231bce2629fb
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, production-neutral test refactor with supplied execution proof and no discrete source-level defect found.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The PR supplies a linked Blacksmith Testbox run and focused after-change terminal results for the only changed behavior: the refactored agent-runner test fixtures.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR supplies a linked Blacksmith Testbox run and focused after-change terminal results for the only changed behavior: the refactored agent-runner test fixtures.
Evidence reviewed 6 items Shared fixture preserves the prior default contract: The common fixture supplies every formerly repeated required value, including a fresh follow-up run, mock typing signaler, task set, and execution defaults; the PR helper spreads this fixture before applying explicit test overrides.
Branch helper follows the typed execution boundary: Each changed suite defines a local helper accepting the shared fixture's override shape and Partial<AgentTurnParams>, then invokes executeAgentTurn with the merged object.
Runtime input contract: AgentTurnParams declares the required runner inputs, while the shared fixture provides the recurring defaults and the PR leaves bespoke asynchronous and fake-timer call paths direct.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Decision needed

Question Recommendation
Should this maintainer-labelled fixture-only refactor proceed once its exact-head gate is green, or should the cited Codex-source audit be re-run with the sibling source checkout available? Merge after exact-head verification: Treat the patch as a local test-fixture cleanup and merge after required checks finish successfully; no production or dependency behavior changes in the diff.

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

  • Resolve merge risk (P1) - The exact-head openclaw/ci-gate was still in progress in the provided check state, so this review cannot treat all required checks as complete.
  • Resolve merge risk (P1) - The PR body cites Codex runtime contracts, but the required sibling ../codex source tree is absent and network access failed; those dependency claims were not independently verified in this read-only review, although the diff changes no runtime or Codex integration code.
Agent review details

Security

None.

PR surface

Tests -471. Total -471 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 225 696 -471
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 225 696 -471

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is a test-only maintenance cleanup with no reported user-visible or production-runtime behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies a linked Blacksmith Testbox run and focused after-change terminal results for the only changed behavior: the refactored agent-runner test fixtures.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR supplies a linked Blacksmith Testbox run and focused after-change terminal results for the only changed behavior: the refactored agent-runner test fixtures.

Label justifications:

  • P3: This is a test-only maintenance cleanup with no reported user-visible or production-runtime behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR supplies a linked Blacksmith Testbox run and focused after-change terminal results for the only changed behavior: the refactored agent-runner test fixtures.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies a linked Blacksmith Testbox run and focused after-change terminal results for the only changed behavior: the refactored agent-runner test fixtures.

Evidence

What I checked:

  • Shared fixture preserves the prior default contract: The common fixture supplies every formerly repeated required value, including a fresh follow-up run, mock typing signaler, task set, and execution defaults; the PR helper spreads this fixture before applying explicit test overrides. (src/auto-reply/reply/agent-runner-execution.test-support.ts:562, 87ea745b54fa)
  • Branch helper follows the typed execution boundary: Each changed suite defines a local helper accepting the shared fixture's override shape and Partial, then invokes executeAgentTurn with the merged object. (src/auto-reply/reply/agent-runner-execution-progress.test.ts:22, 67d30e876a0c)
  • Runtime input contract: AgentTurnParams declares the required runner inputs, while the shared fixture provides the recurring defaults and the PR leaves bespoke asynchronous and fake-timer call paths direct. (src/auto-reply/reply/agent-runner-execution.types.ts:75, 3a2337ece4f9)
  • Current main does not already include this work: The PR head is not an ancestor of the supplied current-main SHA; no close-as-implemented or superseded outcome is supported. (aae0342f7c53)
  • Adjacent refactor provenance: A nearby current-main fixture consolidation was authored by Peter Steinberger shortly before this branch, supporting the same local-test-helper approach without introducing production abstractions. (src/infra/heartbeat-runner.tool-response.test.ts:1, 3a2337ece4f9)
  • After-change test proof supplied: The PR body reports a Blacksmith Testbox focused run with all 98 affected tests passing, and the provided check context records successful changed-boundary, lint, type, security, and real-behavior-proof checks. (67d30e876a0c)

Likely related people:

  • Peter Steinberger: Authored the adjacent current-main fixture-consolidation commit and the submitted branch, and is assigned to this maintainer-labelled PR. (role: recent adjacent test-refactor contributor; confidence: high; commits: 3a2337ece4f9, 67d30e876a0c; files: src/auto-reply/reply/agent-runner-execution-compaction.test.ts, src/auto-reply/reply/agent-runner-execution-progress.test.ts, src/auto-reply/reply/agent-runner-execution-provider-failures.test.ts)
  • Shakker: Introduced the canonical minimal AgentTurnParams fixture that this refactor composes rather than duplicating. (role: shared fixture introducer; confidence: high; commits: 87ea745b54fa; files: src/auto-reply/reply/agent-runner-execution.test-support.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the exact-head openclaw/ci-gate finish, then resolve the direct Codex-source audit requirement before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 8729d54 into main Aug 2, 2026
104 of 112 checks passed
@steipete
steipete deleted the codex/goal100k-autoreply-runner-fixture-wave19-2d45 branch August 2, 2026 20:26
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 2, 2026
* 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)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant