Skip to content

[Fix] Flaky mocked e2e subtasks test when parent resume is served the child fixture#1002

Draft
zoomote[bot] wants to merge 1 commit into
mainfrom
fix/subtask-e2e-fixture-collision-0m0vgwldtri9y
Draft

[Fix] Flaky mocked e2e subtasks test when parent resume is served the child fixture#1002
zoomote[bot] wants to merge 1 commit into
mainfrom
fix/subtask-e2e-fixture-collision-0m0vgwldtri9y

Conversation

@zoomote

@zoomote zoomote Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Elliott de Launay. Follow up by mentioning @zoomote, in the web UI, or in Discord.

Related GitHub Issue

Closes: #1001

Description

The mocked e2e test Roo Code Subtasks > child completing on its first response returns to parent flaked in CI (run 30098606515, merge queue for the unrelated PR #996; a re-run of the same SHA passed): the parent completed as "Fast child completed" instead of "Fast parent resumed" because aimock served the child fixture for the parent's resume request.

Two compounding fixture weaknesses in apps/vscode-e2e/src/fixtures/subtasks.ts, both fixed here:

  1. Child fixtures matched parent-resume turns. The fast-child and SUBTASK_CHILD fixtures matched a bare marker that the corresponding parent prompt embeds verbatim. When the parent's tool result is serialized as a role: "tool" message, the original parent prompt (marker included) becomes the last user message and the child fixture — registered earlier — wins. Both fixtures are now predicates that keep aimock's last-user-message scoping but exclude requests containing the parent marker, mirroring the [Flaky Test] e2e-mock: subtasks cross-profile fixture collision + task identity prompt timeout #561 fix for the cross-profile fixtures.
  2. Parent-resume fixtures could miss. They guarded on the literal new_task tool-call id, which validateAndFixToolResultIds can rewrite when reopenParentFromDelegation rebuilds the parent's history. The regular, fast, and interrupt parent-resume fixtures now match on the injected subtask-result content (Subtask <id> completed.\n\nResult:\n<summary> / the child result text) instead of the fragile id.

What reviewers should pay attention to: the new lastUserMessageContains helper deliberately replicates aimock's userMessage last-message scoping inside a predicate, so multi-turn child flows (ask_followup → completion) behave exactly as before.

Test Procedure

  • TEST_FILE=subtasks.test xvfb-run -a pnpm --filter @roo-code/vscode-e2e test:ci:mock — 9/9 subtask e2e tests pass, including the previously failing one.
  • pnpm test (full unit suite) — 6851 passed.
  • pnpm --filter @roo-code/vscode-e2e check-types and lint — clean.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

N/A — test-infrastructure-only change, no UI surface.

Documentation Updates

  • No documentation updates are required.

Additional Notes

Test-fixture-only change; no product behavior is affected.

Get in Touch

edelauna

…nt-resume fixtures (#1001)

The fast-child and SUBTASK_CHILD fixtures matched a bare marker that the
parent prompt embeds verbatim, so parent-resume turns could be served the
child fixture (mirrors #561, which fixed the same class for cross-profile
fixtures only). Parent-resume fixtures also guarded on the literal new_task
tool-call id, which validateAndFixToolResultIds can rewrite on resume.

- Add parent-marker exclusion (with aimock's last-user-message scoping) to
  the fast-child and SUBTASK_CHILD fixtures
- Guard parent-resume fixtures on the injected subtask result content
  instead of the fragile tool-call id
@zoomote

zoomote Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

2 issues outstanding. See task

  • apps/vscode-e2e/src/fixtures/subtasks.ts:158-160 — The regular parent turn-1 fixture (userMessage: /SUBTASK_PARENT_MARKER/) is the only parent turn-1 fixture without sequenceIndex: 0. In the role: "tool" resume serialization that caused this flake class, the last user message is the original parent prompt, so this fixture matches the parent's resume turn and re-serves new_task before the guarded child fixture (line 178) and parent-resume fixture (line 199) are ever evaluated — aimock serves the first content match in registration order. The new guards at 178/199 are therefore unreachable in exactly the path that motivated them; add sequenceIndex: 0 here for parity with the fast/interrupt/api-hang/abandon/xprofile parent fixtures.
  • apps/vscode-e2e/src/fixtures/subtasks.ts:145 — The fast parent-resume guard [SUBTASK_FAST_PARENT_MARKER, "Fast child completed"] can also match the parent's initial request, because SUBTASK_FAST_PARENT_PROMPT embeds the child prompt verbatim and the child prompt itself contains Fast child completed (same for the api-hang guard [SUBTASK_API_HANG_PARENT_MARKER, SUBTASK_API_HANG_CHILD_RESULT] at line 271, where this PR removed the tool-call-id condition). Correctness now depends on the earlier sequenceIndex: 0 fixture winning turn 1; on a retry of the parent's first call (turn-1 fixture consumed, no tool result yet) these fixtures would serve the parent-completion response prematurely. The SUBTASK_RESULT_INJECTION guard used for the regular/interrupt resumes cannot match turn 1 — consider using it here too.

Reviewed dcae4b7

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

[Flaky Test] e2e-mock: subtasks fast-child fixture shadows parent-resume fixture

1 participant