| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 |
- {
- "version": 1,
- "caseName": "conversation-session-subagent-runtime-refresh",
- "spec": "./test/e2e/conversation-session/subagents/conversation-session-subagent-runtime-refresh.test.ts",
- "fixtures": [
- {
- "id": "shr-title",
- "description": "shr-title",
- "metadata": {
- "kind": "common",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["Generate a concise title", "E2E_SHR_FAIL_PARENT"]
- },
- "response": {
- "statusCode": 200,
- "headers": {
- "content-type": "application/json; charset=utf-8"
- },
- "body": "{\"id\":\"shr-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Subagent runtime refresh\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":32,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":12,\"service_tier\":\"standard\"}}"
- }
- },
- {
- "id": "shr-fail-parent-tool",
- "description": "shr-fail-parent-tool",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_SHR_FAIL_PARENT"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_shr_fail",
- "name": "Agent",
- "inputTokens": 32,
- "input": {
- "description": "Runtime refresh fail",
- "prompt": "E2E_SHR_FAIL_CHILD",
- "subagent_type": "e2e-runtime-reviewer",
- "run_in_background": true
- }
- }
- }
- },
- {
- "id": "shr-fail-child",
- "description": "shr-fail-child",
- "metadata": {
- "kind": "subagent",
- "source": "synthetic",
- "timingPolicy": "fault-stream",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_SHR_FAIL_CHILD"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 400,
- "delayMs": 2000,
- "headers": {
- "content-type": "application/json"
- },
- "body": "{\"type\": \"error\", \"error\": {\"type\": \"invalid_request_error\", \"message\": \"E2E_SHR_INVALID_MODEL_CONFIGURATION\"}}"
- }
- },
- {
- "id": "shr-fail-parent-final",
- "description": "shr-fail-parent-final",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_SHR_FAIL_PARENT", "agentId: agent_"],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "E2E_SHR_RESUME_PARENT"
- ]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-fail-parent-final",
- "inputTokens": 32,
- "text": "E2E_SHR_FAIL_PARENT_DONE"
- }
- }
- },
- {
- "id": "shr-stable-parent-tool",
- "description": "shr-stable-parent-tool",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "controlled-stream",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_SHR_STABLE_PARENT"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_shr_stable",
- "name": "Agent",
- "inputTokens": 32,
- "input": {
- "description": "Runtime refresh stable",
- "prompt": "E2E_SHR_STABLE_CHILD",
- "subagent_type": "e2e-runtime-reviewer",
- "run_in_background": false
- }
- },
- "delayMs": 40000
- }
- },
- {
- "id": "shr-stable-child",
- "description": "shr-stable-child",
- "metadata": {
- "kind": "subagent",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_SHR_STABLE_CHILD"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-stable-child",
- "inputTokens": 32,
- "text": "E2E_SHR_STABLE_CHILD_DONE"
- }
- }
- },
- {
- "id": "shr-stable-parent-final",
- "description": "shr-stable-parent-final",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["toolu_shr_stable", "E2E_SHR_STABLE_CHILD_DONE", "agentId: agent_"],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "E2E_SHR_NEXT_PARENT"
- ]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-stable-parent-final",
- "inputTokens": 32,
- "text": "E2E_SHR_STABLE_PARENT_DONE"
- }
- }
- },
- {
- "id": "shr-next-parent-tool",
- "description": "shr-next-parent-tool",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_SHR_NEXT_PARENT"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_shr_next",
- "name": "Agent",
- "inputTokens": 32,
- "input": {
- "description": "Runtime refresh next",
- "prompt": "E2E_SHR_NEXT_CHILD",
- "subagent_type": "e2e-runtime-reviewer",
- "run_in_background": false
- }
- }
- }
- },
- {
- "id": "shr-next-child",
- "description": "shr-next-child",
- "metadata": {
- "kind": "subagent",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_SHR_NEXT_CHILD"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-next-child",
- "inputTokens": 32,
- "text": "E2E_SHR_NEXT_CHILD_DONE"
- }
- }
- },
- {
- "id": "shr-next-parent-final",
- "description": "shr-next-parent-final",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["toolu_shr_next", "E2E_SHR_NEXT_CHILD_DONE", "agentId: agent_"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-next-parent-final",
- "inputTokens": 32,
- "text": "E2E_SHR_NEXT_PARENT_DONE"
- }
- }
- },
- {
- "id": "shr-failure-notification",
- "description": "shr-failure-notification",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["<task-notification>", "<status>failed</status>"],
- "bodyIncludes": ["E2E_SHR_FAIL_PARENT"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-failure-notification",
- "inputTokens": 32,
- "text": "E2E_SHR_FAILURE_NOTED"
- }
- }
- },
- {
- "id": "shr-resume-parent-tool",
- "description": "shr-resume-parent-tool",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_SHR_RESUME_PARENT"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_shr_resume",
- "name": "SendMessage",
- "inputTokens": 32,
- "input": {
- "to": "{{latestAgentId}}",
- "summary": "Retry corrected profile",
- "message": "E2E_SHR_RESUME_CHILD"
- }
- }
- }
- },
- {
- "id": "shr-resume-child",
- "description": "shr-resume-child",
- "metadata": {
- "kind": "subagent",
- "source": "synthetic",
- "timingPolicy": "controlled-stream",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_SHR_RESUME_CHILD"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-resume-child",
- "inputTokens": 32,
- "text": "E2E_SHR_RESUME_CHILD_DONE"
- },
- "delayMs": 2000
- }
- },
- {
- "id": "shr-resume-parent-final",
- "description": "shr-resume-parent-final",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_SHR_RESUME_PARENT", "resumed it in the background"],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "E2E_SHR_STABLE_PARENT"
- ]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-resume-parent-final",
- "inputTokens": 32,
- "text": "E2E_SHR_RESUME_PARENT_DONE"
- }
- }
- },
- {
- "id": "shr-resume-notification",
- "description": "shr-resume-notification",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["<task-notification>", "<status>completed</status>"],
- "bodyIncludes": ["E2E_SHR_RESUME_PARENT"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-resume-notification",
- "inputTokens": 32,
- "text": "E2E_SHR_RESUME_NOTED"
- }
- }
- },
- {
- "id": "shr-compact",
- "description": "shr-compact",
- "metadata": {
- "kind": "common",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["CRITICAL: Respond with TEXT ONLY", "E2E_SHR_FAIL_PARENT"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "shr-compact",
- "inputTokens": 32,
- "text": "Preserve original failed child and recovery. agentId: {{latestAgentId}}. E2E_SHR_FAIL_PARENT E2E_SHR_RESUME_PARENT."
- }
- }
- }
- ]
- }
|