Skip to content

test: reuse AgentTask and instruction Session fixtures - #1240

Merged
yyjeqhc merged 2 commits into
mainfrom
refactor/reuse-agent-task-and-session-test-fixtures
Oct 21, 2026
Merged

yyjeqhc merged 2 commits into
mainfrom
refactor/reuse-agent-task-and-session-test-fixtures

Conversation

@yyjeqhc

@yyjeqhc yyjeqhc commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Why

AgentTask tests repeatedly prepared the same CodingAgent binding/dispatch and wake-capable Endpoint. Four Session instruction tests also repeated Runner registration and StartSession setup. These copies obscured the scenario-specific fences and assertions.

Changes

  • Share 13 adjacent prepare-binding/claim-dispatch sequences within the AgentTask test module. Principal, task, assignee, attempt, intent and time remain explicit at each call site.
  • Share 13 successful wake-capable Endpoint setup sequences. Keep Host, attachment, operation key and Agent identity explicit; retain the different non-wake ownership case.
  • Share four instruction Session startup fixtures, while each test still drives its own Runner requests and assertions.
  • Reuse the existing pure Runner registration constructor in the generation-fence test and retain its explicit capability/policy overrides.

Production behavior is unchanged. All 52 AgentTask tests and 7 Session instruction tests remain. Static token comparison also confirms that all 403 + 62 assertion invocations are unchanged.

Reduction

Independent of #1239; both branches start at 7b35aafb0603fb445f9d3f86ab05b2dcf977a1db. This PR changes two Rust test files, the Windows CI scheduling, and its coverage guard.

Scope Added physical lines Deleted physical lines Net reduction
Production 0 0 0
Tests and test support 207 435 228
CI configuration 7 1 -6 (increase)
Total 214 436 222

MSI's installed Rust cloc 0.6.2 reports 5,685 → 5,439 code lines in these two files: 246 fewer code lines. Physical diff counts include blank lines and comments.

Follow-up: Windows CI failure after the previous merge

The main run at the shared base failed in runner_windows_local_persistent_shell_preserves_state_and_existing_protocol: opening returned shell_reset_required before the first protocol assertion. See the failed Windows Runner job.

The failure interval is consistent with the fixed 30-second initialization deadline while the second harness thread runs Plugin child-process fixtures. The original diagnostic combines timeout and lost-control outcomes, so the log alone does not prove which occurred. The unchanged test passes in isolation on MSI in 2.04 seconds.

Run that existing regression in a separate exact-filtered CI step, and exclude only that case from the general Runner/LSP/Computer step. Both use the original runner-real-process-tests feature. A CI policy test checks that the excluded case matches the isolated case and still names a non-ignored Rust test. Production deadlines, synchronization, failure handling, and protocol assertions remain unchanged.

Validation

Validated on Windows MSI in the existing checkout and target cache:

  • cargo test --locked -p webcodex-store --lib agent_task_tests:: -- --nocapture: 52 passed.

  • cargo test --locked -p webcodex --lib tool_runtime::tests::sessions_instructions:: -- --nocapture: 7 passed.

  • cargo fmt --all -- --check and git diff --cached --check: passed.

  • Independent review of helper ownership, generation fences and operation ordering found no blocking issues. Static comparison retained all 59 test names and all 465 assertion invocations.

  • The workflow's adjusted broad Windows Runner/LSP/Computer command: 1,171 passed, 72 existing ignored; the single excluded protocol case runs in the next step.

  • The workflow's isolated persistent-shell command, with runner-real-process-tests: 1 passed in 1.22 seconds.

  • Python 3.12 CI ownership and release-readiness suites: 28 passed.

  • GitHub's Windows Runner job on e7c4b5a1 passed both steps: 1,171 + 1 tests passed. The isolated protocol case finished in 4.08 seconds on the hosted Windows runner.

The full workspace and macOS suites were not run locally. The initial attempt to run the policy suites with MSI's default Python 3.9 could not import an existing release helper that uses Python 3.12 syntax; the final 28-test run used MSI's installed Python 3.12 and passed.

@yyjeqhc
yyjeqhc merged commit bc63e43 into main Oct 21, 2026
16 checks passed
@yyjeqhc
yyjeqhc deleted the refactor/reuse-agent-task-and-session-test-fixtures branch October 21, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant