[Fix] Flaky mocked e2e subtasks test when parent resume is served the child fixture#1002
Conversation
…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
|
No new code issues found. Both prior findings are resolved in the latest update. See task
Reviewed 68bae51 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
All review findings are addressed in Review summary items
Second review round
Validation: 9/9 subtask e2e tests in mock mode, full unit suite green (6851 tests), typecheck + lint clean. |
…es, link fixture format contract - Regular parent turn-1 fixture: exclude resume turns via SUBTASK_RESULT_INJECTION instead of relying on registration order (sequenceIndex is not viable here — the fixture is shared by 4 tests) - Fast and api-hang parent-resume guards: match SUBTASK_RESULT_INJECTION instead of the child result text, which is embedded verbatim in the parent prompts and could match the parent's initial request on retry - Add unit-test assertion pinning reopenParentFromDelegation's injected tool_result format to the 'completed.\n\nResult:' contract the e2e fixtures match on - lastUserMessageContains: mirror aimock's getTextContent (text parts only) instead of JSON.stringify for non-string content - Extract SUBTASK_FAST_CHILD_RESULT constant - Replace tautological find()/assert pairs in the api-hang test - Move the no-parent-resume assertion in the cancellation test behind the async settle gates and also assert no completion_result
|
Re: the review summary above — both checklist items are addressed in |
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
9 similar comments
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
|
(Duplicate of #1002 (comment) — posted in error, please ignore.) |
Related GitHub Issue
Closes: #1001
Description
The mocked e2e test
Roo Code Subtasks > child completing on its first response returns to parentflaked 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.The fixture weaknesses in
apps/vscode-e2e/src/fixtures/subtasks.ts, all fixed here:SUBTASK_CHILDfixtures matched a bare marker that the corresponding parent prompt embeds verbatim. When the parent's tool result is serialized as arole: "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 (text content parts only, mirroring aimock'sgetTextContent) 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.new_tasktool-call id (rewritable byvalidateAndFixToolResultIds) or on the child result text (embedded verbatim in the parent prompts, so it can also match the parent's initial request on a turn-1 retry). All parent-resume fixtures now match on the injected subtask-result prefix (Subtask <id> completed.\n\nResult:\n), which can only appear after a child actually returns. The regular parent turn-1 fixture — shared by four tests, sosequenceIndexis not viable — excludes resume turns via the same injected prefix instead of relying on registration order.src/__tests__/history-resume-delegation.spec.tsverifiesreopenParentFromDelegation's injectedtool_resultcontent matches thecompleted.\n\nResult:format the fixtures depend on, so a production template change fails loudly instead of silently starving the fixtures.Also includes test-quality hardening from review: an exported
SUBTASK_FAST_CHILD_RESULTconstant, non-tautological result assertions in the api-hang test, and the no-parent-resume assertion in the cancellation test moved behind the async settle gates.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, including the new injection-format contract assertion.pnpm --filter @roo-code/vscode-e2e check-typesandlint— clean.Pre-Submission Checklist
Screenshots / Videos
N/A — test-infrastructure-only change, no UI surface.
Documentation Updates
Additional Notes
Test-fixture-only change (plus one unit-test assertion); no product behavior is affected.
Get in Touch
edelauna