{ "version": 1, "caseName": "conversation-session-compact-interrupted", "spec": "./test/e2e/conversation-session/context/conversation-session-compact-interrupted.test.ts", "fixtures": [ { "id": "conversation-session-compact-interrupted-title-sidecar", "description": "本例标题旁路响应。", "metadata": { "kind": "common", "source": "synthetic", "timingPolicy": "fast-text", "syntheticReason": "运行时证据显示标题旁路缺少响应;在本例显式登记固定标题,避免依赖 legacy fixture 或触发后台网络重试。" }, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["Generate a concise title"] }, "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\"}}" } }, { "id": "upstream-compact-interrupted-prep-one-final", "description": "F02 interrupted compact 第一轮普通前置消息固定回复。", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "第一轮只需要形成 completed 历史,真实文案不影响 compact 语义。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_COMPACT_INTERRUPTED_PREP_ONE"], "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"], "lastUserMessageIncludes": ["E2E_COMPACT_INTERRUPTED_PREP_ONE"] }, "response": { "statusCode": 200, "text": { "id": "upstream-e2e-compact-interrupted-prep-one-final", "inputTokens": 128, "outputTokens": 12, "text": "upstream-e2e-ok" } } }, { "id": "upstream-compact-interrupted-readonly-tool-call", "description": "F02 interrupted compact 第二轮返回 Read tool_use,形成真实 tool_result 历史。", "metadata": { "kind": "common", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "只读 Read tool_use 覆盖 interrupted compact 前含工具历史的投影。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": [ "Read {{e2eRuntimeRoot}}/shared/readonly-tool.txt", "E2E_COMPACT_INTERRUPTED_PREP_TWO" ], "bodyExcludes": ["Generate a concise title"] }, "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\":\"upstream-e2e-conversation-readonly-tool-call\",\"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_e2e_conversation_readonly_read\",\"name\":\"Read\",\"input\":{}}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"file_path\\\":\\\"{{e2eRuntimeRoot}}/shared/readonly-tool.txt\\\"}\"}}\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\":16,\"service_tier\":\"standard\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" } }, { "id": "upstream-compact-interrupted-readonly-final", "description": "F02 interrupted compact 第二轮 Read tool_result 后固定回复。", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "第二轮只需要形成 completed tool history,真实文案不影响 compact 语义。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_COMPACT_INTERRUPTED_PREP_TWO", "E2E_READONLY_TOOL_FILE_CONTENT"], "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"] }, "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\":\"upstream-e2e-conversation-readonly-compact-interrupted-final\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":190,\"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\":\"text\",\"text\":\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"upstream-e2e-ok\"}}\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":190,\"output_tokens\":12,\"service_tier\":\"standard\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" } }, { "id": "upstream-compact-interrupted-running-slow", "description": "F02 stop 前的慢流响应,稳定制造 completed interrupted。", "metadata": { "kind": "main", "timingPolicy": "controlled-stream", "source": "synthetic", "syntheticReason": "需要 stop 当前 running 轮得到 interrupted 状态,真实模型可能过快完成。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_SLOW_STREAM", "E2E_COMPACT_INTERRUPTED_RUNNING"], "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"], "lastUserMessageIncludes": ["E2E_COMPACT_INTERRUPTED_RUNNING"] }, "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\":\"upstream-e2e-compact-interrupted-running-slow\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":120,\"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\":\"text\",\"text\":\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"deep\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"seek\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"-e2e-ok\"}}\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":120,\"output_tokens\":12,\"service_tier\":\"standard\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n", "events": [ { "sequence": 0, "offsetMs": 0, "byteLength": 333, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-compact-interrupted-running-slow\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":120,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" }, { "sequence": 1, "offsetMs": 250, "byteLength": 120, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" }, { "sequence": 2, "offsetMs": 8000, "byteLength": 118, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"deep\"}}\n\n" }, { "sequence": 3, "offsetMs": 16000, "byteLength": 118, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"seek\"}}\n\n" }, { "sequence": 4, "offsetMs": 24000, "byteLength": 122, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"-e2e-ok\"}}\n\n" }, { "sequence": 5, "offsetMs": 90000, "byteLength": 49, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" }, { "sequence": 6, "offsetMs": 90100, "byteLength": 179, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":120,\"output_tokens\":12,\"service_tier\":\"standard\"}}\n\n" }, { "sequence": 7, "offsetMs": 90200, "byteLength": 42, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" } ] } }, { "id": "upstream-compact-interrupted-manual-compact-success", "description": "F02 interrupted 后手动 /compact 的 summary 成功响应。", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "手动 compact 的核心断言是允许在 interrupted 且 queue=0 时执行并完成 marker。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": [ "CRITICAL: Respond with TEXT ONLY", "E2E_COMPACT_INTERRUPTED_PREP_ONE", "E2E_COMPACT_INTERRUPTED_PREP_TWO", "\"stream\":true" ], "bodyExcludes": ["Generate a concise title"] }, "response": { "statusCode": 200, "statusMessage": "OK", "delayMs": 650, "text": { "id": "upstream-e2e-compact-success", "inputTokens": 256, "outputTokens": 64, "text": "Manual compact e2e replay summarized the existing main session without tools.\n\nConversation so far: the user asked the assistant to reply with exactly upstream-e2e-ok for the initial verification turn. The assistant replied with upstream-e2e-ok. No files or tools were required." } } }, { "id": "upstream-compact-interrupted-slow-marker-contract", "description": "F02 通用 slow stream marker 合同占位,实际由 running fixture 覆盖。", "metadata": { "kind": "main", "timingPolicy": "controlled-stream", "source": "synthetic", "syntheticReason": "用于让 fixture check 明确覆盖 spec 中的通用 E2E_SLOW_STREAM marker。" }, "maxMatches": 0, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["E2E_SLOW_STREAM"], "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"], "lastUserMessageIncludes": ["E2E_SLOW_STREAM"] }, "response": { "statusCode": 200, "text": { "id": "upstream-e2e-compact-interrupted-slow-marker-contract", "inputTokens": 128, "outputTokens": 12, "text": "upstream-e2e-ok" } } } ] }