Skip to content

Commit cd1ae7a

Browse files
author
Zoo (VP)
committed
fix(e2e-mock): replace sequenceIndex with predicate match for abandon parent fixture
The abandon-subtask parent fixture used userMessage + sequenceIndex: 0 for matching. sequenceIndex shares a global counter (DEFAULT_TEST_ID) across all e2e tests, making it fragile against stream interleaving from prior tests' delayed mock responses. When the counter was stale or a delayed stream from the previous test interleaved, the wrong fixture (interrupt parent completion) could match, returning attempt_completion with new_task-style arguments, causing a tool-call parse failure and 30s timeout. Replace with a predicate match using lastUserMessageContains + SUBTASK_RESULT_INJECTION exclusion, mirroring the pattern used by the regular and fast parent fixtures. This eliminates the sequenceIndex dependency and ensures the fixture only matches the parent's initial request, not resume turns.
1 parent 9218429 commit cd1ae7a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎apps/vscode-e2e/src/fixtures/subtasks.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,17 @@ export function addSubtaskFixtures(mock: InstanceType<typeof LLMock>) {
565565
})
566566

567567
// Abandon-subtask scenario (#559)
568+
// Use a predicate (lastUserMessageContains + SUBTASK_RESULT_INJECTION exclusion) instead of
569+
// userMessage + sequenceIndex. sequenceIndex shares a global counter across all tests
570+
// (DEFAULT_TEST_ID), making it fragile if a prior test's delayed stream interleaves with
571+
// this fixture's match. The predicate approach mirrors the regular parent fixtures and
572+
// ensures the initial new_task call is served only on the parent's first turn, not on a
573+
// resume turn (which carries SUBTASK_RESULT_INJECTION from the delegated child result).
568574
mock.addFixture({
569575
match: {
570-
userMessage: new RegExp(SUBTASK_ABANDON_PARENT_MARKER),
571-
sequenceIndex: 0,
576+
predicate: (req: ChatCompletionRequest) =>
577+
lastUserMessageContains(req, SUBTASK_ABANDON_PARENT_MARKER) &&
578+
!requestContains(req, [SUBTASK_RESULT_INJECTION]),
572579
},
573580
response: {
574581
toolCalls: [

0 commit comments

Comments
 (0)