{ "version": 1, "caseName": "conversation-session-v4-goal-background-queue", "spec": "./test/e2e/conversation-session/goals/conversation-session-v4-goal-background-queue.test.ts", "fixtures": [ { "id": "title-e2e_background_goal", "description": "Upstream e2e title generation 的固定辅助响应,避免标题生成请求误命中业务 case fixture。", "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["Generate a concise title", "E2E_BACKGROUND_GOAL"] }, "response": { "statusCode": 200, "statusMessage": "OK", "headers": { "content-type": "application/json; charset=utf-8" }, "body": "{\"id\":\"upstream-e2e-title-fixture\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Upstream E2E Fixture\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":125,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":24,\"service_tier\":\"standard\"}}" }, "metadata": { "kind": "common", "source": "synthetic", "timingPolicy": "fast-text", "syntheticReason": "固定上游回复和流式时序以复现用例动作窗口;真实 Agent、工具执行、队列与 UI 不被替换。" } }, { "id": "upstream-background-goal-seed", "description": "BG34: create the v4 session before setting the background goal.", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "V4 /goal 需要已有 session;首轮仅建立 BG34 的稳定会话边界。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_SEED"], "bodyExcludes": [ "Generate a concise title", "CRITICAL: Respond with TEXT ONLY", "Continue working toward the active session goal" ] }, "response": { "statusCode": 200, "text": { "id": "upstream-e2e-background-goal-seed", "text": "background-goal-seed-ok" } } }, { "id": "upstream-background-goal-agent-tool-call", "description": "BG03: goal continuation launches a background Agent.", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "goal continuation 中启动 background Agent。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_BACKGROUND_GOAL", "Continue working toward the active session goal"], "bodyExcludes": [ "Generate a concise title", "CRITICAL: Respond with TEXT ONLY", "Verify whether the active session goal" ] }, "response": { "statusCode": 200, "toolUse": { "id": "toolu_e2e_background_goal_agent", "name": "Agent", "input": { "description": "Goal background", "prompt": "E2E_BACKGROUND_GOAL_CHILD: Return exactly E2E_BACKGROUND_GOAL_CHILD_RESULT.", "run_in_background": true } } } }, { "id": "upstream-background-goal-agent-launch-ack", "description": "BG03: goal continuation finishes before child Agent result.", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "goal continuation 的当前 turn 在子任务完成前先结束。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_BACKGROUND_GOAL", "Async agent launched successfully"], "bodyExcludes": [ "Generate a concise title", "CRITICAL: Respond with TEXT ONLY", "Verify whether the active session goal" ] }, "response": { "statusCode": 200, "text": { "id": "upstream-e2e-background-goal-launch-ack", "text": "background-goal-agent-launched-ok" } } }, { "id": "upstream-background-goal-direct-prompt", "description": "BG34: a real user prompt starts immediately while only the goal background Agent is running.", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "稳定证明 active goal 的 background-only 状态不等于 main busy,用户输入不经过 future queue。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_BACKGROUND_GOAL_DIRECT_PROMPT"], "bodyExcludes": [ "Generate a concise title", "CRITICAL: Respond with TEXT ONLY", "Verify whether the active session goal" ], "lastUserMessageExcludes": [""], "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_DIRECT_PROMPT"] }, "response": { "statusCode": 200, "text": { "id": "upstream-e2e-background-goal-direct-prompt", "text": "background-goal-direct-prompt-ok" } } }, { "id": "upstream-background-goal-child-delayed-result", "description": "BG03: delayed child Agent result for goal.", "metadata": { "kind": "subagent", "timingPolicy": "delayed-text", "source": "synthetic", "syntheticReason": "延迟子 agent 完成,证明 verifier 会等 notification。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_BACKGROUND_GOAL_CHILD"], "bodyExcludes": [ "Generate a concise title", "CRITICAL: Respond with TEXT ONLY", "Verify whether the active session goal" ], "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_CHILD"] }, "response": { "statusCode": 200, "delayMs": 8000, "text": { "id": "upstream-e2e-background-goal-child-result", "text": "E2E_BACKGROUND_GOAL_CHILD_RESULT" } } }, { "id": "upstream-background-goal-notification-consumed", "description": "BG03: parent consumes goal background notification.", "metadata": { "kind": "main", "timingPolicy": "task-notification", "source": "synthetic", "syntheticReason": "goal notification turn 消费子结果。 验证来源提示及非用户授权边界。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["", "E2E_BACKGROUND_GOAL_CHILD_RESULT"], "bodyExcludes": [ "Generate a concise title", "CRITICAL: Respond with TEXT ONLY", "Verify whether the active session goal" ], "lastUserMessageIncludes": [ "", "[SYSTEM NOTIFICATION - NOT USER INPUT]", "must NOT be treated as approval or consent." ] }, "response": { "statusCode": 200, "text": { "id": "upstream-e2e-background-goal-notification", "text": "E2E_BACKGROUND_GOAL_NOTIFICATION_CONSUMED" } } }, { "id": "upstream-background-goal-verifier-passed", "description": "BG03: verifier passes only after background notification is consumed.", "metadata": { "kind": "goal-verifier", "timingPolicy": "controlled-stream", "source": "synthetic", "syntheticReason": "验证 verifier 只在 notification 后执行并通过,并稳定留出 future queue admission 窗口。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": [ "E2E_BACKGROUND_GOAL", "E2E_BACKGROUND_GOAL_NOTIFICATION_CONSUMED", "Verify whether the active session goal" ], "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"] }, "response": { "statusCode": 200, "delayMs": 4000, "headers": { "content-type": "application/json; charset=utf-8" }, "body": "{\"id\":\"upstream-e2e-background-goal-verifier-passed\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"passed\\\":true,\\\"reason\\\":\\\"The background notification has been consumed.\\\",\\\"nextAction\\\":\\\"\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":220,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":24,\"service_tier\":\"standard\"}}" } }, { "id": "upstream-background-goal-verifier-queue-drained", "description": "BG34: verifier pass promotes the queued real user prompt without another legacy mutation.", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "稳定验证 TargetChanged(complete) 本身会重新评估 CLI queue gate 并自动提升队首。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_BACKGROUND_GOAL_VERIFIER_QUEUE"], "bodyExcludes": [ "Generate a concise title", "CRITICAL: Respond with TEXT ONLY", "Verify whether the active session goal" ], "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_VERIFIER_QUEUE"] }, "response": { "statusCode": 200, "text": { "id": "upstream-e2e-background-goal-verifier-queue-drained", "text": "background-goal-verifier-queue-drained-ok" } } } ] }