{ "version": 1, "caseName": "conversation-session-v4-background-work", "spec": "./test/e2e/conversation-session/background/conversation-session-v4-background-work.test.ts", "fixtures": [ { "id": "v4-background-work-title", "description": "E2E_V4_BGWORK 首发的 case-local 标题生成响应。", "metadata": { "kind": "common", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "E2E_V4_BGWORK 首发会触发默认 title sidecar;固定 case-local 标题响应,避免 default replay 回退 legacy provider-basic,并用该首发 marker 隔离跨 case 匹配。" }, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["Generate a concise title", "E2E_V4_BGWORK"] }, "response": { "statusCode": 200, "text": { "id": "v4-background-work-title", "inputTokens": 64, "outputTokens": 8, "text": "{\"title\":\"V4 Background Work E2E\"}" } } }, { "id": "v4-bgwork-toolcall", "description": "M4 cancelBackgroundWork 门禁:首轮返回 run_in_background 的 Bash tool_use(长 sleep),形成可取消的后台工作。", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "需要稳定产出一个 run_in_background 的后台 bash 任务以断言后台工作面板 + 取消。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "lastUserMessageIncludes": ["E2E_V4_BGWORK"], "bodyExcludes": [ "Generate a concise title", "CRITICAL: Respond with TEXT ONLY", "Command running in background" ] }, "response": { "statusCode": 200, "statusMessage": "OK", "headers": { "cache-control": "no-cache", "content-type": "text/event-stream; charset=utf-8" }, "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"v4-bgwork-toolcall\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":96,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_v4_bgwork\",\"name\":\"Bash\",\"input\":{}}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"command\\\":\\\"sleep 300\\\",\\\"run_in_background\\\":true,\\\"description\\\":\\\"E2E_V4_BGWORK sleep\\\"}\"}}\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":96,\"output_tokens\":24,\"service_tier\":\"standard\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" } }, { "id": "v4-bgwork-final", "description": "M4 后台任务 backgrounded 后的 tool_result 跟进回复(固定文本)。", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "后台任务已分离,主轮只需固定收尾文本;核心断言在后台工作面板 + 取消。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_V4_BGWORK", "Command running in background"], "bodyExcludes": [ "Generate a concise title", "CRITICAL: Respond with TEXT ONLY", "SYSTEM NOTIFICATION" ] }, "response": { "statusCode": 200, "text": { "id": "v4-bgwork-final", "inputTokens": 120, "outputTokens": 6, "text": "V4_BGWORK_STARTED_OK" } } }, { "id": "v4-bgwork-cancel-notification", "description": "取消后台 Bash 后 CLI 自动投递的 background-task 完成通知请求;固定响应,避免 strict 回放把正常通知记为 gap。", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "取消是 case 的最后一个动作;通知请求不属于产品断言,只需稳定收口,不能回真实 provider。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": [ "E2E_V4_BGWORK", "", "toolu_v4_bgwork", "killed" ], "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"] }, "response": { "statusCode": 200, "text": { "id": "v4-bgwork-cancel-notification", "inputTokens": 120, "outputTokens": 6, "text": "V4_BGWORK_CANCEL_NOTED" } } } ] }