conversation-session-background.json 152 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-background",
  4. "spec": "./test/e2e/conversation-session/conversation-session-background.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "upstream-background-title",
  8. "description": "Background spec 内所有 E2E 标题生成固定响应,避免 title 请求阻塞业务 replay。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题不属于 background runtime task 语义;同一 spec 还包含 foreground 对照组,因此按通用 E2E marker 稳定返回,避免标题请求重试阻塞业务请求。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_"]
  19. },
  20. "response": {
  21. "statusCode": 200,
  22. "statusMessage": "OK",
  23. "headers": {
  24. "content-type": "application/json; charset=utf-8"
  25. },
  26. "body": "{\"id\":\"upstream-e2e-background-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Background E2E\\\"}\"}],\"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\"}}"
  27. }
  28. },
  29. {
  30. "id": "upstream-background-agent-tool-call",
  31. "description": "BG01: main agent launches a background Agent.",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-tool-use",
  35. "source": "synthetic",
  36. "syntheticReason": "稳定触发 Agent(run_in_background=true),验证 background Agent notification wake。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "bodyIncludes": [
  43. "E2E_BACKGROUND_AGENT: Launch a background agent and summarize only after its notification."
  44. ],
  45. "bodyExcludes": [
  46. "Async agent launched successfully",
  47. "agentId: agent_",
  48. "Generate a concise title",
  49. "CRITICAL: Respond with TEXT ONLY",
  50. "Verify whether the active session goal"
  51. ],
  52. "lastUserMessageIncludes": [
  53. "E2E_BACKGROUND_AGENT: Launch a background agent and summarize only after its notification."
  54. ]
  55. },
  56. "response": {
  57. "statusCode": 200,
  58. "toolUse": {
  59. "id": "toolu_e2e_background_agent",
  60. "name": "Agent",
  61. "input": {
  62. "description": "Check background",
  63. "prompt": "E2E_BACKGROUND_AGENT_CHILD: Return exactly E2E_BACKGROUND_AGENT_CHILD_RESULT.",
  64. "run_in_background": true
  65. }
  66. }
  67. }
  68. },
  69. {
  70. "id": "upstream-background-agent-launch-ack",
  71. "description": "BG01: parent finishes launch turn after async Agent result.",
  72. "metadata": {
  73. "kind": "main",
  74. "timingPolicy": "fast-text",
  75. "source": "synthetic",
  76. "syntheticReason": "父模型在 async launch tool result 后结束当前 turn。"
  77. },
  78. "maxMatches": 1,
  79. "match": {
  80. "method": "POST",
  81. "pathIncludes": "/messages",
  82. "bodyIncludes": [
  83. "E2E_BACKGROUND_AGENT: Launch a background agent and summarize only after its notification.",
  84. "Async agent launched successfully"
  85. ],
  86. "bodyExcludes": [
  87. "Generate a concise title",
  88. "CRITICAL: Respond with TEXT ONLY",
  89. "Verify whether the active session goal"
  90. ]
  91. },
  92. "response": {
  93. "statusCode": 200,
  94. "text": {
  95. "id": "upstream-e2e-background-agent-launch-ack",
  96. "text": "background-agent-launched-ok"
  97. }
  98. }
  99. },
  100. {
  101. "id": "upstream-background-agent-child-delayed-result",
  102. "description": "BG01: delayed child Agent result.",
  103. "metadata": {
  104. "kind": "subagent",
  105. "timingPolicy": "delayed-text",
  106. "source": "synthetic",
  107. "syntheticReason": "延迟子 agent 完成,稳定制造 parent idle wake。"
  108. },
  109. "maxMatches": 1,
  110. "match": {
  111. "method": "POST",
  112. "pathIncludes": "/messages",
  113. "bodyIncludes": [
  114. "E2E_BACKGROUND_AGENT_CHILD: Return exactly E2E_BACKGROUND_AGENT_CHILD_RESULT."
  115. ],
  116. "bodyExcludes": [
  117. "Async agent launched successfully",
  118. "agentId: agent_",
  119. "Generate a concise title",
  120. "CRITICAL: Respond with TEXT ONLY",
  121. "Verify whether the active session goal"
  122. ],
  123. "lastUserMessageIncludes": [
  124. "E2E_BACKGROUND_AGENT_CHILD: Return exactly E2E_BACKGROUND_AGENT_CHILD_RESULT."
  125. ]
  126. },
  127. "response": {
  128. "statusCode": 200,
  129. "delayMs": 1500,
  130. "text": {
  131. "id": "upstream-e2e-background-agent-child-result",
  132. "text": "E2E_BACKGROUND_AGENT_CHILD_RESULT"
  133. }
  134. }
  135. },
  136. {
  137. "id": "upstream-background-agent-notification-consumed",
  138. "description": "BG01: parent consumes background Agent notification.",
  139. "metadata": {
  140. "kind": "main",
  141. "timingPolicy": "task-notification",
  142. "source": "synthetic",
  143. "syntheticReason": "验证 provider-visible request 消费 <task-notification>。 验证来源提示及非用户授权边界。"
  144. },
  145. "maxMatches": 1,
  146. "match": {
  147. "method": "POST",
  148. "pathIncludes": "/messages",
  149. "bodyIncludes": [
  150. "<task-notification>",
  151. "E2E_BACKGROUND_AGENT_CHILD_RESULT"
  152. ],
  153. "bodyExcludes": [
  154. "Generate a concise title",
  155. "CRITICAL: Respond with TEXT ONLY",
  156. "Verify whether the active session goal"
  157. ],
  158. "lastUserMessageIncludes": [
  159. "<task-notification>",
  160. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  161. "must NOT be treated as approval or consent."
  162. ]
  163. },
  164. "response": {
  165. "statusCode": 200,
  166. "text": {
  167. "id": "upstream-e2e-background-agent-notification",
  168. "text": "background-agent-notification-consumed-ok"
  169. }
  170. }
  171. },
  172. {
  173. "id": "upstream-background-bash-tool-call",
  174. "description": "BG02: main agent launches a background Bash command.",
  175. "metadata": {
  176. "kind": "main",
  177. "timingPolicy": "fast-tool-use",
  178. "source": "synthetic",
  179. "syntheticReason": "稳定触发 Bash(run_in_background=true)。"
  180. },
  181. "maxMatches": 1,
  182. "match": {
  183. "method": "POST",
  184. "pathIncludes": "/messages",
  185. "bodyIncludes": ["E2E_BACKGROUND_BASH"],
  186. "bodyExcludes": [
  187. "Generate a concise title",
  188. "CRITICAL: Respond with TEXT ONLY",
  189. "Verify whether the active session goal"
  190. ],
  191. "lastUserMessageIncludes": ["E2E_BACKGROUND_BASH"]
  192. },
  193. "response": {
  194. "statusCode": 200,
  195. "toolUse": {
  196. "id": "toolu_e2e_background_bash",
  197. "name": "Bash",
  198. "input": {
  199. "command": "printf 'E2E_BACKGROUND_BASH_RESULT\\n'",
  200. "description": "Print background marker",
  201. "run_in_background": true
  202. }
  203. }
  204. }
  205. },
  206. {
  207. "id": "upstream-background-bash-launch-ack",
  208. "description": "BG02: parent finishes launch turn after backgrounded Bash result.",
  209. "metadata": {
  210. "kind": "main",
  211. "timingPolicy": "fast-text",
  212. "source": "synthetic",
  213. "syntheticReason": "父模型在 backgrounded Bash tool result 后结束当前 turn。"
  214. },
  215. "maxMatches": 1,
  216. "match": {
  217. "method": "POST",
  218. "pathIncludes": "/messages",
  219. "bodyIncludes": ["E2E_BACKGROUND_BASH", "Command running in background"],
  220. "bodyExcludes": [
  221. "Generate a concise title",
  222. "CRITICAL: Respond with TEXT ONLY",
  223. "Verify whether the active session goal"
  224. ]
  225. },
  226. "response": {
  227. "statusCode": 200,
  228. "text": {
  229. "id": "upstream-e2e-background-bash-launch-ack",
  230. "text": "background-bash-launched-ok"
  231. }
  232. }
  233. },
  234. {
  235. "id": "upstream-background-bash-notification-consumed",
  236. "description": "BG02: parent consumes background Bash notification.",
  237. "metadata": {
  238. "kind": "main",
  239. "timingPolicy": "task-notification",
  240. "source": "synthetic",
  241. "syntheticReason": "验证 Bash completion notification 进入父模型请求。 验证来源提示及非用户授权边界。"
  242. },
  243. "maxMatches": 1,
  244. "match": {
  245. "method": "POST",
  246. "pathIncludes": "/messages",
  247. "bodyIncludes": [
  248. "E2E_BACKGROUND_BASH",
  249. "<task-notification>",
  250. "<tool-use-id>toolu_e2e_background_bash</tool-use-id>",
  251. "<status>completed</status>"
  252. ],
  253. "bodyExcludes": [
  254. "Generate a concise title",
  255. "CRITICAL: Respond with TEXT ONLY",
  256. "Verify whether the active session goal"
  257. ],
  258. "lastUserMessageIncludes": [
  259. "<task-notification>",
  260. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  261. "must NOT be treated as approval or consent."
  262. ]
  263. },
  264. "response": {
  265. "statusCode": 200,
  266. "text": {
  267. "id": "upstream-e2e-background-bash-notification",
  268. "text": "background-bash-notification-consumed-ok"
  269. }
  270. }
  271. },
  272. {
  273. "id": "upstream-background-direct-user-prompt-bash-tool-call",
  274. "description": "BG15: main agent starts a long background Bash before the user sends a second prompt.",
  275. "metadata": {
  276. "kind": "main",
  277. "timingPolicy": "fast-tool-use",
  278. "source": "synthetic",
  279. "syntheticReason": "稳定制造 main idle 但 background task 仍 running 的窗口,验证后续用户普通消息不会进入 queued prompt。"
  280. },
  281. "maxMatches": 1,
  282. "match": {
  283. "method": "POST",
  284. "pathIncludes": "/messages",
  285. "bodyIncludes": ["E2E_BACKGROUND_DIRECT_USER_PROMPT_SETUP"],
  286. "bodyExcludes": [
  287. "Command running in background",
  288. "Generate a concise title",
  289. "CRITICAL: Respond with TEXT ONLY",
  290. "Verify whether the active session goal"
  291. ],
  292. "lastUserMessageIncludes": ["E2E_BACKGROUND_DIRECT_USER_PROMPT_SETUP"]
  293. },
  294. "response": {
  295. "statusCode": 200,
  296. "toolUse": {
  297. "id": "toolu_e2e_background_direct_user_prompt_bash",
  298. "name": "Bash",
  299. "input": {
  300. "command": "sh -c 'sleep 60; printf \"E2E_BACKGROUND_DIRECT_USER_PROMPT_BASH_DONE\\n\"'",
  301. "description": "background direct user prompt bash sleep",
  302. "run_in_background": true
  303. }
  304. }
  305. }
  306. },
  307. {
  308. "id": "upstream-background-direct-user-prompt-launch-ack",
  309. "description": "BG15: parent finishes launch turn while background Bash keeps running.",
  310. "metadata": {
  311. "kind": "main",
  312. "timingPolicy": "fast-text",
  313. "source": "synthetic",
  314. "syntheticReason": "让 main 回到 idle,但统一 background control UI 仍有 running Bash task。"
  315. },
  316. "maxMatches": 1,
  317. "match": {
  318. "method": "POST",
  319. "pathIncludes": "/messages",
  320. "bodyIncludes": [
  321. "E2E_BACKGROUND_DIRECT_USER_PROMPT_SETUP",
  322. "Command running in background"
  323. ],
  324. "bodyExcludes": [
  325. "Generate a concise title",
  326. "CRITICAL: Respond with TEXT ONLY",
  327. "Verify whether the active session goal"
  328. ]
  329. },
  330. "response": {
  331. "statusCode": 200,
  332. "text": {
  333. "id": "upstream-e2e-background-direct-user-prompt-launch-ack",
  334. "text": "background-direct-user-prompt-launched-ok"
  335. }
  336. }
  337. },
  338. {
  339. "id": "upstream-background-direct-user-prompt-received",
  340. "description": "BG15: second user prompt is sent immediately while background task is still running.",
  341. "metadata": {
  342. "kind": "main",
  343. "timingPolicy": "fast-text",
  344. "source": "synthetic",
  345. "syntheticReason": "验证 background task running 不会把用户普通消息放入 queue,而是立即进入 provider request。"
  346. },
  347. "maxMatches": 1,
  348. "match": {
  349. "method": "POST",
  350. "pathIncludes": "/messages",
  351. "bodyIncludes": [
  352. "E2E_BACKGROUND_DIRECT_USER_PROMPT",
  353. "E2E_BACKGROUND_DIRECT_USER_PROMPT_PAYLOAD"
  354. ],
  355. "bodyExcludes": [
  356. "Generate a concise title",
  357. "CRITICAL: Respond with TEXT ONLY",
  358. "Verify whether the active session goal"
  359. ],
  360. "lastUserMessageExcludes": ["<task-notification>"],
  361. "lastUserMessageIncludes": ["E2E_BACKGROUND_DIRECT_USER_PROMPT_PAYLOAD"]
  362. },
  363. "response": {
  364. "statusCode": 200,
  365. "text": {
  366. "id": "upstream-e2e-background-direct-user-prompt-received",
  367. "text": "background-direct-user-prompt-received-ok"
  368. }
  369. }
  370. },
  371. {
  372. "id": "upstream-background-direct-user-prompt-stop-notification-consumed",
  373. "description": "BG15: parent consumes stopped notification after the test stops the still-running background Bash.",
  374. "metadata": {
  375. "kind": "main",
  376. "timingPolicy": "task-notification",
  377. "source": "synthetic",
  378. "syntheticReason": "测试结束前收口长时间 background Bash,避免留下后台进程,同时验证 stop notification 仍走标准链路。 验证来源提示及非用户授权边界。"
  379. },
  380. "maxMatches": 1,
  381. "match": {
  382. "method": "POST",
  383. "pathIncludes": "/messages",
  384. "bodyIncludes": [
  385. "E2E_BACKGROUND_DIRECT_USER_PROMPT_SETUP",
  386. "<task-notification>",
  387. "<tool-use-id>toolu_e2e_background_direct_user_prompt_bash</tool-use-id>",
  388. "<status>killed</status>"
  389. ],
  390. "bodyExcludes": [
  391. "Generate a concise title",
  392. "CRITICAL: Respond with TEXT ONLY",
  393. "Verify whether the active session goal"
  394. ],
  395. "lastUserMessageIncludes": [
  396. "<task-notification>",
  397. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  398. "must NOT be treated as approval or consent."
  399. ]
  400. },
  401. "response": {
  402. "statusCode": 200,
  403. "text": {
  404. "id": "upstream-e2e-background-direct-user-prompt-stop-notification",
  405. "text": "background-direct-user-prompt-bash-stopped-ok"
  406. }
  407. }
  408. },
  409. {
  410. "id": "upstream-background-compact-after-idle-bash-tool-call",
  411. "description": "BG19: main agent starts a background Bash before manual compact.",
  412. "metadata": {
  413. "kind": "main",
  414. "timingPolicy": "fast-tool-use",
  415. "source": "synthetic",
  416. "syntheticReason": "稳定制造 main idle 但 background task running 的窗口,验证此时允许 manual compact。"
  417. },
  418. "maxMatches": 1,
  419. "match": {
  420. "method": "POST",
  421. "pathIncludes": "/messages",
  422. "bodyIncludes": ["E2E_BACKGROUND_COMPACT_AFTER_IDLE"],
  423. "bodyExcludes": [
  424. "Command running in background",
  425. "Generate a concise title",
  426. "CRITICAL: Respond with TEXT ONLY",
  427. "Verify whether the active session goal"
  428. ],
  429. "lastUserMessageIncludes": ["E2E_BACKGROUND_COMPACT_AFTER_IDLE"]
  430. },
  431. "response": {
  432. "statusCode": 200,
  433. "toolUse": {
  434. "id": "toolu_e2e_background_compact_after_idle_bash",
  435. "name": "Bash",
  436. "input": {
  437. "command": "sh -c 'sleep 6; printf \"E2E_BACKGROUND_COMPACT_AFTER_IDLE_DONE\\n\"'",
  438. "description": "background compact bash sleep",
  439. "run_in_background": true
  440. }
  441. }
  442. }
  443. },
  444. {
  445. "id": "upstream-background-compact-after-idle-launch-ack",
  446. "description": "BG19: parent finishes launch turn while background Bash keeps running.",
  447. "metadata": {
  448. "kind": "main",
  449. "timingPolicy": "fast-text",
  450. "source": "synthetic",
  451. "syntheticReason": "让 main 回到 idle,后续手动 compact 不应被 background running 阻塞。"
  452. },
  453. "maxMatches": 1,
  454. "match": {
  455. "method": "POST",
  456. "pathIncludes": "/messages",
  457. "bodyIncludes": [
  458. "E2E_BACKGROUND_COMPACT_AFTER_IDLE",
  459. "E2E_BACKGROUND_COMPACT_AFTER_IDLE_DONE",
  460. "Command running in background"
  461. ],
  462. "bodyExcludes": [
  463. "Generate a concise title",
  464. "CRITICAL: Respond with TEXT ONLY",
  465. "Verify whether the active session goal"
  466. ]
  467. },
  468. "response": {
  469. "statusCode": 200,
  470. "text": {
  471. "id": "upstream-e2e-background-compact-after-idle-launch-ack",
  472. "text": "background-compact-launched-ok"
  473. }
  474. }
  475. },
  476. {
  477. "id": "upstream-background-compact-after-idle-summary",
  478. "description": "BG19: manual compact while background task is running succeeds.",
  479. "metadata": {
  480. "kind": "main",
  481. "timingPolicy": "fast-json",
  482. "source": "synthetic",
  483. "syntheticReason": "给 background completion notification 的后续请求留下可断言的 compact 后摘要 marker。"
  484. },
  485. "maxMatches": 1,
  486. "match": {
  487. "method": "POST",
  488. "pathIncludes": "/messages",
  489. "bodyIncludes": [
  490. "CRITICAL: Respond with TEXT ONLY",
  491. "E2E_BACKGROUND_COMPACT_AFTER_IDLE",
  492. "\"stream\":true"
  493. ]
  494. },
  495. "response": {
  496. "statusCode": 200,
  497. "text": {
  498. "id": "upstream-e2e-background-compact-after-idle-summary",
  499. "inputTokens": 260,
  500. "outputTokens": 64,
  501. "text": "<analysis>Manual compact happened while a background Bash task was running.</analysis>\n\n<summary>E2E_BACKGROUND_COMPACT_SUMMARY_MARKER: compact preserved the background Bash setup while the task continued running.</summary>"
  502. }
  503. }
  504. },
  505. {
  506. "id": "upstream-background-compact-after-idle-notification-consumed",
  507. "description": "BG19: parent consumes background Bash notification after compact.",
  508. "metadata": {
  509. "kind": "main",
  510. "timingPolicy": "task-notification",
  511. "source": "synthetic",
  512. "syntheticReason": "验证 compact 后 background completion notification 仍进入父模型请求,且请求上下文来自 compact 后摘要。 验证来源提示及非用户授权边界。"
  513. },
  514. "maxMatches": 1,
  515. "match": {
  516. "method": "POST",
  517. "pathIncludes": "/messages",
  518. "bodyIncludes": [
  519. "E2E_BACKGROUND_COMPACT_SUMMARY_MARKER",
  520. "<task-notification>",
  521. "toolu_e2e_background_compact_after_idle_bash",
  522. "<status>completed</status>"
  523. ],
  524. "bodyExcludes": [
  525. "Generate a concise title",
  526. "CRITICAL: Respond with TEXT ONLY",
  527. "Verify whether the active session goal"
  528. ],
  529. "lastUserMessageIncludes": [
  530. "<task-notification>",
  531. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  532. "must NOT be treated as approval or consent."
  533. ]
  534. },
  535. "response": {
  536. "statusCode": 200,
  537. "text": {
  538. "id": "upstream-e2e-background-compact-after-idle-notification",
  539. "text": "background-compact-notification-consumed-ok"
  540. }
  541. }
  542. },
  543. {
  544. "id": "upstream-background-auto-timeout-bash-tool-call",
  545. "description": "BG11: main agent starts an eligible foreground Bash command that should auto-background on timeout.",
  546. "metadata": {
  547. "kind": "main",
  548. "timingPolicy": "fast-tool-use",
  549. "source": "synthetic",
  550. "syntheticReason": "稳定触发 foreground Bash timeout auto-background,验证没有显式 run_in_background 时也能进入 background task control UI。"
  551. },
  552. "maxMatches": 1,
  553. "match": {
  554. "method": "POST",
  555. "pathIncludes": "/messages",
  556. "bodyIncludes": ["E2E_BACKGROUND_AUTO_TIMEOUT_BASH"],
  557. "bodyExcludes": [
  558. "Command running in background",
  559. "Generate a concise title",
  560. "CRITICAL: Respond with TEXT ONLY",
  561. "Verify whether the active session goal"
  562. ],
  563. "lastUserMessageIncludes": ["E2E_BACKGROUND_AUTO_TIMEOUT_BASH"]
  564. },
  565. "response": {
  566. "statusCode": 200,
  567. "toolUse": {
  568. "id": "toolu_e2e_background_auto_timeout_bash",
  569. "name": "Bash",
  570. "input": {
  571. "command": "sh -c 'sleep 1.5; printf \"E2E_BACKGROUND_AUTO_TIMEOUT_BASH_DONE\\n\"'",
  572. "description": "auto timeout bash sleep",
  573. "timeout": 1
  574. }
  575. }
  576. }
  577. },
  578. {
  579. "id": "upstream-background-auto-timeout-bash-launch-ack",
  580. "description": "BG11: parent finishes launch turn after foreground Bash auto-backgrounds.",
  581. "metadata": {
  582. "kind": "main",
  583. "timingPolicy": "fast-text",
  584. "source": "synthetic",
  585. "syntheticReason": "让 UI 在 Bash 自然完成前展示 auto-background 后的 running control row。"
  586. },
  587. "maxMatches": 1,
  588. "match": {
  589. "method": "POST",
  590. "pathIncludes": "/messages",
  591. "bodyIncludes": ["E2E_BACKGROUND_AUTO_TIMEOUT_BASH", "Command running in background"],
  592. "bodyExcludes": [
  593. "Generate a concise title",
  594. "CRITICAL: Respond with TEXT ONLY",
  595. "Verify whether the active session goal"
  596. ]
  597. },
  598. "response": {
  599. "statusCode": 200,
  600. "text": {
  601. "id": "upstream-e2e-background-auto-timeout-bash-launch-ack",
  602. "text": "background-auto-timeout-bash-launched-ok"
  603. }
  604. }
  605. },
  606. {
  607. "id": "upstream-background-auto-timeout-bash-notification-consumed",
  608. "description": "BG12: parent consumes completed notification and UI should remove the auto-background Bash row.",
  609. "metadata": {
  610. "kind": "main",
  611. "timingPolicy": "task-notification",
  612. "source": "synthetic",
  613. "syntheticReason": "验证 auto-background Bash 自然完成后 provider-visible notification 和 UI control row cleanup。 验证来源提示及非用户授权边界。"
  614. },
  615. "maxMatches": 1,
  616. "match": {
  617. "method": "POST",
  618. "pathIncludes": "/messages",
  619. "bodyIncludes": [
  620. "E2E_BACKGROUND_AUTO_TIMEOUT_BASH",
  621. "<task-notification>",
  622. "<tool-use-id>toolu_e2e_background_auto_timeout_bash</tool-use-id>",
  623. "<status>completed</status>"
  624. ],
  625. "bodyExcludes": [
  626. "Generate a concise title",
  627. "CRITICAL: Respond with TEXT ONLY",
  628. "Verify whether the active session goal"
  629. ],
  630. "lastUserMessageIncludes": [
  631. "<task-notification>",
  632. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  633. "must NOT be treated as approval or consent."
  634. ]
  635. },
  636. "response": {
  637. "statusCode": 200,
  638. "text": {
  639. "id": "upstream-e2e-background-auto-timeout-bash-notification",
  640. "text": "background-auto-timeout-bash-completed-ok"
  641. }
  642. }
  643. },
  644. {
  645. "id": "upstream-bg37-explicit-timeout-tool-call",
  646. "description": "BG37: main agent starts explicit background Bash with an input timeout shorter than its runtime.",
  647. "metadata": {
  648. "kind": "main",
  649. "timingPolicy": "fast-tool-use",
  650. "source": "synthetic",
  651. "syntheticReason": "稳定验证 explicit background commit 后 input timeout 不再终止进程。"
  652. },
  653. "maxMatches": 1,
  654. "match": {
  655. "method": "POST",
  656. "pathIncludes": "/messages",
  657. "bodyIncludes": ["E2E_BG37_EXPLICIT_TIMEOUT"],
  658. "bodyExcludes": [
  659. "Command running in background",
  660. "Generate a concise title",
  661. "CRITICAL: Respond with TEXT ONLY",
  662. "Verify whether the active session goal"
  663. ],
  664. "lastUserMessageIncludes": ["E2E_BG37_EXPLICIT_TIMEOUT"]
  665. },
  666. "response": {
  667. "statusCode": 200,
  668. "toolUse": {
  669. "id": "toolu_e2e_bg37_explicit_timeout",
  670. "name": "Bash",
  671. "input": {
  672. "command": "printf 'E2E_BG37_STARTED\\n'; sleep 8; printf 'E2E_BG37_DONE\\n'",
  673. "description": "BG37 explicit timeout bash",
  674. "run_in_background": true,
  675. "timeout": 10
  676. }
  677. }
  678. }
  679. },
  680. {
  681. "id": "upstream-bg37-explicit-timeout-launch-ack",
  682. "description": "BG37: parent finishes the launch turn while explicit Bash remains running past its input timeout.",
  683. "metadata": {
  684. "kind": "main",
  685. "timingPolicy": "fast-text",
  686. "source": "synthetic",
  687. "syntheticReason": "保留 input timeout 后仍可见的 running control row 窗口。"
  688. },
  689. "maxMatches": 1,
  690. "match": {
  691. "method": "POST",
  692. "pathIncludes": "/messages",
  693. "bodyIncludes": ["E2E_BG37_EXPLICIT_TIMEOUT", "Command running in background"],
  694. "bodyExcludes": [
  695. "Generate a concise title",
  696. "CRITICAL: Respond with TEXT ONLY",
  697. "Verify whether the active session goal"
  698. ],
  699. "lastUserMessageExcludes": ["<task-notification>"]
  700. },
  701. "response": {
  702. "statusCode": 200,
  703. "text": {
  704. "id": "upstream-e2e-bg37-explicit-timeout-launch-ack",
  705. "text": "bg37-explicit-timeout-launched-ok"
  706. }
  707. }
  708. },
  709. {
  710. "id": "upstream-bg37-explicit-timeout-auto-compact-summary",
  711. "description": "BG37: automatic compact preserves the explicit Bash setup before consuming its completion notification.",
  712. "metadata": {
  713. "kind": "main",
  714. "timingPolicy": "fast-text",
  715. "source": "synthetic",
  716. "syntheticReason": "Bash prompt 变长后该轮会先自动 compact;固定 summary 以继续验证 completion notification,而不是让 replay 缺 fixture。"
  717. },
  718. "maxMatches": 1,
  719. "match": {
  720. "method": "POST",
  721. "pathIncludes": "/messages",
  722. "bodyIncludes": [
  723. "CRITICAL: Respond with TEXT ONLY",
  724. "E2E_BG37_EXPLICIT_TIMEOUT",
  725. "toolu_e2e_bg37_explicit_timeout",
  726. "\"stream\":true"
  727. ],
  728. "bodyExcludes": [
  729. "Generate a concise title",
  730. "Verify whether the active session goal"
  731. ]
  732. },
  733. "response": {
  734. "statusCode": 200,
  735. "text": {
  736. "id": "upstream-e2e-bg37-explicit-timeout-auto-compact-summary",
  737. "inputTokens": 210,
  738. "outputTokens": 64,
  739. "text": "<analysis>Automatic compact preserved the explicit background Bash launch while it continued beyond its input timeout.</analysis>\n\n<summary>E2E_BG37_EXPLICIT_TIMEOUT remains active as toolu_e2e_bg37_explicit_timeout and its single completion notification is still pending.</summary>"
  740. }
  741. }
  742. },
  743. {
  744. "id": "upstream-bg37-explicit-timeout-notification-consumed",
  745. "description": "BG37: parent consumes the one completed notification from explicit Bash.",
  746. "metadata": {
  747. "kind": "main",
  748. "timingPolicy": "task-notification",
  749. "source": "synthetic",
  750. "syntheticReason": "验证 explicit Bash 越过 input timeout 后自然完成且只通知一次。 验证来源提示及非用户授权边界。"
  751. },
  752. "maxMatches": 1,
  753. "match": {
  754. "method": "POST",
  755. "pathIncludes": "/messages",
  756. "bodyIncludes": [
  757. "E2E_BG37_EXPLICIT_TIMEOUT",
  758. "<task-notification>",
  759. "<tool-use-id>toolu_e2e_bg37_explicit_timeout</tool-use-id>",
  760. "<status>completed</status>"
  761. ],
  762. "bodyExcludes": [
  763. "Generate a concise title",
  764. "CRITICAL: Respond with TEXT ONLY",
  765. "Verify whether the active session goal"
  766. ],
  767. "lastUserMessageIncludes": [
  768. "<task-notification>",
  769. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  770. "must NOT be treated as approval or consent."
  771. ]
  772. },
  773. "response": {
  774. "statusCode": 200,
  775. "text": {
  776. "id": "upstream-e2e-bg37-explicit-timeout-notification",
  777. "text": "bg37-explicit-timeout-completed-ok"
  778. }
  779. }
  780. },
  781. {
  782. "id": "upstream-bg38-parent-abort-tool-call",
  783. "description": "BG38: main agent commits an explicit Bash before the parent turn is stopped.",
  784. "metadata": {
  785. "kind": "main",
  786. "timingPolicy": "fast-tool-use",
  787. "source": "synthetic",
  788. "syntheticReason": "后台命令先写 started marker,再由测试停止仍 active 的 parent turn。"
  789. },
  790. "maxMatches": 1,
  791. "match": {
  792. "method": "POST",
  793. "pathIncludes": "/messages",
  794. "bodyIncludes": ["E2E_BG38_PARENT_ABORT"],
  795. "bodyExcludes": [
  796. "Command running in background",
  797. "Generate a concise title",
  798. "CRITICAL: Respond with TEXT ONLY",
  799. "Verify whether the active session goal"
  800. ],
  801. "lastUserMessageIncludes": ["E2E_BG38_PARENT_ABORT"]
  802. },
  803. "response": {
  804. "statusCode": 200,
  805. "toolUse": {
  806. "id": "toolu_e2e_bg38_parent_abort",
  807. "name": "Bash",
  808. "input": {
  809. "command": "printf 'E2E_BG38_STARTED\\n' > .zcode-e2e/conversation-session-background/bg38-bash-started; printf 'E2E_BG38_STARTED\\n'; sleep 4; printf 'E2E_BG38_DONE\\n'",
  810. "description": "BG38 parent abort bash",
  811. "run_in_background": true,
  812. "timeout": 10
  813. }
  814. }
  815. }
  816. },
  817. {
  818. "id": "upstream-bg38-parent-abort-launch-running",
  819. "description": "BG38: keep the parent launch response active so the test can stop it after Bash commit.",
  820. "metadata": {
  821. "kind": "main",
  822. "timingPolicy": "controlled-stream",
  823. "source": "synthetic",
  824. "syntheticReason": "延迟 launch response,稳定制造 task 已 commit 但 parent turn 仍 active 的 abort 窗口。"
  825. },
  826. "maxMatches": 1,
  827. "match": {
  828. "method": "POST",
  829. "pathIncludes": "/messages",
  830. "bodyIncludes": ["E2E_BG38_PARENT_ABORT", "Command running in background"],
  831. "bodyExcludes": [
  832. "Generate a concise title",
  833. "CRITICAL: Respond with TEXT ONLY",
  834. "Verify whether the active session goal"
  835. ],
  836. "lastUserMessageExcludes": ["<task-notification>"]
  837. },
  838. "response": {
  839. "statusCode": 200,
  840. "delayMs": 8000,
  841. "text": {
  842. "id": "upstream-e2e-bg38-parent-abort-launch-running",
  843. "text": "bg38-parent-turn-should-be-stopped"
  844. }
  845. }
  846. },
  847. {
  848. "id": "upstream-bg38-parent-abort-notification-consumed",
  849. "description": "BG38: parent consumes completed notification after its original turn was stopped.",
  850. "metadata": {
  851. "kind": "main",
  852. "timingPolicy": "task-notification",
  853. "source": "synthetic",
  854. "syntheticReason": "验证 parent abort 不会杀死已 commit Bash,且不会产生重复 notification。 验证来源提示及非用户授权边界。"
  855. },
  856. "maxMatches": 1,
  857. "match": {
  858. "method": "POST",
  859. "pathIncludes": "/messages",
  860. "bodyIncludes": [
  861. "E2E_BG38_PARENT_ABORT",
  862. "<task-notification>",
  863. "<tool-use-id>toolu_e2e_bg38_parent_abort</tool-use-id>",
  864. "<status>completed</status>",
  865. "E2E_BG38_STARTED",
  866. "E2E_BG38_DONE"
  867. ],
  868. "bodyExcludes": [
  869. "Generate a concise title",
  870. "CRITICAL: Respond with TEXT ONLY",
  871. "Verify whether the active session goal"
  872. ],
  873. "lastUserMessageIncludes": [
  874. "<task-notification>",
  875. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  876. "must NOT be treated as approval or consent."
  877. ]
  878. },
  879. "response": {
  880. "statusCode": 200,
  881. "text": {
  882. "id": "upstream-e2e-bg38-parent-abort-notification",
  883. "text": "bg38-parent-abort-background-completed-ok"
  884. }
  885. }
  886. },
  887. {
  888. "id": "upstream-bg39-sleep-hard-timeout-tool-call",
  889. "description": "BG39: main agent starts a foreground Bash whose first raw token is sleep.",
  890. "metadata": {
  891. "kind": "main",
  892. "timingPolicy": "fast-tool-use",
  893. "source": "synthetic",
  894. "syntheticReason": "稳定验证首 token sleep 沿用 foreground hard timeout,不进入 auto-background。"
  895. },
  896. "maxMatches": 1,
  897. "match": {
  898. "method": "POST",
  899. "pathIncludes": "/messages",
  900. "bodyIncludes": ["E2E_BG39_SLEEP_HARD_TIMEOUT"],
  901. "bodyExcludes": [
  902. "Command running in background",
  903. "Generate a concise title",
  904. "CRITICAL: Respond with TEXT ONLY",
  905. "Verify whether the active session goal"
  906. ],
  907. "lastUserMessageIncludes": ["E2E_BG39_SLEEP_HARD_TIMEOUT"]
  908. },
  909. "response": {
  910. "statusCode": 200,
  911. "toolUse": {
  912. "id": "toolu_e2e_bg39_sleep_timeout",
  913. "name": "Bash",
  914. "input": {
  915. "command": "sleep 2; printf 'E2E_BG39_UNEXPECTED\\n'",
  916. "description": "BG39 sleep hard timeout",
  917. "timeout": 50
  918. }
  919. }
  920. }
  921. },
  922. {
  923. "id": "upstream-bg39-sleep-hard-timeout-completed",
  924. "description": "BG39: parent receives foreground aborted output without a background task ID.",
  925. "metadata": {
  926. "kind": "main",
  927. "timingPolicy": "fast-text",
  928. "source": "synthetic",
  929. "syntheticReason": "验证 provider-visible result 为 foreground timeout,且没有 background notification。"
  930. },
  931. "maxMatches": 1,
  932. "match": {
  933. "method": "POST",
  934. "pathIncludes": "/messages",
  935. "bodyIncludes": [
  936. "E2E_BG39_SLEEP_HARD_TIMEOUT",
  937. "<error>Command was aborted before completion</error>"
  938. ],
  939. "bodyExcludes": [
  940. "Command running in background",
  941. "Generate a concise title",
  942. "CRITICAL: Respond with TEXT ONLY",
  943. "Verify whether the active session goal"
  944. ],
  945. "lastUserMessageExcludes": ["<task-notification>"]
  946. },
  947. "response": {
  948. "statusCode": 200,
  949. "text": {
  950. "id": "upstream-e2e-bg39-sleep-hard-timeout",
  951. "text": "bg39-sleep-hard-timeout-ok"
  952. }
  953. }
  954. },
  955. {
  956. "id": "upstream-background-cancel-bash-tool-call",
  957. "description": "BG08: main agent launches a cross-PGID background Bash process tree that will be stopped from the UI.",
  958. "metadata": {
  959. "kind": "main",
  960. "timingPolicy": "fast-tool-use",
  961. "source": "synthetic",
  962. "syntheticReason": "稳定触发由 Bash job control 构造的跨 PGID launcher/worker 子树,用于验证统一 background control UI 的 stop 杀树路径。"
  963. },
  964. "maxMatches": 1,
  965. "match": {
  966. "method": "POST",
  967. "pathIncludes": "/messages",
  968. "bodyIncludes": ["E2E_BACKGROUND_CANCEL_BASH"],
  969. "bodyExcludes": [
  970. "Command running in background",
  971. "Generate a concise title",
  972. "CRITICAL: Respond with TEXT ONLY",
  973. "Verify whether the active session goal"
  974. ],
  975. "lastUserMessageIncludes": ["E2E_BACKGROUND_CANCEL_BASH"]
  976. },
  977. "response": {
  978. "statusCode": 200,
  979. "toolUse": {
  980. "id": "toolu_e2e_background_cancel_bash",
  981. "name": "Bash",
  982. "input": {
  983. "command": "bash -c 'printf \"%s\\n\" \"$$\" > .zcode-e2e/conversation-session-background/bg08-root.pid; set -m; node .zcode-e2e/conversation-session-background/bg08-launcher.cjs .zcode-e2e/conversation-session-background/bg08-launcher.pid .zcode-e2e/conversation-session-background/bg08-worker.pid & wait'",
  984. "description": "background cancel bash process tree",
  985. "run_in_background": true
  986. }
  987. }
  988. }
  989. },
  990. {
  991. "id": "upstream-background-cancel-bash-launch-ack",
  992. "description": "BG08: parent finishes launch turn after backgrounded Bash result.",
  993. "metadata": {
  994. "kind": "main",
  995. "timingPolicy": "fast-text",
  996. "source": "synthetic",
  997. "syntheticReason": "让 UI 在 idle 状态展示 running background Bash control,随后由测试点击 stop。"
  998. },
  999. "maxMatches": 1,
  1000. "match": {
  1001. "method": "POST",
  1002. "pathIncludes": "/messages",
  1003. "bodyIncludes": ["E2E_BACKGROUND_CANCEL_BASH", "Command running in background"],
  1004. "bodyExcludes": [
  1005. "Generate a concise title",
  1006. "CRITICAL: Respond with TEXT ONLY",
  1007. "Verify whether the active session goal"
  1008. ]
  1009. },
  1010. "response": {
  1011. "statusCode": 200,
  1012. "text": {
  1013. "id": "upstream-e2e-background-cancel-bash-launch-ack",
  1014. "text": "background-cancel-bash-launched-ok"
  1015. }
  1016. }
  1017. },
  1018. {
  1019. "id": "upstream-background-cancel-bash-notification-consumed",
  1020. "description": "BG08: parent consumes stopped Bash notification after UI stop.",
  1021. "metadata": {
  1022. "kind": "main",
  1023. "timingPolicy": "task-notification",
  1024. "source": "synthetic",
  1025. "syntheticReason": "验证 UI stop Bash 仍走 background task notification,而不是只在 UI 本地消失。 验证来源提示及非用户授权边界。"
  1026. },
  1027. "maxMatches": 1,
  1028. "match": {
  1029. "method": "POST",
  1030. "pathIncludes": "/messages",
  1031. "bodyIncludes": [
  1032. "E2E_BACKGROUND_CANCEL_BASH",
  1033. "<task-notification>",
  1034. "<tool-use-id>toolu_e2e_background_cancel_bash</tool-use-id>",
  1035. "<status>killed</status>"
  1036. ],
  1037. "bodyExcludes": [
  1038. "Generate a concise title",
  1039. "CRITICAL: Respond with TEXT ONLY",
  1040. "Verify whether the active session goal"
  1041. ],
  1042. "lastUserMessageIncludes": [
  1043. "<task-notification>",
  1044. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  1045. "must NOT be treated as approval or consent."
  1046. ]
  1047. },
  1048. "response": {
  1049. "statusCode": 200,
  1050. "text": {
  1051. "id": "upstream-e2e-background-cancel-bash-notification",
  1052. "text": "background-cancel-bash-stopped-ok"
  1053. }
  1054. }
  1055. },
  1056. {
  1057. "id": "upstream-background-cancel-agent-tool-call",
  1058. "description": "BG09: main agent launches a long background Agent that will be stopped from the UI.",
  1059. "metadata": {
  1060. "kind": "main",
  1061. "timingPolicy": "fast-tool-use",
  1062. "source": "synthetic",
  1063. "syntheticReason": "稳定触发 running local_agent task,验证统一 background control UI 能停止 subagent。"
  1064. },
  1065. "maxMatches": 1,
  1066. "match": {
  1067. "method": "POST",
  1068. "pathIncludes": "/messages",
  1069. "bodyIncludes": ["E2E_BACKGROUND_CANCEL_AGENT"],
  1070. "bodyExcludes": [
  1071. "Async agent launched successfully",
  1072. "agentId: agent_",
  1073. "Generate a concise title",
  1074. "CRITICAL: Respond with TEXT ONLY",
  1075. "Verify whether the active session goal"
  1076. ],
  1077. "lastUserMessageIncludes": ["E2E_BACKGROUND_CANCEL_AGENT"]
  1078. },
  1079. "response": {
  1080. "statusCode": 200,
  1081. "toolUse": {
  1082. "id": "toolu_e2e_background_cancel_agent",
  1083. "name": "Agent",
  1084. "input": {
  1085. "description": "E2E background cancel agent",
  1086. "prompt": "E2E_BACKGROUND_CANCEL_AGENT_CHILD: Stay running until stopped. If not stopped, return E2E_BACKGROUND_CANCEL_AGENT_CHILD_UNEXPECTED.",
  1087. "run_in_background": true
  1088. }
  1089. }
  1090. }
  1091. },
  1092. {
  1093. "id": "upstream-background-cancel-agent-launch-ack",
  1094. "description": "BG09: parent finishes launch turn after async Agent result.",
  1095. "metadata": {
  1096. "kind": "main",
  1097. "timingPolicy": "fast-text",
  1098. "source": "synthetic",
  1099. "syntheticReason": "让 UI 在 idle 状态展示 running background Agent control,随后由测试点击 stop。"
  1100. },
  1101. "maxMatches": 1,
  1102. "match": {
  1103. "method": "POST",
  1104. "pathIncludes": "/messages",
  1105. "bodyIncludes": ["E2E_BACKGROUND_CANCEL_AGENT", "Async agent launched successfully"],
  1106. "bodyExcludes": [
  1107. "Generate a concise title",
  1108. "CRITICAL: Respond with TEXT ONLY",
  1109. "Verify whether the active session goal"
  1110. ]
  1111. },
  1112. "response": {
  1113. "statusCode": 200,
  1114. "text": {
  1115. "id": "upstream-e2e-background-cancel-agent-launch-ack",
  1116. "text": "background-cancel-agent-launched-ok"
  1117. }
  1118. }
  1119. },
  1120. {
  1121. "id": "upstream-background-cancel-agent-child-delayed-result",
  1122. "description": "BG09: delayed child Agent response that should be aborted by UI stop.",
  1123. "metadata": {
  1124. "kind": "subagent",
  1125. "timingPolicy": "delayed-text",
  1126. "source": "synthetic",
  1127. "syntheticReason": "保持 child provider request 运行,验证 stop 会 abort running background Agent。"
  1128. },
  1129. "maxMatches": 1,
  1130. "match": {
  1131. "method": "POST",
  1132. "pathIncludes": "/messages",
  1133. "bodyIncludes": ["E2E_BACKGROUND_CANCEL_AGENT_CHILD"],
  1134. "lastUserMessageIncludes": ["E2E_BACKGROUND_CANCEL_AGENT_CHILD"]
  1135. },
  1136. "response": {
  1137. "statusCode": 200,
  1138. "delayMs": 60000,
  1139. "text": {
  1140. "id": "upstream-e2e-background-cancel-agent-child-unexpected",
  1141. "text": "E2E_BACKGROUND_CANCEL_AGENT_CHILD_UNEXPECTED"
  1142. }
  1143. }
  1144. },
  1145. {
  1146. "id": "upstream-background-cancel-agent-notification-consumed",
  1147. "description": "BG09: parent consumes stopped Agent notification after UI stop.",
  1148. "metadata": {
  1149. "kind": "main",
  1150. "timingPolicy": "task-notification",
  1151. "source": "synthetic",
  1152. "syntheticReason": "验证 UI stop subagent 复用 local_agent task notification 链路。 验证来源提示及非用户授权边界。"
  1153. },
  1154. "maxMatches": 1,
  1155. "match": {
  1156. "method": "POST",
  1157. "pathIncludes": "/messages",
  1158. "bodyIncludes": [
  1159. "E2E_BACKGROUND_CANCEL_AGENT",
  1160. "<task-notification>",
  1161. "<tool-use-id>toolu_e2e_background_cancel_agent</tool-use-id>",
  1162. "<status>stopped</status>"
  1163. ],
  1164. "bodyExcludes": [
  1165. "Generate a concise title",
  1166. "CRITICAL: Respond with TEXT ONLY",
  1167. "Verify whether the active session goal"
  1168. ],
  1169. "lastUserMessageIncludes": [
  1170. "<task-notification>",
  1171. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  1172. "must NOT be treated as approval or consent."
  1173. ]
  1174. },
  1175. "response": {
  1176. "statusCode": 200,
  1177. "text": {
  1178. "id": "upstream-e2e-background-cancel-agent-notification",
  1179. "text": "background-cancel-agent-stopped-ok"
  1180. }
  1181. }
  1182. },
  1183. {
  1184. "id": "upstream-background-taskstop-agent-tool-call",
  1185. "description": "BG10: main agent launches a background Agent that the model will stop with TaskStop.",
  1186. "metadata": {
  1187. "kind": "main",
  1188. "timingPolicy": "fast-tool-use",
  1189. "source": "synthetic",
  1190. "syntheticReason": "稳定触发 running local_agent task,后续 provider replay 用 TaskStop 停止它。"
  1191. },
  1192. "maxMatches": 1,
  1193. "match": {
  1194. "method": "POST",
  1195. "pathIncludes": "/messages",
  1196. "bodyIncludes": ["E2E_BACKGROUND_TASKSTOP_AGENT"],
  1197. "bodyExcludes": [
  1198. "Async agent launched successfully",
  1199. "agentId: agent_",
  1200. "Generate a concise title",
  1201. "CRITICAL: Respond with TEXT ONLY",
  1202. "Verify whether the active session goal"
  1203. ],
  1204. "lastUserMessageIncludes": ["E2E_BACKGROUND_TASKSTOP_AGENT"]
  1205. },
  1206. "response": {
  1207. "statusCode": 200,
  1208. "toolUse": {
  1209. "id": "toolu_e2e_background_taskstop_agent",
  1210. "name": "Agent",
  1211. "input": {
  1212. "description": "E2E background TaskStop agent",
  1213. "prompt": "E2E_BACKGROUND_TASKSTOP_AGENT_CHILD: Stay running until stopped. If not stopped, return E2E_BACKGROUND_TASKSTOP_AGENT_CHILD_UNEXPECTED.",
  1214. "run_in_background": true
  1215. }
  1216. }
  1217. }
  1218. },
  1219. {
  1220. "id": "upstream-background-taskstop-agent-tool-stop",
  1221. "description": "BG10: parent uses TaskStop with the launched Agent task id.",
  1222. "metadata": {
  1223. "kind": "main",
  1224. "timingPolicy": "fast-tool-use",
  1225. "source": "synthetic",
  1226. "syntheticReason": "验证 provider-visible TaskStop tool 会复用 runtime background stop dispatcher。"
  1227. },
  1228. "maxMatches": 1,
  1229. "match": {
  1230. "method": "POST",
  1231. "pathIncludes": "/messages",
  1232. "bodyIncludes": [
  1233. "E2E_BACKGROUND_TASKSTOP_AGENT",
  1234. "Async agent launched successfully",
  1235. "agentId: agent_"
  1236. ],
  1237. "bodyExcludes": [
  1238. "Generate a concise title",
  1239. "CRITICAL: Respond with TEXT ONLY",
  1240. "Verify whether the active session goal"
  1241. ]
  1242. },
  1243. "response": {
  1244. "statusCode": 200,
  1245. "toolUse": {
  1246. "id": "toolu_e2e_background_taskstop_stop",
  1247. "name": "TaskStop",
  1248. "input": {
  1249. "task_id": "{{latestAgentId}}"
  1250. }
  1251. }
  1252. }
  1253. },
  1254. {
  1255. "id": "upstream-background-taskstop-agent-child-delayed-result",
  1256. "description": "BG10: delayed child Agent response that should be aborted by TaskStop.",
  1257. "metadata": {
  1258. "kind": "subagent",
  1259. "timingPolicy": "delayed-text",
  1260. "source": "synthetic",
  1261. "syntheticReason": "保持 child provider request 运行,验证 TaskStop 会 abort running background Agent。"
  1262. },
  1263. "maxMatches": 1,
  1264. "match": {
  1265. "method": "POST",
  1266. "pathIncludes": "/messages",
  1267. "bodyIncludes": ["E2E_BACKGROUND_TASKSTOP_AGENT_CHILD"],
  1268. "lastUserMessageIncludes": ["E2E_BACKGROUND_TASKSTOP_AGENT_CHILD"]
  1269. },
  1270. "response": {
  1271. "statusCode": 200,
  1272. "delayMs": 60000,
  1273. "text": {
  1274. "id": "upstream-e2e-background-taskstop-agent-child-unexpected",
  1275. "text": "E2E_BACKGROUND_TASKSTOP_AGENT_CHILD_UNEXPECTED"
  1276. }
  1277. }
  1278. },
  1279. {
  1280. "id": "upstream-background-taskstop-agent-notification-consumed",
  1281. "description": "BG10: parent consumes stopped Agent notification after TaskStop result.",
  1282. "metadata": {
  1283. "kind": "main",
  1284. "timingPolicy": "task-notification",
  1285. "source": "synthetic",
  1286. "syntheticReason": "验证 TaskStop tool result 和 stopped notification 在同一 runtime queue/active-loop 链路中收口。 验证来源提示及非用户授权边界。"
  1287. },
  1288. "maxMatches": 1,
  1289. "match": {
  1290. "method": "POST",
  1291. "pathIncludes": "/messages",
  1292. "bodyIncludes": [
  1293. "E2E_BACKGROUND_TASKSTOP_AGENT",
  1294. "Successfully stopped task:",
  1295. "<task-notification>",
  1296. "<tool-use-id>toolu_e2e_background_taskstop_agent</tool-use-id>",
  1297. "<status>stopped</status>"
  1298. ],
  1299. "bodyExcludes": [
  1300. "Generate a concise title",
  1301. "CRITICAL: Respond with TEXT ONLY",
  1302. "Verify whether the active session goal"
  1303. ],
  1304. "lastUserMessageIncludes": [
  1305. "<task-notification>",
  1306. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  1307. "must NOT be treated as approval or consent."
  1308. ]
  1309. },
  1310. "response": {
  1311. "statusCode": 200,
  1312. "text": {
  1313. "id": "upstream-e2e-background-taskstop-agent-notification",
  1314. "text": "background-taskstop-agent-stopped-ok"
  1315. }
  1316. }
  1317. },
  1318. {
  1319. "id": "upstream-background-active-loop-bash-tool-calls",
  1320. "description": "BG04: main agent starts a short Bash command that auto-backgrounds and completes before the active tool-loop follow-up request.",
  1321. "metadata": {
  1322. "kind": "main",
  1323. "timingPolicy": "fast-tool-use",
  1324. "source": "synthetic",
  1325. "syntheticReason": "稳定触发 active-loop background notification intake:Bash 先因短 timeout 转后台,命令随即完成并在后续 provider request 前入队 notification。"
  1326. },
  1327. "maxMatches": 1,
  1328. "match": {
  1329. "method": "POST",
  1330. "pathIncludes": "/messages",
  1331. "bodyIncludes": ["E2E_BACKGROUND_ACTIVE_LOOP_BASH"],
  1332. "lastUserMessageIncludes": ["E2E_BACKGROUND_ACTIVE_LOOP_BASH"]
  1333. },
  1334. "response": {
  1335. "statusCode": 200,
  1336. "toolUses": [
  1337. {
  1338. "id": "toolu_e2e_background_active_loop_bash_bg",
  1339. "name": "Bash",
  1340. "input": {
  1341. "command": "sh -c 'sleep 0.05; printf \"E2E_BACKGROUND_ACTIVE_LOOP_BASH_DONE\\n\"'",
  1342. "description": "Active-loop background marker",
  1343. "timeout": 1
  1344. }
  1345. },
  1346. {
  1347. "id": "toolu_e2e_background_active_loop_bash_wait",
  1348. "name": "Bash",
  1349. "input": {
  1350. "command": "sh -c 'sleep 0.2; printf \"E2E_BACKGROUND_ACTIVE_LOOP_WAIT_DONE\\n\"'",
  1351. "description": "Hold active tool loop for background completion"
  1352. }
  1353. }
  1354. ]
  1355. }
  1356. },
  1357. {
  1358. "id": "upstream-background-active-loop-notification-consumed",
  1359. "description": "BG04: parent consumes completed background Bash notification in the active tool-loop follow-up request.",
  1360. "metadata": {
  1361. "kind": "main",
  1362. "timingPolicy": "task-notification",
  1363. "source": "synthetic",
  1364. "syntheticReason": "验证同一次 provider request 同时包含上一轮 Bash tool result 与 <task-notification>,而不是等 idle wake 单独开一轮。 验证来源提示及非用户授权边界。"
  1365. },
  1366. "maxMatches": 1,
  1367. "match": {
  1368. "method": "POST",
  1369. "pathIncludes": "/messages",
  1370. "bodyIncludes": [
  1371. "E2E_BACKGROUND_ACTIVE_LOOP_BASH",
  1372. "E2E_BACKGROUND_ACTIVE_LOOP_WAIT_DONE",
  1373. "<task-notification>",
  1374. "<tool-use-id>toolu_e2e_background_active_loop_bash_bg</tool-use-id>",
  1375. "<status>completed</status>"
  1376. ],
  1377. "lastUserMessageIncludes": [
  1378. "<task-notification>",
  1379. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  1380. "must NOT be treated as approval or consent."
  1381. ]
  1382. },
  1383. "response": {
  1384. "statusCode": 200,
  1385. "text": {
  1386. "id": "upstream-e2e-background-active-loop-notification",
  1387. "text": "background-active-loop-notification-consumed-ok"
  1388. }
  1389. }
  1390. },
  1391. {
  1392. "id": "upstream-background-goal-seed",
  1393. "description": "BG34: create the v4 session before setting the background goal.",
  1394. "metadata": {
  1395. "kind": "main",
  1396. "timingPolicy": "fast-text",
  1397. "source": "synthetic",
  1398. "syntheticReason": "V4 /goal 需要已有 session;首轮仅建立 BG34 的稳定会话边界。"
  1399. },
  1400. "maxMatches": 1,
  1401. "match": {
  1402. "method": "POST",
  1403. "pathIncludes": "/messages",
  1404. "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_SEED"],
  1405. "bodyExcludes": [
  1406. "Generate a concise title",
  1407. "CRITICAL: Respond with TEXT ONLY",
  1408. "Continue working toward the active session goal"
  1409. ]
  1410. },
  1411. "response": {
  1412. "statusCode": 200,
  1413. "text": {
  1414. "id": "upstream-e2e-background-goal-seed",
  1415. "text": "background-goal-seed-ok"
  1416. }
  1417. }
  1418. },
  1419. {
  1420. "id": "upstream-background-goal-agent-tool-call",
  1421. "description": "BG03: goal continuation launches a background Agent.",
  1422. "metadata": {
  1423. "kind": "main",
  1424. "timingPolicy": "fast-tool-use",
  1425. "source": "synthetic",
  1426. "syntheticReason": "goal continuation 中启动 background Agent。"
  1427. },
  1428. "maxMatches": 1,
  1429. "match": {
  1430. "method": "POST",
  1431. "pathIncludes": "/messages",
  1432. "bodyIncludes": ["E2E_BACKGROUND_GOAL", "Continue working toward the active session goal"],
  1433. "bodyExcludes": [
  1434. "Generate a concise title",
  1435. "CRITICAL: Respond with TEXT ONLY",
  1436. "Verify whether the active session goal"
  1437. ]
  1438. },
  1439. "response": {
  1440. "statusCode": 200,
  1441. "toolUse": {
  1442. "id": "toolu_e2e_background_goal_agent",
  1443. "name": "Agent",
  1444. "input": {
  1445. "description": "Goal background",
  1446. "prompt": "E2E_BACKGROUND_GOAL_CHILD: Return exactly E2E_BACKGROUND_GOAL_CHILD_RESULT.",
  1447. "run_in_background": true
  1448. }
  1449. }
  1450. }
  1451. },
  1452. {
  1453. "id": "upstream-background-goal-agent-launch-ack",
  1454. "description": "BG03: goal continuation finishes before child Agent result.",
  1455. "metadata": {
  1456. "kind": "main",
  1457. "timingPolicy": "fast-text",
  1458. "source": "synthetic",
  1459. "syntheticReason": "goal continuation 的当前 turn 在子任务完成前先结束。"
  1460. },
  1461. "maxMatches": 1,
  1462. "match": {
  1463. "method": "POST",
  1464. "pathIncludes": "/messages",
  1465. "bodyIncludes": ["E2E_BACKGROUND_GOAL", "Async agent launched successfully"],
  1466. "bodyExcludes": [
  1467. "Generate a concise title",
  1468. "CRITICAL: Respond with TEXT ONLY",
  1469. "Verify whether the active session goal"
  1470. ]
  1471. },
  1472. "response": {
  1473. "statusCode": 200,
  1474. "text": {
  1475. "id": "upstream-e2e-background-goal-launch-ack",
  1476. "text": "background-goal-agent-launched-ok"
  1477. }
  1478. }
  1479. },
  1480. {
  1481. "id": "upstream-background-goal-direct-prompt",
  1482. "description": "BG34: a real user prompt starts immediately while only the goal background Agent is running.",
  1483. "metadata": {
  1484. "kind": "main",
  1485. "timingPolicy": "fast-text",
  1486. "source": "synthetic",
  1487. "syntheticReason": "稳定证明 active goal 的 background-only 状态不等于 main busy,用户输入不经过 future queue。"
  1488. },
  1489. "maxMatches": 1,
  1490. "match": {
  1491. "method": "POST",
  1492. "pathIncludes": "/messages",
  1493. "bodyIncludes": ["E2E_BACKGROUND_GOAL_DIRECT_PROMPT"],
  1494. "bodyExcludes": [
  1495. "Generate a concise title",
  1496. "CRITICAL: Respond with TEXT ONLY",
  1497. "Verify whether the active session goal"
  1498. ],
  1499. "lastUserMessageExcludes": ["<task-notification>"],
  1500. "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_DIRECT_PROMPT"]
  1501. },
  1502. "response": {
  1503. "statusCode": 200,
  1504. "text": {
  1505. "id": "upstream-e2e-background-goal-direct-prompt",
  1506. "text": "background-goal-direct-prompt-ok"
  1507. }
  1508. }
  1509. },
  1510. {
  1511. "id": "upstream-background-goal-child-delayed-result",
  1512. "description": "BG03: delayed child Agent result for goal.",
  1513. "metadata": {
  1514. "kind": "subagent",
  1515. "timingPolicy": "delayed-text",
  1516. "source": "synthetic",
  1517. "syntheticReason": "延迟子 agent 完成,证明 verifier 会等 notification。"
  1518. },
  1519. "maxMatches": 1,
  1520. "match": {
  1521. "method": "POST",
  1522. "pathIncludes": "/messages",
  1523. "bodyIncludes": ["E2E_BACKGROUND_GOAL_CHILD"],
  1524. "bodyExcludes": [
  1525. "Generate a concise title",
  1526. "CRITICAL: Respond with TEXT ONLY",
  1527. "Verify whether the active session goal"
  1528. ],
  1529. "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_CHILD"]
  1530. },
  1531. "response": {
  1532. "statusCode": 200,
  1533. "delayMs": 8000,
  1534. "text": {
  1535. "id": "upstream-e2e-background-goal-child-result",
  1536. "text": "E2E_BACKGROUND_GOAL_CHILD_RESULT"
  1537. }
  1538. }
  1539. },
  1540. {
  1541. "id": "upstream-background-goal-notification-consumed",
  1542. "description": "BG03: parent consumes goal background notification.",
  1543. "metadata": {
  1544. "kind": "main",
  1545. "timingPolicy": "task-notification",
  1546. "source": "synthetic",
  1547. "syntheticReason": "goal notification turn 消费子结果。 验证来源提示及非用户授权边界。"
  1548. },
  1549. "maxMatches": 1,
  1550. "match": {
  1551. "method": "POST",
  1552. "pathIncludes": "/messages",
  1553. "bodyIncludes": [
  1554. "<task-notification>",
  1555. "E2E_BACKGROUND_GOAL_CHILD_RESULT"
  1556. ],
  1557. "bodyExcludes": [
  1558. "Generate a concise title",
  1559. "CRITICAL: Respond with TEXT ONLY",
  1560. "Verify whether the active session goal"
  1561. ],
  1562. "lastUserMessageIncludes": [
  1563. "<task-notification>",
  1564. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  1565. "must NOT be treated as approval or consent."
  1566. ]
  1567. },
  1568. "response": {
  1569. "statusCode": 200,
  1570. "text": {
  1571. "id": "upstream-e2e-background-goal-notification",
  1572. "text": "E2E_BACKGROUND_GOAL_NOTIFICATION_CONSUMED"
  1573. }
  1574. }
  1575. },
  1576. {
  1577. "id": "upstream-background-goal-verifier-passed",
  1578. "description": "BG03: verifier passes only after background notification is consumed.",
  1579. "metadata": {
  1580. "kind": "goal-verifier",
  1581. "timingPolicy": "controlled-stream",
  1582. "source": "synthetic",
  1583. "syntheticReason": "验证 verifier 只在 notification 后执行并通过,并稳定留出 future queue admission 窗口。"
  1584. },
  1585. "maxMatches": 1,
  1586. "match": {
  1587. "method": "POST",
  1588. "pathIncludes": "/messages",
  1589. "bodyIncludes": [
  1590. "E2E_BACKGROUND_GOAL",
  1591. "E2E_BACKGROUND_GOAL_NOTIFICATION_CONSUMED",
  1592. "Verify whether the active session goal"
  1593. ],
  1594. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  1595. },
  1596. "response": {
  1597. "statusCode": 200,
  1598. "delayMs": 4000,
  1599. "headers": {
  1600. "content-type": "application/json; charset=utf-8"
  1601. },
  1602. "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\"}}"
  1603. }
  1604. },
  1605. {
  1606. "id": "upstream-background-goal-verifier-queue-drained",
  1607. "description": "BG34: verifier pass promotes the queued real user prompt without another legacy mutation.",
  1608. "metadata": {
  1609. "kind": "main",
  1610. "timingPolicy": "fast-text",
  1611. "source": "synthetic",
  1612. "syntheticReason": "稳定验证 TargetChanged(complete) 本身会重新评估 CLI queue gate 并自动提升队首。"
  1613. },
  1614. "maxMatches": 1,
  1615. "match": {
  1616. "method": "POST",
  1617. "pathIncludes": "/messages",
  1618. "bodyIncludes": ["E2E_BACKGROUND_GOAL_VERIFIER_QUEUE"],
  1619. "bodyExcludes": [
  1620. "Generate a concise title",
  1621. "CRITICAL: Respond with TEXT ONLY",
  1622. "Verify whether the active session goal"
  1623. ],
  1624. "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_VERIFIER_QUEUE"]
  1625. },
  1626. "response": {
  1627. "statusCode": 200,
  1628. "text": {
  1629. "id": "upstream-e2e-background-goal-verifier-queue-drained",
  1630. "text": "background-goal-verifier-queue-drained-ok"
  1631. }
  1632. }
  1633. },
  1634. {
  1635. "id": "upstream-background-send-agent-tool-call",
  1636. "description": "BG07: main agent launches a background Agent before sending it a coordinator message.",
  1637. "metadata": {
  1638. "kind": "main",
  1639. "timingPolicy": "fast-tool-use",
  1640. "source": "synthetic",
  1641. "syntheticReason": "稳定触发 Agent(run_in_background=true),后续用 SendMessage 验证 running child steer。"
  1642. },
  1643. "maxMatches": 1,
  1644. "match": {
  1645. "method": "POST",
  1646. "pathIncludes": "/messages",
  1647. "bodyIncludes": ["E2E_BACKGROUND_SEND_MESSAGE"],
  1648. "bodyExcludes": [
  1649. "Async agent launched successfully",
  1650. "agentId: agent_",
  1651. "Generate a concise title",
  1652. "CRITICAL: Respond with TEXT ONLY",
  1653. "Verify whether the active session goal"
  1654. ],
  1655. "lastUserMessageIncludes": ["E2E_BACKGROUND_SEND_MESSAGE"]
  1656. },
  1657. "response": {
  1658. "statusCode": 200,
  1659. "toolUse": {
  1660. "id": "toolu_e2e_background_send_agent",
  1661. "name": "Agent",
  1662. "input": {
  1663. "description": "Wait for coordinator message",
  1664. "prompt": "E2E_BACKGROUND_SEND_MESSAGE_CHILD: Start working. When you receive E2E_BACKGROUND_SEND_MESSAGE_PAYLOAD, reply exactly E2E_BACKGROUND_SEND_MESSAGE_CHILD_RECEIVED.",
  1665. "run_in_background": true
  1666. }
  1667. }
  1668. }
  1669. },
  1670. {
  1671. "id": "upstream-background-send-message-tool-call",
  1672. "description": "BG07: parent sends a message to the running background Agent after the launch tool result.",
  1673. "metadata": {
  1674. "kind": "main",
  1675. "timingPolicy": "fast-tool-use",
  1676. "source": "synthetic",
  1677. "syntheticReason": "根据 Agent tool result 中的 agentId 调用 SendMessage,验证父 agent 能 steer running child。"
  1678. },
  1679. "maxMatches": 1,
  1680. "match": {
  1681. "method": "POST",
  1682. "pathIncludes": "/messages",
  1683. "bodyIncludes": [
  1684. "E2E_BACKGROUND_SEND_MESSAGE",
  1685. "Async agent launched successfully",
  1686. "agentId: agent_"
  1687. ],
  1688. "bodyExcludes": [
  1689. "sent to its active turn",
  1690. "Generate a concise title",
  1691. "CRITICAL: Respond with TEXT ONLY",
  1692. "Verify whether the active session goal"
  1693. ],
  1694. "lastUserMessageExcludes": ["<task-notification>"]
  1695. },
  1696. "response": {
  1697. "statusCode": 200,
  1698. "toolUse": {
  1699. "id": "toolu_e2e_background_send_message",
  1700. "name": "SendMessage",
  1701. "input": {
  1702. "to": "{{latestAgentId}}",
  1703. "summary": "E2E_BACKGROUND_SEND_MESSAGE_STEER",
  1704. "message": "E2E_BACKGROUND_SEND_MESSAGE_PAYLOAD"
  1705. }
  1706. }
  1707. }
  1708. },
  1709. {
  1710. "id": "upstream-background-send-message-ack",
  1711. "description": "BG07: parent finishes the SendMessage turn after delivery status.",
  1712. "metadata": {
  1713. "kind": "main",
  1714. "timingPolicy": "fast-text",
  1715. "source": "synthetic",
  1716. "syntheticReason": "父模型收到 SendMessage tool result 后结束当前 turn,等待 background notification。"
  1717. },
  1718. "maxMatches": 1,
  1719. "match": {
  1720. "method": "POST",
  1721. "pathIncludes": "/messages",
  1722. "bodyIncludes": [
  1723. "E2E_BACKGROUND_SEND_MESSAGE",
  1724. "E2E_BACKGROUND_SEND_MESSAGE_PAYLOAD",
  1725. "sent to its active turn"
  1726. ],
  1727. "bodyExcludes": [
  1728. "Generate a concise title",
  1729. "CRITICAL: Respond with TEXT ONLY",
  1730. "Verify whether the active session goal"
  1731. ],
  1732. "lastUserMessageExcludes": ["<task-notification>"]
  1733. },
  1734. "response": {
  1735. "statusCode": 200,
  1736. "text": {
  1737. "id": "upstream-e2e-background-send-message-ack",
  1738. "text": "background-send-message-sent-ok"
  1739. }
  1740. }
  1741. },
  1742. {
  1743. "id": "upstream-background-send-child-bash-tool-call",
  1744. "description": "BG07: child Agent starts a long local Bash tool so it can receive SendMessage during an active turn.",
  1745. "metadata": {
  1746. "kind": "subagent",
  1747. "timingPolicy": "fast-tool-use",
  1748. "source": "synthetic",
  1749. "syntheticReason": "子 agent 首轮立即释放 provider 连接,但通过 build mode 可直接允许且不会自动后台化的 sleep foreground Bash 保持 active turn,稳定覆盖 running child steer。"
  1750. },
  1751. "maxMatches": 1,
  1752. "match": {
  1753. "method": "POST",
  1754. "pathIncludes": "/messages",
  1755. "bodyIncludes": ["E2E_BACKGROUND_SEND_MESSAGE_CHILD"],
  1756. "bodyExcludes": [
  1757. "Generate a concise title",
  1758. "CRITICAL: Respond with TEXT ONLY",
  1759. "Verify whether the active session goal"
  1760. ],
  1761. "lastUserMessageIncludes": ["E2E_BACKGROUND_SEND_MESSAGE_CHILD"]
  1762. },
  1763. "response": {
  1764. "statusCode": 200,
  1765. "toolUse": {
  1766. "id": "toolu_e2e_background_send_child_bash",
  1767. "name": "Bash",
  1768. "input": {
  1769. "command": "sleep 8; printf 'E2E_BACKGROUND_SEND_MESSAGE_CHILD_BASH_DONE\\n'",
  1770. "description": "Keep child turn active"
  1771. }
  1772. }
  1773. }
  1774. },
  1775. {
  1776. "id": "upstream-background-send-child-steered-result",
  1777. "description": "BG07: child Agent receives SendMessage as coordinator input.",
  1778. "metadata": {
  1779. "kind": "subagent",
  1780. "timingPolicy": "fast-text",
  1781. "source": "synthetic",
  1782. "syntheticReason": "验证子 agent 的 provider-visible request 收到完整 coordinator 中途提示。 验证来源提示及非用户授权边界。"
  1783. },
  1784. "maxMatches": 1,
  1785. "match": {
  1786. "method": "POST",
  1787. "pathIncludes": "/messages",
  1788. "bodyIncludes": [
  1789. "E2E_BACKGROUND_SEND_MESSAGE_CHILD",
  1790. "E2E_BACKGROUND_SEND_MESSAGE_CHILD_BASH_DONE",
  1791. "The coordinator sent a message while you were working:\nE2E_BACKGROUND_SEND_MESSAGE_STEER",
  1792. "E2E_BACKGROUND_SEND_MESSAGE_PAYLOAD"
  1793. ],
  1794. "bodyExcludes": [
  1795. "Generate a concise title",
  1796. "CRITICAL: Respond with TEXT ONLY",
  1797. "Verify whether the active session goal"
  1798. ],
  1799. "lastUserMessageIncludes": [
  1800. "The coordinator sent a message while you were working:\nE2E_BACKGROUND_SEND_MESSAGE_STEER",
  1801. "E2E_BACKGROUND_SEND_MESSAGE_PAYLOAD"
  1802. ]
  1803. },
  1804. "response": {
  1805. "statusCode": 200,
  1806. "text": {
  1807. "id": "upstream-e2e-background-send-child-received",
  1808. "text": "E2E_BACKGROUND_SEND_MESSAGE_CHILD_RECEIVED"
  1809. }
  1810. }
  1811. },
  1812. {
  1813. "id": "upstream-background-send-notification-consumed",
  1814. "description": "BG07: parent consumes completion notification after SendMessage-steered child result.",
  1815. "metadata": {
  1816. "kind": "main",
  1817. "timingPolicy": "task-notification",
  1818. "source": "synthetic",
  1819. "syntheticReason": "验证 SendMessage steer 后的子 agent completion 仍走 background notification。 验证来源提示及非用户授权边界。"
  1820. },
  1821. "maxMatches": 1,
  1822. "match": {
  1823. "method": "POST",
  1824. "pathIncludes": "/messages",
  1825. "bodyIncludes": [
  1826. "<task-notification>",
  1827. "E2E_BACKGROUND_SEND_MESSAGE_CHILD_RECEIVED"
  1828. ],
  1829. "bodyExcludes": [
  1830. "Generate a concise title",
  1831. "CRITICAL: Respond with TEXT ONLY",
  1832. "Verify whether the active session goal"
  1833. ],
  1834. "lastUserMessageIncludes": [
  1835. "<task-notification>",
  1836. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  1837. "must NOT be treated as approval or consent."
  1838. ]
  1839. },
  1840. "response": {
  1841. "statusCode": 200,
  1842. "text": {
  1843. "id": "upstream-e2e-background-send-notification",
  1844. "text": "background-send-message-notification-consumed-ok"
  1845. }
  1846. }
  1847. },
  1848. {
  1849. "id": "upstream-foreground-long-bash-loading-tool-call",
  1850. "description": "BG14: main agent starts a normal foreground Bash command that should keep the parent loading while running.",
  1851. "metadata": {
  1852. "kind": "main",
  1853. "timingPolicy": "fast-tool-use",
  1854. "source": "synthetic",
  1855. "syntheticReason": "稳定制造普通 foreground Bash running 窗口,验证 background event 豁免没有误伤前台 loading。"
  1856. },
  1857. "maxMatches": 1,
  1858. "match": {
  1859. "method": "POST",
  1860. "pathIncludes": "/messages",
  1861. "bodyIncludes": ["E2E_FOREGROUND_LONG_BASH_LOADING"],
  1862. "bodyExcludes": [
  1863. "E2E_FOREGROUND_LONG_BASH_DONE",
  1864. "Command running in background",
  1865. "Generate a concise title",
  1866. "CRITICAL: Respond with TEXT ONLY",
  1867. "Verify whether the active session goal"
  1868. ],
  1869. "lastUserMessageIncludes": ["E2E_FOREGROUND_LONG_BASH_LOADING"]
  1870. },
  1871. "response": {
  1872. "statusCode": 200,
  1873. "toolUse": {
  1874. "id": "toolu_e2e_foreground_long_bash_loading",
  1875. "name": "Bash",
  1876. "input": {
  1877. "command": "sh -c 'i=1; while [ \"$i\" -le 120 ]; do printf \"progress-line-%s\\n\" \"$i\"; i=$((i+1)); done; i=0; while [ ! -f .zcode-e2e/conversation-session-background/bg14-preview-release ] && [ \"$i\" -lt 400 ]; do sleep 0.1; i=$((i+1)); done; i=0; while [ \"$i\" -lt 4000 ]; do printf \"padding-%s\\n\" \"$i\"; i=$((i+1)); done; printf \"E2E_FOREGROUND_LONG_BASH_DONE\\n\"'",
  1878. "description": "foreground long bash loading sleep"
  1879. }
  1880. }
  1881. }
  1882. },
  1883. {
  1884. "id": "upstream-foreground-long-bash-loading-completed",
  1885. "description": "BG14: parent continues after the normal foreground Bash command completes.",
  1886. "metadata": {
  1887. "kind": "main",
  1888. "timingPolicy": "fast-text",
  1889. "source": "synthetic",
  1890. "syntheticReason": "验证 foreground Bash 完成后仍正常进入 provider continuation 并回到 idle。"
  1891. },
  1892. "maxMatches": 1,
  1893. "match": {
  1894. "method": "POST",
  1895. "pathIncludes": "/messages",
  1896. "bodyIncludes": ["E2E_FOREGROUND_LONG_BASH_LOADING", "<persisted-output>"],
  1897. "bodyExcludes": [
  1898. "Command running in background",
  1899. "Generate a concise title",
  1900. "CRITICAL: Respond with TEXT ONLY",
  1901. "Verify whether the active session goal"
  1902. ],
  1903. "lastUserMessageExcludes": ["<task-notification>"]
  1904. },
  1905. "response": {
  1906. "statusCode": 200,
  1907. "text": {
  1908. "id": "upstream-e2e-foreground-long-bash-loading-completed",
  1909. "text": "foreground-long-bash-loading-completed-ok"
  1910. }
  1911. }
  1912. },
  1913. {
  1914. "id": "upstream-foreground-child-tool-streaming-agent-tool-call",
  1915. "description": "BG13: main agent launches a foreground Agent whose child tool updates should keep the parent streaming.",
  1916. "metadata": {
  1917. "kind": "main",
  1918. "timingPolicy": "fast-tool-use",
  1919. "source": "synthetic",
  1920. "syntheticReason": "稳定触发 foreground Agent,让 child Bash 运行期间验证 parent loading 仍按原语义显示。"
  1921. },
  1922. "maxMatches": 1,
  1923. "match": {
  1924. "method": "POST",
  1925. "pathIncludes": "/messages",
  1926. "bodyIncludes": ["E2E_FOREGROUND_AGENT_CHILD_TOOL_STREAMING_STATUS"],
  1927. "bodyExcludes": [
  1928. "E2E_FOREGROUND_AGENT_CHILD_TOOL_DONE",
  1929. "Generate a concise title",
  1930. "CRITICAL: Respond with TEXT ONLY",
  1931. "Verify whether the active session goal"
  1932. ],
  1933. "lastUserMessageIncludes": ["E2E_FOREGROUND_AGENT_CHILD_TOOL_STREAMING_STATUS"]
  1934. },
  1935. "response": {
  1936. "statusCode": 200,
  1937. "toolUse": {
  1938. "id": "toolu_e2e_foreground_child_tool_agent",
  1939. "name": "Agent",
  1940. "input": {
  1941. "description": "E2E foreground child tool streaming",
  1942. "prompt": "E2E_FOREGROUND_AGENT_CHILD_TOOL_STREAMING: Run Bash with description foreground child visible bash sleep, then reply exactly E2E_FOREGROUND_AGENT_CHILD_TOOL_DONE."
  1943. }
  1944. }
  1945. }
  1946. },
  1947. {
  1948. "id": "upstream-foreground-child-tool-streaming-child-bash-tool-call",
  1949. "description": "BG13: foreground child Agent starts a visible foreground Bash tool while parent remains running.",
  1950. "metadata": {
  1951. "kind": "subagent",
  1952. "timingPolicy": "fast-tool-use",
  1953. "source": "synthetic",
  1954. "syntheticReason": "用真实 child Bash tool update 覆盖 foreground mirrored subagent event 的 streaming 保留分支。"
  1955. },
  1956. "maxMatches": 1,
  1957. "match": {
  1958. "method": "POST",
  1959. "pathIncludes": "/messages",
  1960. "bodyIncludes": ["E2E_FOREGROUND_AGENT_CHILD_TOOL_STREAMING"],
  1961. "bodyExcludes": [
  1962. "E2E_FOREGROUND_AGENT_CHILD_TOOL_BASH_DONE",
  1963. "Generate a concise title",
  1964. "CRITICAL: Respond with TEXT ONLY",
  1965. "Verify whether the active session goal"
  1966. ],
  1967. "lastUserMessageExcludes": ["<task-notification>"],
  1968. "lastUserMessageIncludes": ["E2E_FOREGROUND_AGENT_CHILD_TOOL_STREAMING"]
  1969. },
  1970. "response": {
  1971. "statusCode": 200,
  1972. "toolUse": {
  1973. "id": "toolu_e2e_foreground_child_tool_bash",
  1974. "name": "Bash",
  1975. "input": {
  1976. "command": "sh -c 'sleep 4; printf \"E2E_FOREGROUND_AGENT_CHILD_TOOL_BASH_DONE\\n\"'",
  1977. "description": "foreground child visible bash sleep"
  1978. }
  1979. }
  1980. }
  1981. },
  1982. {
  1983. "id": "upstream-foreground-child-tool-streaming-child-done",
  1984. "description": "BG13: foreground child Agent completes after the visible Bash tool finishes.",
  1985. "metadata": {
  1986. "kind": "subagent",
  1987. "timingPolicy": "fast-text",
  1988. "source": "synthetic",
  1989. "syntheticReason": "让 foreground Agent 正常完成并把结果回传父 turn。"
  1990. },
  1991. "maxMatches": 1,
  1992. "match": {
  1993. "method": "POST",
  1994. "pathIncludes": "/messages",
  1995. "bodyIncludes": [
  1996. "E2E_FOREGROUND_AGENT_CHILD_TOOL_STREAMING",
  1997. "E2E_FOREGROUND_AGENT_CHILD_TOOL_BASH_DONE"
  1998. ],
  1999. "bodyExcludes": [
  2000. "Generate a concise title",
  2001. "CRITICAL: Respond with TEXT ONLY",
  2002. "Verify whether the active session goal"
  2003. ],
  2004. "lastUserMessageExcludes": ["<task-notification>"]
  2005. },
  2006. "response": {
  2007. "statusCode": 200,
  2008. "text": {
  2009. "id": "upstream-e2e-foreground-child-tool-streaming-child-done",
  2010. "text": "E2E_FOREGROUND_AGENT_CHILD_TOOL_DONE"
  2011. }
  2012. }
  2013. },
  2014. {
  2015. "id": "upstream-foreground-child-tool-streaming-completed",
  2016. "description": "BG13: parent consumes the foreground Agent result and completes.",
  2017. "metadata": {
  2018. "kind": "main",
  2019. "timingPolicy": "fast-text",
  2020. "source": "synthetic",
  2021. "syntheticReason": "验证 foreground subagent child tool running 窗口后,父 turn 正常收口。"
  2022. },
  2023. "maxMatches": 1,
  2024. "match": {
  2025. "method": "POST",
  2026. "pathIncludes": "/messages",
  2027. "bodyIncludes": [
  2028. "E2E_FOREGROUND_AGENT_CHILD_TOOL_STREAMING_STATUS",
  2029. "E2E_FOREGROUND_AGENT_CHILD_TOOL_DONE"
  2030. ],
  2031. "bodyExcludes": [
  2032. "Generate a concise title",
  2033. "CRITICAL: Respond with TEXT ONLY",
  2034. "Verify whether the active session goal"
  2035. ],
  2036. "lastUserMessageExcludes": ["<task-notification>"]
  2037. },
  2038. "response": {
  2039. "statusCode": 200,
  2040. "text": {
  2041. "id": "upstream-e2e-foreground-child-tool-streaming-completed",
  2042. "text": "foreground-agent-child-tool-streaming-completed-ok"
  2043. }
  2044. }
  2045. },
  2046. {
  2047. "id": "upstream-background-child-tool-idle-agent-tool-call",
  2048. "description": "BG13: main agent launches a background Agent whose child tool updates should not mark the parent idle turn as streaming.",
  2049. "metadata": {
  2050. "kind": "main",
  2051. "timingPolicy": "fast-tool-use",
  2052. "source": "synthetic",
  2053. "syntheticReason": "稳定触发 background Agent,让 child Bash 运行期间验证 parent idle UI 不显示 fake loading。"
  2054. },
  2055. "maxMatches": 1,
  2056. "match": {
  2057. "method": "POST",
  2058. "pathIncludes": "/messages",
  2059. "bodyIncludes": [
  2060. "E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE_STATUS: Launch a background agent that runs a visible child Bash tool while the parent conversation is idle."
  2061. ],
  2062. "bodyExcludes": [
  2063. "Async agent launched successfully",
  2064. "agentId: agent_",
  2065. "Generate a concise title",
  2066. "CRITICAL: Respond with TEXT ONLY",
  2067. "Verify whether the active session goal"
  2068. ],
  2069. "lastUserMessageIncludes": [
  2070. "E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE_STATUS: Launch a background agent that runs a visible child Bash tool while the parent conversation is idle."
  2071. ]
  2072. },
  2073. "response": {
  2074. "statusCode": 200,
  2075. "toolUse": {
  2076. "id": "toolu_e2e_background_idle_child_tool_agent",
  2077. "name": "Agent",
  2078. "input": {
  2079. "description": "E2E background child tool idle",
  2080. "prompt": "E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE: Run Bash with description background idle child visible bash sleep, then reply exactly E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE_DONE.",
  2081. "run_in_background": true
  2082. }
  2083. }
  2084. }
  2085. },
  2086. {
  2087. "id": "upstream-background-child-tool-idle-agent-launch-ack",
  2088. "description": "BG13: parent finishes launch turn while child Agent continues running a local tool.",
  2089. "metadata": {
  2090. "kind": "main",
  2091. "timingPolicy": "fast-text",
  2092. "source": "synthetic",
  2093. "syntheticReason": "父模型在 async Agent launch tool result 后结束当前 turn,制造 parent idle + child tool running 窗口。"
  2094. },
  2095. "maxMatches": 1,
  2096. "match": {
  2097. "method": "POST",
  2098. "pathIncludes": "/messages",
  2099. "bodyIncludes": [
  2100. "E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE_STATUS",
  2101. "Async agent launched successfully"
  2102. ],
  2103. "bodyExcludes": [
  2104. "Generate a concise title",
  2105. "CRITICAL: Respond with TEXT ONLY",
  2106. "Verify whether the active session goal"
  2107. ]
  2108. },
  2109. "response": {
  2110. "statusCode": 200,
  2111. "text": {
  2112. "id": "upstream-e2e-background-child-tool-idle-launch-ack",
  2113. "text": "background-agent-child-tool-idle-launched-ok"
  2114. }
  2115. }
  2116. },
  2117. {
  2118. "id": "upstream-background-child-tool-idle-child-bash-tool-call",
  2119. "description": "BG13: child Agent starts a visible foreground Bash tool while parent remains idle.",
  2120. "metadata": {
  2121. "kind": "subagent",
  2122. "timingPolicy": "fast-tool-use",
  2123. "source": "synthetic",
  2124. "syntheticReason": "用真实 child Bash tool update 覆盖 mirrored background subagent event 的 UI streaming 保护。"
  2125. },
  2126. "maxMatches": 1,
  2127. "match": {
  2128. "method": "POST",
  2129. "pathIncludes": "/messages",
  2130. "bodyIncludes": ["E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE"],
  2131. "bodyExcludes": [
  2132. "E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE_BASH_DONE",
  2133. "Generate a concise title",
  2134. "CRITICAL: Respond with TEXT ONLY",
  2135. "Verify whether the active session goal"
  2136. ],
  2137. "lastUserMessageExcludes": ["<task-notification>"],
  2138. "lastUserMessageIncludes": ["E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE"]
  2139. },
  2140. "response": {
  2141. "statusCode": 200,
  2142. "toolUse": {
  2143. "id": "toolu_e2e_background_idle_child_tool_bash",
  2144. "name": "Bash",
  2145. "input": {
  2146. "command": "sh -c 'while [ ! -f \".zcode-e2e/conversation-session-background/background-child-tool-idle-release\" ]; do sleep 0.1; done; printf \"E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE_BASH_DONE\\n\"'",
  2147. "description": "background idle child visible bash sleep"
  2148. }
  2149. }
  2150. }
  2151. },
  2152. {
  2153. "id": "upstream-background-child-tool-idle-child-done",
  2154. "description": "BG13: child Agent completes after the visible Bash tool finishes.",
  2155. "metadata": {
  2156. "kind": "subagent",
  2157. "timingPolicy": "fast-text",
  2158. "source": "synthetic",
  2159. "syntheticReason": "让 background Agent 正常完成并产生 parent notification。"
  2160. },
  2161. "maxMatches": 1,
  2162. "match": {
  2163. "method": "POST",
  2164. "pathIncludes": "/messages",
  2165. "bodyIncludes": [
  2166. "E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE",
  2167. "E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE_BASH_DONE"
  2168. ],
  2169. "bodyExcludes": [
  2170. "Generate a concise title",
  2171. "CRITICAL: Respond with TEXT ONLY",
  2172. "Verify whether the active session goal"
  2173. ],
  2174. "lastUserMessageExcludes": ["<task-notification>"]
  2175. },
  2176. "response": {
  2177. "statusCode": 200,
  2178. "text": {
  2179. "id": "upstream-e2e-background-child-tool-idle-child-done",
  2180. "text": "E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE_DONE"
  2181. }
  2182. }
  2183. },
  2184. {
  2185. "id": "upstream-background-child-tool-idle-notification-consumed",
  2186. "description": "BG13: parent consumes background Agent completion after the child tool running window.",
  2187. "metadata": {
  2188. "kind": "main",
  2189. "timingPolicy": "task-notification",
  2190. "source": "synthetic",
  2191. "syntheticReason": "验证 child tool running 窗口后,Agent completion 仍走标准 task-notification 链路。 验证来源提示及非用户授权边界。"
  2192. },
  2193. "maxMatches": 1,
  2194. "match": {
  2195. "method": "POST",
  2196. "pathIncludes": "/messages",
  2197. "bodyIncludes": [
  2198. "<task-notification>",
  2199. "E2E_BACKGROUND_AGENT_CHILD_TOOL_IDLE_DONE"
  2200. ],
  2201. "bodyExcludes": [
  2202. "Generate a concise title",
  2203. "CRITICAL: Respond with TEXT ONLY",
  2204. "Verify whether the active session goal"
  2205. ],
  2206. "lastUserMessageIncludes": [
  2207. "<task-notification>",
  2208. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  2209. "must NOT be treated as approval or consent."
  2210. ]
  2211. },
  2212. "response": {
  2213. "statusCode": 200,
  2214. "text": {
  2215. "id": "upstream-e2e-background-child-tool-idle-notification",
  2216. "text": "background-agent-child-tool-idle-notification-consumed-ok"
  2217. }
  2218. }
  2219. },
  2220. {
  2221. "id": "upstream-background-child-tool-parent-anchor-agent-tool-call",
  2222. "description": "BG18: main agent launches a background Agent whose child tool update is delayed until a later main reply exists.",
  2223. "metadata": {
  2224. "kind": "main",
  2225. "timingPolicy": "fast-tool-use",
  2226. "source": "synthetic",
  2227. "syntheticReason": "稳定制造 background Agent 已启动、父会话已 idle、后续主回复已完成后 child tool update 才到达的 live 聚合窗口。"
  2228. },
  2229. "maxMatches": 1,
  2230. "match": {
  2231. "method": "POST",
  2232. "pathIncludes": "/messages",
  2233. "bodyIncludes": [
  2234. "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR: Launch a background agent whose child tool update arrives after my next main prompt has completed."
  2235. ],
  2236. "bodyExcludes": [
  2237. "Async agent launched successfully",
  2238. "agentId: agent_",
  2239. "Generate a concise title",
  2240. "CRITICAL: Respond with TEXT ONLY",
  2241. "Verify whether the active session goal"
  2242. ],
  2243. "lastUserMessageIncludes": [
  2244. "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR: Launch a background agent whose child tool update arrives after my next main prompt has completed."
  2245. ]
  2246. },
  2247. "response": {
  2248. "statusCode": 200,
  2249. "toolUse": {
  2250. "id": "toolu_e2e_background_parent_anchor_agent",
  2251. "name": "Agent",
  2252. "input": {
  2253. "description": "E2E background child tool parent anchor",
  2254. "prompt": "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_CHILD: Wait briefly, run Bash with description background parent anchor child visible bash sleep, then reply exactly E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_CHILD_DONE.",
  2255. "run_in_background": true
  2256. }
  2257. }
  2258. }
  2259. },
  2260. {
  2261. "id": "upstream-background-child-tool-parent-anchor-launch-ack",
  2262. "description": "BG18: parent finishes the launch turn while child Agent remains running.",
  2263. "metadata": {
  2264. "kind": "main",
  2265. "timingPolicy": "fast-text",
  2266. "source": "synthetic",
  2267. "syntheticReason": "让父会话先回 idle,随后用户可发送第二条主消息。"
  2268. },
  2269. "maxMatches": 1,
  2270. "match": {
  2271. "method": "POST",
  2272. "pathIncludes": "/messages",
  2273. "bodyIncludes": [
  2274. "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR",
  2275. "Async agent launched successfully"
  2276. ],
  2277. "bodyExcludes": [
  2278. "Generate a concise title",
  2279. "CRITICAL: Respond with TEXT ONLY",
  2280. "Verify whether the active session goal"
  2281. ]
  2282. },
  2283. "response": {
  2284. "statusCode": 200,
  2285. "text": {
  2286. "id": "upstream-e2e-background-child-tool-parent-anchor-launch-ack",
  2287. "text": "background-child-tool-parent-anchor-launched-ok"
  2288. }
  2289. }
  2290. },
  2291. {
  2292. "id": "upstream-background-child-tool-parent-anchor-follow-up",
  2293. "description": "BG18: a later main prompt completes while the background child tool response is still delayed.",
  2294. "metadata": {
  2295. "kind": "main",
  2296. "timingPolicy": "fast-text",
  2297. "source": "synthetic",
  2298. "syntheticReason": "在 child tool update 到达前创建新的主 assistant 回复,用来复现 live child tool 被错误挂到最新回复下的问题。"
  2299. },
  2300. "maxMatches": 1,
  2301. "match": {
  2302. "method": "POST",
  2303. "pathIncludes": "/messages",
  2304. "bodyIncludes": ["E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_FOLLOWUP"],
  2305. "bodyExcludes": [
  2306. "Generate a concise title",
  2307. "CRITICAL: Respond with TEXT ONLY",
  2308. "Verify whether the active session goal"
  2309. ],
  2310. "lastUserMessageExcludes": ["<task-notification>"],
  2311. "lastUserMessageIncludes": [
  2312. "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_FOLLOWUP"
  2313. ]
  2314. },
  2315. "response": {
  2316. "statusCode": 200,
  2317. "text": {
  2318. "id": "upstream-e2e-background-child-tool-parent-anchor-follow-up",
  2319. "text": "background-child-tool-parent-anchor-main-followup-ok"
  2320. }
  2321. }
  2322. },
  2323. {
  2324. "id": "upstream-background-child-tool-parent-anchor-child-bash-tool-call",
  2325. "description": "BG18: child Agent starts a visible Bash tool after the later main reply already exists.",
  2326. "metadata": {
  2327. "kind": "subagent",
  2328. "timingPolicy": "delayed-tool-use",
  2329. "source": "synthetic",
  2330. "syntheticReason": "延迟 child Bash tool_use,稳定验证 mirrored child tool update 必须按 parentToolUseId 回挂原 Agent message。"
  2331. },
  2332. "maxMatches": 1,
  2333. "match": {
  2334. "method": "POST",
  2335. "pathIncludes": "/messages",
  2336. "bodyIncludes": ["E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_CHILD"],
  2337. "bodyExcludes": [
  2338. "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_BASH_DONE",
  2339. "Generate a concise title",
  2340. "CRITICAL: Respond with TEXT ONLY",
  2341. "Verify whether the active session goal"
  2342. ],
  2343. "lastUserMessageExcludes": ["<task-notification>"],
  2344. "lastUserMessageIncludes": ["E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_CHILD"]
  2345. },
  2346. "response": {
  2347. "statusCode": 200,
  2348. "delayMs": 6000,
  2349. "toolUse": {
  2350. "id": "toolu_e2e_background_parent_anchor_child_bash",
  2351. "name": "Bash",
  2352. "input": {
  2353. "command": "sh -c 'while [ ! -f \".zcode-e2e/conversation-session-background/background-parent-anchor-release\" ]; do sleep 0.1; done; printf \"E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_BASH_DONE\\n\"'",
  2354. "description": "background parent anchor child visible bash sleep"
  2355. }
  2356. }
  2357. }
  2358. },
  2359. {
  2360. "id": "upstream-background-child-tool-parent-anchor-child-done",
  2361. "description": "BG18: child Agent completes after its visible Bash tool finishes.",
  2362. "metadata": {
  2363. "kind": "subagent",
  2364. "timingPolicy": "fast-text",
  2365. "source": "synthetic",
  2366. "syntheticReason": "让 background Agent 正常完成并产生 parent notification。"
  2367. },
  2368. "maxMatches": 1,
  2369. "match": {
  2370. "method": "POST",
  2371. "pathIncludes": "/messages",
  2372. "bodyIncludes": [
  2373. "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_CHILD",
  2374. "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_BASH_DONE"
  2375. ],
  2376. "bodyExcludes": [
  2377. "Generate a concise title",
  2378. "CRITICAL: Respond with TEXT ONLY",
  2379. "Verify whether the active session goal"
  2380. ],
  2381. "lastUserMessageExcludes": ["<task-notification>"]
  2382. },
  2383. "response": {
  2384. "statusCode": 200,
  2385. "text": {
  2386. "id": "upstream-e2e-background-child-tool-parent-anchor-child-done",
  2387. "text": "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_CHILD_DONE"
  2388. }
  2389. }
  2390. },
  2391. {
  2392. "id": "upstream-background-child-tool-parent-anchor-notification-consumed",
  2393. "description": "BG18: parent consumes background Agent completion after the parented child tool placement assertion.",
  2394. "metadata": {
  2395. "kind": "main",
  2396. "timingPolicy": "task-notification",
  2397. "source": "synthetic",
  2398. "syntheticReason": "验证 child tool placement 修复不影响标准 task-notification 收口。 验证来源提示及非用户授权边界。"
  2399. },
  2400. "maxMatches": 1,
  2401. "match": {
  2402. "method": "POST",
  2403. "pathIncludes": "/messages",
  2404. "bodyIncludes": [
  2405. "<task-notification>",
  2406. "E2E_BACKGROUND_CHILD_TOOL_PARENT_ANCHOR_CHILD_DONE"
  2407. ],
  2408. "bodyExcludes": [
  2409. "Generate a concise title",
  2410. "CRITICAL: Respond with TEXT ONLY",
  2411. "Verify whether the active session goal"
  2412. ],
  2413. "lastUserMessageIncludes": [
  2414. "<task-notification>",
  2415. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  2416. "must NOT be treated as approval or consent."
  2417. ]
  2418. },
  2419. "response": {
  2420. "statusCode": 200,
  2421. "text": {
  2422. "id": "upstream-e2e-background-child-tool-parent-anchor-notification",
  2423. "text": "background-child-tool-parent-anchor-notification-consumed-ok"
  2424. }
  2425. }
  2426. },
  2427. {
  2428. "id": "upstream-background-session-switch-agent-tool-call",
  2429. "description": "BG21: main agent launches a background Agent whose child Bash completes while the user is viewing another session.",
  2430. "metadata": {
  2431. "kind": "main",
  2432. "timingPolicy": "fast-tool-use",
  2433. "source": "synthetic",
  2434. "syntheticReason": "稳定制造 background Agent + child Bash tool 已出现,随后切走父 session 的窗口。"
  2435. },
  2436. "maxMatches": 1,
  2437. "match": {
  2438. "method": "POST",
  2439. "pathIncludes": "/messages",
  2440. "bodyIncludes": [
  2441. "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH: Launch a background agent whose child Bash completes while I am viewing another session."
  2442. ],
  2443. "bodyExcludes": [
  2444. "Async agent launched successfully",
  2445. "agentId: agent_",
  2446. "Generate a concise title",
  2447. "CRITICAL: Respond with TEXT ONLY",
  2448. "Verify whether the active session goal"
  2449. ],
  2450. "lastUserMessageIncludes": [
  2451. "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH: Launch a background agent whose child Bash completes while I am viewing another session."
  2452. ]
  2453. },
  2454. "response": {
  2455. "statusCode": 200,
  2456. "toolUse": {
  2457. "id": "toolu_e2e_background_session_switch_agent",
  2458. "name": "Agent",
  2459. "input": {
  2460. "description": "E2E background session switch child tool",
  2461. "prompt": "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_CHILD: Run Bash with description background session switch child visible bash, then reply exactly E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_CHILD_DONE.",
  2462. "run_in_background": true
  2463. }
  2464. }
  2465. }
  2466. },
  2467. {
  2468. "id": "upstream-background-session-switch-launch-ack",
  2469. "description": "BG21: parent finishes launch turn while child Agent remains running.",
  2470. "metadata": {
  2471. "kind": "main",
  2472. "timingPolicy": "fast-text",
  2473. "source": "synthetic",
  2474. "syntheticReason": "让父会话先回 idle,随后测试切到其他 session/draft。"
  2475. },
  2476. "maxMatches": 1,
  2477. "match": {
  2478. "method": "POST",
  2479. "pathIncludes": "/messages",
  2480. "bodyIncludes": [
  2481. "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH",
  2482. "Async agent launched successfully"
  2483. ],
  2484. "bodyExcludes": [
  2485. "Generate a concise title",
  2486. "CRITICAL: Respond with TEXT ONLY",
  2487. "Verify whether the active session goal"
  2488. ]
  2489. },
  2490. "response": {
  2491. "statusCode": 200,
  2492. "text": {
  2493. "id": "upstream-e2e-background-session-switch-launch-ack",
  2494. "text": "background-session-switch-launched-ok"
  2495. }
  2496. }
  2497. },
  2498. {
  2499. "id": "upstream-background-session-switch-child-bash-tool-call",
  2500. "description": "BG21: child Agent starts a visible Bash tool before the parent session is hidden.",
  2501. "metadata": {
  2502. "kind": "subagent",
  2503. "timingPolicy": "delayed-tool-use",
  2504. "source": "synthetic",
  2505. "syntheticReason": "先让 child Bash running card 进入父 renderer store;命令等待文件 barrier,由测试在父 session 隐藏后释放。"
  2506. },
  2507. "maxMatches": 1,
  2508. "match": {
  2509. "method": "POST",
  2510. "pathIncludes": "/messages",
  2511. "bodyIncludes": ["E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_CHILD"],
  2512. "bodyExcludes": [
  2513. "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_BASH_DONE",
  2514. "Generate a concise title",
  2515. "CRITICAL: Respond with TEXT ONLY",
  2516. "Verify whether the active session goal"
  2517. ],
  2518. "lastUserMessageExcludes": ["<task-notification>"],
  2519. "lastUserMessageIncludes": [
  2520. "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_CHILD"
  2521. ]
  2522. },
  2523. "response": {
  2524. "statusCode": 200,
  2525. "delayMs": 500,
  2526. "toolUse": {
  2527. "id": "toolu_e2e_background_session_switch_child_bash",
  2528. "name": "Bash",
  2529. "input": {
  2530. "command": "sh -c 'while [ ! -f .zcode-e2e/conversation-session-background/bg21-child-tool-release ]; do sleep 0.1; done; printf \"E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_BASH_DONE\\n\"'",
  2531. "description": "background session switch child visible bash"
  2532. }
  2533. }
  2534. }
  2535. },
  2536. {
  2537. "id": "upstream-background-session-switch-child-done",
  2538. "description": "BG21: child Agent completes after Bash finishes while the parent session is hidden.",
  2539. "metadata": {
  2540. "kind": "subagent",
  2541. "timingPolicy": "fast-text",
  2542. "source": "synthetic",
  2543. "syntheticReason": "让 hidden/tombstoned terminal tool update 和 Agent completion notification 都完成。"
  2544. },
  2545. "maxMatches": 1,
  2546. "match": {
  2547. "method": "POST",
  2548. "pathIncludes": "/messages",
  2549. "bodyIncludes": [
  2550. "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_CHILD",
  2551. "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_BASH_DONE"
  2552. ],
  2553. "bodyExcludes": [
  2554. "Generate a concise title",
  2555. "CRITICAL: Respond with TEXT ONLY",
  2556. "Verify whether the active session goal"
  2557. ],
  2558. "lastUserMessageExcludes": ["<task-notification>"]
  2559. },
  2560. "response": {
  2561. "statusCode": 200,
  2562. "text": {
  2563. "id": "upstream-e2e-background-session-switch-child-done",
  2564. "text": "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_CHILD_DONE"
  2565. }
  2566. }
  2567. },
  2568. {
  2569. "id": "upstream-background-session-switch-notification-consumed",
  2570. "description": "BG21: parent consumes completion notification while the task is not active.",
  2571. "metadata": {
  2572. "kind": "main",
  2573. "timingPolicy": "task-notification",
  2574. "source": "synthetic",
  2575. "syntheticReason": "验证切回后 UI 从 store/snapshot 恢复 terminal child tool 投影。 验证来源提示及非用户授权边界。"
  2576. },
  2577. "maxMatches": 1,
  2578. "match": {
  2579. "method": "POST",
  2580. "pathIncludes": "/messages",
  2581. "bodyIncludes": [
  2582. "<task-notification>",
  2583. "E2E_BACKGROUND_CHILD_TOOL_SESSION_SWITCH_CHILD_DONE"
  2584. ],
  2585. "bodyExcludes": [
  2586. "Generate a concise title",
  2587. "CRITICAL: Respond with TEXT ONLY",
  2588. "Verify whether the active session goal"
  2589. ],
  2590. "lastUserMessageIncludes": [
  2591. "<task-notification>",
  2592. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  2593. "must NOT be treated as approval or consent."
  2594. ]
  2595. },
  2596. "response": {
  2597. "statusCode": 200,
  2598. "text": {
  2599. "id": "upstream-e2e-background-session-switch-notification",
  2600. "text": "background-session-switch-notification-consumed-ok"
  2601. }
  2602. }
  2603. },
  2604. {
  2605. "id": "upstream-background-switch-back-running-agent-tool-call",
  2606. "description": "BG22: main agent launches a background Agent whose child Bash is still running when the user switches back.",
  2607. "metadata": {
  2608. "kind": "main",
  2609. "timingPolicy": "fast-tool-use",
  2610. "source": "synthetic",
  2611. "syntheticReason": "稳定制造 background Agent + child Bash tool 已出现且切回时仍 running 的窗口。"
  2612. },
  2613. "maxMatches": 1,
  2614. "match": {
  2615. "method": "POST",
  2616. "pathIncludes": "/messages",
  2617. "bodyIncludes": [
  2618. "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING: Launch a background agent whose child Bash is still running when I switch back."
  2619. ],
  2620. "bodyExcludes": [
  2621. "Async agent launched successfully",
  2622. "agentId: agent_",
  2623. "Generate a concise title",
  2624. "CRITICAL: Respond with TEXT ONLY",
  2625. "Verify whether the active session goal"
  2626. ],
  2627. "lastUserMessageIncludes": [
  2628. "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING: Launch a background agent whose child Bash is still running when I switch back."
  2629. ]
  2630. },
  2631. "response": {
  2632. "statusCode": 200,
  2633. "toolUse": {
  2634. "id": "toolu_e2e_background_switch_back_running_agent",
  2635. "name": "Agent",
  2636. "input": {
  2637. "description": "E2E background switch back running child tool",
  2638. "prompt": "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_CHILD: Run Bash with description background switch back running child visible bash, then reply exactly E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_CHILD_DONE.",
  2639. "run_in_background": true
  2640. }
  2641. }
  2642. }
  2643. },
  2644. {
  2645. "id": "upstream-background-switch-back-running-launch-ack",
  2646. "description": "BG22: parent finishes launch turn while child Agent remains running.",
  2647. "metadata": {
  2648. "kind": "main",
  2649. "timingPolicy": "fast-text",
  2650. "source": "synthetic",
  2651. "syntheticReason": "让父会话先回 idle,随后测试切到其他 session/draft 后立即切回。"
  2652. },
  2653. "maxMatches": 1,
  2654. "match": {
  2655. "method": "POST",
  2656. "pathIncludes": "/messages",
  2657. "bodyIncludes": [
  2658. "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING",
  2659. "Async agent launched successfully"
  2660. ],
  2661. "bodyExcludes": [
  2662. "Generate a concise title",
  2663. "CRITICAL: Respond with TEXT ONLY",
  2664. "Verify whether the active session goal"
  2665. ]
  2666. },
  2667. "response": {
  2668. "statusCode": 200,
  2669. "text": {
  2670. "id": "upstream-e2e-background-switch-back-running-launch-ack",
  2671. "text": "background-switch-back-running-launched-ok"
  2672. }
  2673. }
  2674. },
  2675. {
  2676. "id": "upstream-background-switch-back-running-child-bash-tool-call",
  2677. "description": "BG22: child Agent starts a visible Bash tool that is still running when the parent session is selected again.",
  2678. "metadata": {
  2679. "kind": "subagent",
  2680. "timingPolicy": "delayed-tool-use",
  2681. "source": "synthetic",
  2682. "syntheticReason": "先让 child Bash running card 进入父 renderer store,并保持足够长时间覆盖切回时仍 running 的窗口。"
  2683. },
  2684. "maxMatches": 1,
  2685. "match": {
  2686. "method": "POST",
  2687. "pathIncludes": "/messages",
  2688. "bodyIncludes": ["E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_CHILD"],
  2689. "bodyExcludes": [
  2690. "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_BASH_DONE",
  2691. "Generate a concise title",
  2692. "CRITICAL: Respond with TEXT ONLY",
  2693. "Verify whether the active session goal"
  2694. ],
  2695. "lastUserMessageExcludes": ["<task-notification>"],
  2696. "lastUserMessageIncludes": [
  2697. "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_CHILD"
  2698. ]
  2699. },
  2700. "response": {
  2701. "statusCode": 200,
  2702. "delayMs": 500,
  2703. "toolUse": {
  2704. "id": "toolu_e2e_background_switch_back_running_child_bash",
  2705. "name": "Bash",
  2706. "input": {
  2707. "command": "sh -c 'while [ ! -f \".zcode-e2e/conversation-session-background/background-switch-back-release\" ]; do sleep 0.1; done; printf \"E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_BASH_DONE\\n\"'",
  2708. "description": "background switch back running child visible bash"
  2709. }
  2710. }
  2711. }
  2712. },
  2713. {
  2714. "id": "upstream-background-switch-back-running-child-done",
  2715. "description": "BG22: child Agent completes after Bash finishes while the parent session is visible again.",
  2716. "metadata": {
  2717. "kind": "subagent",
  2718. "timingPolicy": "fast-text",
  2719. "source": "synthetic",
  2720. "syntheticReason": "验证切回可见状态后 child Bash terminal update 仍会 patch 同一 tool card。"
  2721. },
  2722. "maxMatches": 1,
  2723. "match": {
  2724. "method": "POST",
  2725. "pathIncludes": "/messages",
  2726. "bodyIncludes": [
  2727. "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_CHILD",
  2728. "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_BASH_DONE"
  2729. ],
  2730. "bodyExcludes": [
  2731. "Generate a concise title",
  2732. "CRITICAL: Respond with TEXT ONLY",
  2733. "Verify whether the active session goal"
  2734. ],
  2735. "lastUserMessageExcludes": ["<task-notification>"]
  2736. },
  2737. "response": {
  2738. "statusCode": 200,
  2739. "text": {
  2740. "id": "upstream-e2e-background-switch-back-running-child-done",
  2741. "text": "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_CHILD_DONE"
  2742. }
  2743. }
  2744. },
  2745. {
  2746. "id": "upstream-background-switch-back-running-notification-consumed",
  2747. "description": "BG22: parent consumes completion notification after the user has switched back.",
  2748. "metadata": {
  2749. "kind": "main",
  2750. "timingPolicy": "task-notification",
  2751. "source": "synthetic",
  2752. "syntheticReason": "验证切回后后续 Agent completion notification 仍按标准链路消费。 验证来源提示及非用户授权边界。"
  2753. },
  2754. "maxMatches": 1,
  2755. "match": {
  2756. "method": "POST",
  2757. "pathIncludes": "/messages",
  2758. "bodyIncludes": [
  2759. "<task-notification>",
  2760. "E2E_BACKGROUND_CHILD_TOOL_SWITCH_BACK_RUNNING_CHILD_DONE"
  2761. ],
  2762. "bodyExcludes": [
  2763. "Generate a concise title",
  2764. "CRITICAL: Respond with TEXT ONLY",
  2765. "Verify whether the active session goal"
  2766. ],
  2767. "lastUserMessageIncludes": [
  2768. "<task-notification>",
  2769. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  2770. "must NOT be treated as approval or consent."
  2771. ]
  2772. },
  2773. "response": {
  2774. "statusCode": 200,
  2775. "text": {
  2776. "id": "upstream-e2e-background-switch-back-running-notification",
  2777. "text": "background-switch-back-running-notification-consumed-ok"
  2778. }
  2779. }
  2780. },
  2781. {
  2782. "id": "upstream-background-send-now-queue-agent-tool-call",
  2783. "description": "BG16: main agent launches a background Agent whose child tool keeps raw runtime streaming while main is idle.",
  2784. "metadata": {
  2785. "kind": "main",
  2786. "timingPolicy": "fast-tool-use",
  2787. "source": "synthetic",
  2788. "syntheticReason": "稳定制造 main idle + background-only child tool running + held queue 的窗口,复现 queued prompt Send now 不应 stop background task。"
  2789. },
  2790. "maxMatches": 1,
  2791. "match": {
  2792. "method": "POST",
  2793. "pathIncludes": "/messages",
  2794. "bodyIncludes": [
  2795. "E2E_BACKGROUND_SEND_NOW_QUEUE: Launch a background agent with a visible child Bash tool, then wait."
  2796. ],
  2797. "bodyExcludes": [
  2798. "Async agent launched successfully",
  2799. "agentId: agent_",
  2800. "Generate a concise title",
  2801. "CRITICAL: Respond with TEXT ONLY",
  2802. "Verify whether the active session goal"
  2803. ],
  2804. "lastUserMessageIncludes": [
  2805. "E2E_BACKGROUND_SEND_NOW_QUEUE: Launch a background agent with a visible child Bash tool, then wait."
  2806. ]
  2807. },
  2808. "response": {
  2809. "statusCode": 200,
  2810. "toolUse": {
  2811. "id": "toolu_e2e_background_send_now_queue_agent",
  2812. "name": "Agent",
  2813. "input": {
  2814. "description": "E2E background send now queue",
  2815. "prompt": "E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD: Run Bash with description background send now queue child bash sleep, then reply exactly E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD_DONE.",
  2816. "run_in_background": true
  2817. }
  2818. }
  2819. }
  2820. },
  2821. {
  2822. "id": "upstream-background-send-now-queue-agent-launch-ack",
  2823. "description": "BG16: parent finishes launch turn while background Agent continues running.",
  2824. "metadata": {
  2825. "kind": "main",
  2826. "timingPolicy": "fast-text",
  2827. "source": "synthetic",
  2828. "syntheticReason": "父模型在 async Agent launch tool result 后结束当前 turn,制造 parent idle + child tool running 窗口。"
  2829. },
  2830. "maxMatches": 1,
  2831. "match": {
  2832. "method": "POST",
  2833. "pathIncludes": "/messages",
  2834. "bodyIncludes": [
  2835. "E2E_BACKGROUND_SEND_NOW_QUEUE",
  2836. "Async agent launched successfully"
  2837. ],
  2838. "bodyExcludes": [
  2839. "Generate a concise title",
  2840. "CRITICAL: Respond with TEXT ONLY",
  2841. "Verify whether the active session goal"
  2842. ]
  2843. },
  2844. "response": {
  2845. "statusCode": 200,
  2846. "text": {
  2847. "id": "upstream-e2e-background-send-now-queue-launch-ack",
  2848. "text": "background-send-now-queue-launched-ok"
  2849. }
  2850. }
  2851. },
  2852. {
  2853. "id": "upstream-background-send-now-queue-child-bash-tool-call",
  2854. "description": "BG16: child Agent starts a visible foreground Bash tool while parent remains idle.",
  2855. "metadata": {
  2856. "kind": "subagent",
  2857. "timingPolicy": "fast-tool-use",
  2858. "source": "synthetic",
  2859. "syntheticReason": "用文件 barrier 控制真实 child Bash 生命周期,让父侧 raw runtime streaming 但 mainActive=false;点击 Send now 后再释放,避免固定 sleep 受全量负载影响。"
  2860. },
  2861. "maxMatches": 1,
  2862. "match": {
  2863. "method": "POST",
  2864. "pathIncludes": "/messages",
  2865. "bodyIncludes": ["E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD"],
  2866. "bodyExcludes": [
  2867. "E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD_BASH_DONE",
  2868. "Generate a concise title",
  2869. "CRITICAL: Respond with TEXT ONLY",
  2870. "Verify whether the active session goal"
  2871. ],
  2872. "lastUserMessageExcludes": ["<task-notification>"],
  2873. "lastUserMessageIncludes": ["E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD"]
  2874. },
  2875. "response": {
  2876. "statusCode": 200,
  2877. "toolUse": {
  2878. "id": "toolu_e2e_background_send_now_queue_child_bash",
  2879. "name": "Bash",
  2880. "input": {
  2881. "command": "sh -c 'while [ ! -f \".zcode-e2e/conversation-session-background/background-send-now-queue-release\" ]; do sleep 0.1; done; printf \"E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD_BASH_DONE\\n\"'",
  2882. "description": "background send now queue child bash sleep"
  2883. }
  2884. }
  2885. }
  2886. },
  2887. {
  2888. "id": "upstream-background-send-now-queue-hold",
  2889. "description": "BG16: foreground hold turn creates a real typed queue before stop transitions to background-only idle.",
  2890. "metadata": {
  2891. "kind": "main",
  2892. "timingPolicy": "controlled-stream",
  2893. "source": "synthetic",
  2894. "syntheticReason": "使用真实主 turn 与 composer queue 替代已删除的 renderer store 注入,稳定构造 stop 后 background-only + paused queue。"
  2895. },
  2896. "maxMatches": 1,
  2897. "match": {
  2898. "method": "POST",
  2899. "pathIncludes": "/messages",
  2900. "bodyIncludes": [
  2901. "E2E_HOLD_STREAM",
  2902. "E2E_BACKGROUND_SEND_NOW_QUEUE_HOLD"
  2903. ],
  2904. "bodyExcludes": [
  2905. "Generate a concise title",
  2906. "CRITICAL: Respond with TEXT ONLY",
  2907. "Verify whether the active session goal"
  2908. ],
  2909. "lastUserMessageIncludes": ["E2E_BACKGROUND_SEND_NOW_QUEUE_HOLD"]
  2910. },
  2911. "response": {
  2912. "statusCode": 200,
  2913. "delayMs": 60000,
  2914. "text": {
  2915. "id": "upstream-e2e-background-send-now-queue-hold",
  2916. "inputTokens": 120,
  2917. "outputTokens": 12,
  2918. "text": "upstream-e2e-ok"
  2919. }
  2920. }
  2921. },
  2922. {
  2923. "id": "upstream-background-send-now-queue-prompt-received",
  2924. "description": "BG16: clicked queued prompt is sent as a normal provider request without stopping background task.",
  2925. "metadata": {
  2926. "kind": "main",
  2927. "timingPolicy": "fast-text",
  2928. "source": "synthetic",
  2929. "syntheticReason": "验证 background-only running 下 queued prompt Send now 直接触发 provider request,而不是先 stop background task。"
  2930. },
  2931. "maxMatches": 1,
  2932. "match": {
  2933. "method": "POST",
  2934. "pathIncludes": "/messages",
  2935. "bodyIncludes": ["E2E_BACKGROUND_SEND_NOW_QUEUE_PAYLOAD"],
  2936. "bodyExcludes": [
  2937. "Generate a concise title",
  2938. "CRITICAL: Respond with TEXT ONLY",
  2939. "Verify whether the active session goal"
  2940. ],
  2941. "lastUserMessageExcludes": ["<task-notification>"],
  2942. "lastUserMessageIncludes": ["E2E_BACKGROUND_SEND_NOW_QUEUE_PAYLOAD"]
  2943. },
  2944. "response": {
  2945. "statusCode": 200,
  2946. "text": {
  2947. "id": "upstream-e2e-background-send-now-queue-received",
  2948. "text": "background-send-now-queue-received-ok"
  2949. }
  2950. }
  2951. },
  2952. {
  2953. "id": "upstream-background-send-now-queue-child-done",
  2954. "description": "BG16: child Agent completes after the queued prompt has already been sent.",
  2955. "metadata": {
  2956. "kind": "subagent",
  2957. "timingPolicy": "fast-text",
  2958. "source": "synthetic",
  2959. "syntheticReason": "证明 Send now 没有停止 background Agent;child Bash 自然完成后 Agent 继续产生 completion notification。"
  2960. },
  2961. "maxMatches": 1,
  2962. "match": {
  2963. "method": "POST",
  2964. "pathIncludes": "/messages",
  2965. "bodyIncludes": [
  2966. "E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD",
  2967. "E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD_BASH_DONE"
  2968. ],
  2969. "bodyExcludes": [
  2970. "Generate a concise title",
  2971. "CRITICAL: Respond with TEXT ONLY",
  2972. "Verify whether the active session goal"
  2973. ],
  2974. "lastUserMessageExcludes": ["<task-notification>"]
  2975. },
  2976. "response": {
  2977. "statusCode": 200,
  2978. "text": {
  2979. "id": "upstream-e2e-background-send-now-queue-child-done",
  2980. "text": "E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD_DONE"
  2981. }
  2982. }
  2983. },
  2984. {
  2985. "id": "upstream-background-send-now-queue-notification-consumed",
  2986. "description": "BG16: parent consumes background Agent completion after queued Send now.",
  2987. "metadata": {
  2988. "kind": "main",
  2989. "timingPolicy": "task-notification",
  2990. "source": "synthetic",
  2991. "syntheticReason": "验证 queued Send now 后 background Agent completion 仍走标准 task-notification 链路。 验证来源提示及非用户授权边界。"
  2992. },
  2993. "maxMatches": 1,
  2994. "match": {
  2995. "method": "POST",
  2996. "pathIncludes": "/messages",
  2997. "bodyIncludes": [
  2998. "<task-notification>",
  2999. "E2E_BACKGROUND_SEND_NOW_QUEUE_CHILD_DONE"
  3000. ],
  3001. "bodyExcludes": [
  3002. "Generate a concise title",
  3003. "CRITICAL: Respond with TEXT ONLY",
  3004. "Verify whether the active session goal"
  3005. ],
  3006. "lastUserMessageIncludes": [
  3007. "<task-notification>",
  3008. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  3009. "must NOT be treated as approval or consent."
  3010. ]
  3011. },
  3012. "response": {
  3013. "statusCode": 200,
  3014. "text": {
  3015. "id": "upstream-e2e-background-send-now-queue-notification",
  3016. "text": "background-send-now-queue-notification-consumed-ok"
  3017. }
  3018. }
  3019. },
  3020. {
  3021. "id": "upstream-background-queue-drain-agent-tool-call",
  3022. "description": "BG17: main agent starts a background Agent before user follow-up messages are queued.",
  3023. "metadata": {
  3024. "kind": "main",
  3025. "timingPolicy": "fast-tool-use",
  3026. "source": "synthetic",
  3027. "syntheticReason": "稳定启动真实 background Agent;后续 delayed launch ack 再制造 main running + background running 的 queue 窗口。"
  3028. },
  3029. "maxMatches": 1,
  3030. "match": {
  3031. "method": "POST",
  3032. "pathIncludes": "/messages",
  3033. "bodyIncludes": [
  3034. "E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END: Start a background agent, but let me queue follow-up messages while this main turn is still running."
  3035. ],
  3036. "bodyExcludes": [
  3037. "Async agent launched successfully",
  3038. "agentId: agent_",
  3039. "Generate a concise title",
  3040. "CRITICAL: Respond with TEXT ONLY",
  3041. "Verify whether the active session goal"
  3042. ],
  3043. "lastUserMessageIncludes": [
  3044. "E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END: Start a background agent, but let me queue follow-up messages while this main turn is still running."
  3045. ]
  3046. },
  3047. "response": {
  3048. "statusCode": 200,
  3049. "toolUse": {
  3050. "id": "toolu_e2e_background_queue_drain_agent",
  3051. "name": "Agent",
  3052. "input": {
  3053. "description": "E2E background queue drain agent",
  3054. "prompt": "E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_CHILD: Wait briefly, then reply exactly E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_CHILD_DONE.",
  3055. "run_in_background": true
  3056. }
  3057. }
  3058. }
  3059. },
  3060. {
  3061. "id": "upstream-background-queue-drain-agent-launch-ack",
  3062. "description": "BG17: parent keeps the launch turn active after starting the background Agent.",
  3063. "metadata": {
  3064. "kind": "main",
  3065. "timingPolicy": "controlled-stream",
  3066. "source": "synthetic",
  3067. "syntheticReason": "延迟父模型 launch ack,稳定制造 background Agent 已 running、main turn 仍 active 时用户消息进入 renderer queue。"
  3068. },
  3069. "maxMatches": 1,
  3070. "match": {
  3071. "method": "POST",
  3072. "pathIncludes": "/messages",
  3073. "bodyIncludes": [
  3074. "E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END",
  3075. "Async agent launched successfully"
  3076. ],
  3077. "bodyExcludes": [
  3078. "Generate a concise title",
  3079. "CRITICAL: Respond with TEXT ONLY",
  3080. "Verify whether the active session goal"
  3081. ]
  3082. },
  3083. "response": {
  3084. "statusCode": 200,
  3085. "delayMs": 8000,
  3086. "text": {
  3087. "id": "upstream-e2e-background-queue-drain-launch-ack",
  3088. "text": "background-queue-drain-launched-ok"
  3089. }
  3090. }
  3091. },
  3092. {
  3093. "id": "upstream-background-queue-drain-child-delayed-result",
  3094. "description": "BG17: child Agent remains running while queued prompts drain.",
  3095. "metadata": {
  3096. "kind": "subagent",
  3097. "timingPolicy": "delayed-text",
  3098. "source": "synthetic",
  3099. "syntheticReason": "延迟 background Agent completion,避免 notification 抢在 queued prompt drain 验证前进入父会话。"
  3100. },
  3101. "maxMatches": 1,
  3102. "match": {
  3103. "method": "POST",
  3104. "pathIncludes": "/messages",
  3105. "bodyIncludes": [
  3106. "E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_CHILD: Wait briefly, then reply exactly E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_CHILD_DONE."
  3107. ],
  3108. "bodyExcludes": [
  3109. "Generate a concise title",
  3110. "CRITICAL: Respond with TEXT ONLY",
  3111. "Verify whether the active session goal"
  3112. ],
  3113. "lastUserMessageExcludes": ["<task-notification>"],
  3114. "lastUserMessageIncludes": [
  3115. "E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_CHILD: Wait briefly, then reply exactly E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_CHILD_DONE."
  3116. ]
  3117. },
  3118. "response": {
  3119. "statusCode": 200,
  3120. "delayMs": 30000,
  3121. "text": {
  3122. "id": "upstream-e2e-background-queue-drain-child-done",
  3123. "text": "E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_CHILD_DONE"
  3124. }
  3125. }
  3126. },
  3127. {
  3128. "id": "upstream-background-queue-drain-first-queued-prompt",
  3129. "description": "BG17: first follow-up prompt after the background launch stays active long enough to queue another prompt.",
  3130. "metadata": {
  3131. "kind": "main",
  3132. "timingPolicy": "controlled-stream",
  3133. "source": "synthetic",
  3134. "syntheticReason": "延迟 Q2 响应,稳定验证 launch ack 前已入队的 Q3/Q4 不会在 Q2 drain 后丢失。"
  3135. },
  3136. "maxMatches": 1,
  3137. "match": {
  3138. "method": "POST",
  3139. "pathIncludes": "/messages",
  3140. "bodyIncludes": ["E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_Q2"],
  3141. "bodyExcludes": [
  3142. "Generate a concise title",
  3143. "CRITICAL: Respond with TEXT ONLY",
  3144. "Verify whether the active session goal"
  3145. ],
  3146. "lastUserMessageExcludes": ["<task-notification>"],
  3147. "lastUserMessageIncludes": ["E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_Q2"]
  3148. },
  3149. "response": {
  3150. "statusCode": 200,
  3151. "delayMs": 8000,
  3152. "text": {
  3153. "id": "upstream-e2e-background-queue-drain-first",
  3154. "text": "background-queue-drain-first-ok"
  3155. }
  3156. }
  3157. },
  3158. {
  3159. "id": "upstream-background-queue-drain-second-queued-prompt",
  3160. "description": "BG17: second follow-up prompt drains after Q2 completes.",
  3161. "metadata": {
  3162. "kind": "main",
  3163. "timingPolicy": "controlled-stream",
  3164. "source": "synthetic",
  3165. "syntheticReason": "延迟 Q3 响应,稳定观察 Q3 已渲染为 user message 且 Q4 仍留在 queue 的 UI 窗口。"
  3166. },
  3167. "maxMatches": 1,
  3168. "match": {
  3169. "method": "POST",
  3170. "pathIncludes": "/messages",
  3171. "bodyIncludes": ["E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_Q3"],
  3172. "bodyExcludes": [
  3173. "Generate a concise title",
  3174. "CRITICAL: Respond with TEXT ONLY",
  3175. "Verify whether the active session goal"
  3176. ],
  3177. "lastUserMessageExcludes": ["<task-notification>"],
  3178. "lastUserMessageIncludes": ["E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_Q3"]
  3179. },
  3180. "response": {
  3181. "statusCode": 200,
  3182. "delayMs": 8000,
  3183. "text": {
  3184. "id": "upstream-e2e-background-queue-drain-second",
  3185. "text": "background-queue-drain-second-ok"
  3186. }
  3187. }
  3188. },
  3189. {
  3190. "id": "upstream-background-queue-drain-third-queued-prompt",
  3191. "description": "BG17: Q4 queued before launch ack drains after Q3.",
  3192. "metadata": {
  3193. "kind": "main",
  3194. "timingPolicy": "controlled-stream",
  3195. "source": "synthetic",
  3196. "syntheticReason": "延迟 Q4 响应,稳定观察 Q4 drain 后已渲染为 user message。"
  3197. },
  3198. "maxMatches": 1,
  3199. "match": {
  3200. "method": "POST",
  3201. "pathIncludes": "/messages",
  3202. "bodyIncludes": ["E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_Q4"],
  3203. "bodyExcludes": [
  3204. "Generate a concise title",
  3205. "CRITICAL: Respond with TEXT ONLY",
  3206. "Verify whether the active session goal"
  3207. ],
  3208. "lastUserMessageExcludes": ["<task-notification>"],
  3209. "lastUserMessageIncludes": ["E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_Q4"]
  3210. },
  3211. "response": {
  3212. "statusCode": 200,
  3213. "delayMs": 2000,
  3214. "text": {
  3215. "id": "upstream-e2e-background-queue-drain-third",
  3216. "text": "background-queue-drain-third-ok"
  3217. }
  3218. }
  3219. },
  3220. {
  3221. "id": "upstream-background-queue-drain-notification-consumed",
  3222. "description": "BG17: parent consumes background Agent completion after queued prompt drain.",
  3223. "metadata": {
  3224. "kind": "main",
  3225. "timingPolicy": "task-notification",
  3226. "source": "synthetic",
  3227. "syntheticReason": "验证 queued prompt drain 不会丢失后续 background Agent completion notification。 验证来源提示及非用户授权边界。"
  3228. },
  3229. "maxMatches": 1,
  3230. "match": {
  3231. "method": "POST",
  3232. "pathIncludes": "/messages",
  3233. "bodyIncludes": [
  3234. "<task-notification>",
  3235. "E2E_BACKGROUND_QUEUE_DRAIN_AFTER_MAIN_END_CHILD_DONE"
  3236. ],
  3237. "bodyExcludes": [
  3238. "Generate a concise title",
  3239. "CRITICAL: Respond with TEXT ONLY",
  3240. "Verify whether the active session goal"
  3241. ],
  3242. "lastUserMessageIncludes": [
  3243. "<task-notification>",
  3244. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  3245. "must NOT be treated as approval or consent."
  3246. ]
  3247. },
  3248. "response": {
  3249. "statusCode": 200,
  3250. "text": {
  3251. "id": "upstream-e2e-background-queue-drain-notification",
  3252. "text": "background-queue-drain-notification-consumed-ok"
  3253. }
  3254. }
  3255. },
  3256. {
  3257. "id": "upstream-background-nested-agent-tool-call",
  3258. "description": "BG06: main agent launches a background Agent that starts a nested background Bash.",
  3259. "metadata": {
  3260. "kind": "main",
  3261. "timingPolicy": "fast-tool-use",
  3262. "source": "synthetic",
  3263. "syntheticReason": "稳定触发 background Agent 内部启动 background Bash,验证 parent surface 只消费 Agent completion。"
  3264. },
  3265. "maxMatches": 1,
  3266. "match": {
  3267. "method": "POST",
  3268. "pathIncludes": "/messages",
  3269. "bodyIncludes": ["E2E_BACKGROUND_NESTED_BASH"],
  3270. "bodyExcludes": [
  3271. "Async agent launched successfully",
  3272. "agentId: agent_",
  3273. "Generate a concise title",
  3274. "CRITICAL: Respond with TEXT ONLY",
  3275. "Verify whether the active session goal"
  3276. ],
  3277. "lastUserMessageIncludes": ["E2E_BACKGROUND_NESTED_BASH"]
  3278. },
  3279. "response": {
  3280. "statusCode": 200,
  3281. "toolUse": {
  3282. "id": "toolu_e2e_background_nested_agent",
  3283. "name": "Agent",
  3284. "input": {
  3285. "description": "Nested background Bash",
  3286. "prompt": "E2E_BACKGROUND_NESTED_BASH_CHILD: Start Bash(run_in_background=true), then finish with exactly E2E_BACKGROUND_NESTED_BASH_CHILD_DONE.",
  3287. "run_in_background": true
  3288. }
  3289. }
  3290. }
  3291. },
  3292. {
  3293. "id": "upstream-background-nested-agent-launch-ack",
  3294. "description": "BG06: parent finishes launch turn after nested Agent starts asynchronously.",
  3295. "metadata": {
  3296. "kind": "main",
  3297. "timingPolicy": "fast-text",
  3298. "source": "synthetic",
  3299. "syntheticReason": "父模型在 async Agent launch tool result 后结束当前 turn。"
  3300. },
  3301. "maxMatches": 1,
  3302. "match": {
  3303. "method": "POST",
  3304. "pathIncludes": "/messages",
  3305. "bodyIncludes": ["E2E_BACKGROUND_NESTED_BASH", "Async agent launched successfully"],
  3306. "bodyExcludes": [
  3307. "Generate a concise title",
  3308. "CRITICAL: Respond with TEXT ONLY",
  3309. "Verify whether the active session goal"
  3310. ]
  3311. },
  3312. "response": {
  3313. "statusCode": 200,
  3314. "text": {
  3315. "id": "upstream-e2e-background-nested-launch-ack",
  3316. "text": "background-nested-bash-launched-ok"
  3317. }
  3318. }
  3319. },
  3320. {
  3321. "id": "upstream-background-nested-child-bash-tool-call",
  3322. "description": "BG06: child Agent starts a background Bash command and then should be allowed to complete before Bash exits.",
  3323. "metadata": {
  3324. "kind": "subagent",
  3325. "timingPolicy": "fast-tool-use",
  3326. "source": "synthetic",
  3327. "syntheticReason": "稳定触发 child runtime 内部 Bash(run_in_background=true)。"
  3328. },
  3329. "maxMatches": 1,
  3330. "match": {
  3331. "method": "POST",
  3332. "pathIncludes": "/messages",
  3333. "bodyIncludes": ["E2E_BACKGROUND_NESTED_BASH_CHILD"],
  3334. "bodyExcludes": [
  3335. "Command running in background",
  3336. "Generate a concise title",
  3337. "CRITICAL: Respond with TEXT ONLY",
  3338. "Verify whether the active session goal"
  3339. ],
  3340. "lastUserMessageExcludes": ["<task-notification>"],
  3341. "lastUserMessageIncludes": ["E2E_BACKGROUND_NESTED_BASH_CHILD"]
  3342. },
  3343. "response": {
  3344. "statusCode": 200,
  3345. "toolUse": {
  3346. "id": "toolu_e2e_background_nested_child_bash",
  3347. "name": "Bash",
  3348. "input": {
  3349. "command": "sleep 1; printf 'nested bash done\\n'",
  3350. "description": "Nested child background Bash",
  3351. "run_in_background": true
  3352. }
  3353. }
  3354. }
  3355. },
  3356. {
  3357. "id": "upstream-background-nested-child-stops-after-bash-launch",
  3358. "description": "BG06: child Agent stops after receiving the backgrounded Bash launch result.",
  3359. "metadata": {
  3360. "kind": "subagent",
  3361. "timingPolicy": "fast-text",
  3362. "source": "synthetic",
  3363. "syntheticReason": "证明 parent Agent completion 不等待 nested Bash terminal。"
  3364. },
  3365. "maxMatches": 1,
  3366. "match": {
  3367. "method": "POST",
  3368. "pathIncludes": "/messages",
  3369. "bodyIncludes": ["E2E_BACKGROUND_NESTED_BASH_CHILD", "Command running in background"],
  3370. "bodyExcludes": [
  3371. "Generate a concise title",
  3372. "CRITICAL: Respond with TEXT ONLY",
  3373. "Verify whether the active session goal"
  3374. ],
  3375. "lastUserMessageExcludes": ["<task-notification>"]
  3376. },
  3377. "response": {
  3378. "statusCode": 200,
  3379. "text": {
  3380. "id": "upstream-e2e-background-nested-child-done",
  3381. "text": "E2E_BACKGROUND_NESTED_BASH_CHILD_DONE"
  3382. }
  3383. }
  3384. },
  3385. {
  3386. "id": "upstream-background-nested-notification-consumed",
  3387. "description": "BG06: parent consumes the Agent completion notification and does not receive a second parent result for nested Bash.",
  3388. "metadata": {
  3389. "kind": "main",
  3390. "timingPolicy": "task-notification",
  3391. "source": "synthetic",
  3392. "syntheticReason": "验证 parent surface 只消费 Agent completion notification。 验证来源提示及非用户授权边界。"
  3393. },
  3394. "maxMatches": 1,
  3395. "match": {
  3396. "method": "POST",
  3397. "pathIncludes": "/messages",
  3398. "bodyIncludes": [
  3399. "<task-notification>",
  3400. "E2E_BACKGROUND_NESTED_BASH_CHILD_DONE"
  3401. ],
  3402. "bodyExcludes": [
  3403. "toolu_e2e_background_nested_child_bash",
  3404. "Generate a concise title",
  3405. "CRITICAL: Respond with TEXT ONLY",
  3406. "Verify whether the active session goal"
  3407. ],
  3408. "lastUserMessageIncludes": [
  3409. "<task-notification>",
  3410. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  3411. "must NOT be treated as approval or consent."
  3412. ]
  3413. },
  3414. "response": {
  3415. "statusCode": 200,
  3416. "text": {
  3417. "id": "upstream-e2e-background-nested-notification",
  3418. "text": "background-nested-bash-notification-consumed-ok"
  3419. }
  3420. }
  3421. },
  3422. {
  3423. "id": "upstream-background-snapshot-control-ready",
  3424. "description": "BG23: launch two real background Bash tasks so the right summary panel can reproduce a partial terminal update.",
  3425. "metadata": {
  3426. "kind": "main",
  3427. "timingPolicy": "fast-tool-use",
  3428. "source": "synthetic",
  3429. "syntheticReason": "稳定启动两个 background Bash:第一个先完成,第二个保持 running,用真实右上角 background control 面板复现闪没场景。"
  3430. },
  3431. "maxMatches": 1,
  3432. "match": {
  3433. "method": "POST",
  3434. "pathIncludes": "/messages",
  3435. "bodyIncludes": ["E2E_BACKGROUND_SNAPSHOT_CONTROL"],
  3436. "bodyExcludes": [
  3437. "Generate a concise title",
  3438. "CRITICAL: Respond with TEXT ONLY",
  3439. "Verify whether the active session goal"
  3440. ],
  3441. "lastUserMessageIncludes": ["E2E_BACKGROUND_SNAPSHOT_CONTROL"]
  3442. },
  3443. "response": {
  3444. "statusCode": 200,
  3445. "toolUses": [
  3446. {
  3447. "id": "toolu_e2e_bg23_bash_one",
  3448. "name": "Bash",
  3449. "input": {
  3450. "command": "sh -c 'sleep 8; printf \"E2E_BG23_BASH_ONE_DONE\\n\"'",
  3451. "description": "E2E BG23 bash one",
  3452. "run_in_background": true
  3453. }
  3454. },
  3455. {
  3456. "id": "toolu_e2e_bg23_bash_two",
  3457. "name": "Bash",
  3458. "input": {
  3459. "command": "sh -c 'sleep 60; printf \"E2E_BG23_BASH_TWO_DONE\\n\"'",
  3460. "description": "E2E BG23 bash two",
  3461. "run_in_background": true
  3462. }
  3463. }
  3464. ]
  3465. }
  3466. },
  3467. {
  3468. "id": "upstream-background-snapshot-control-launch-ack",
  3469. "description": "BG23: parent finishes the launch turn while both background Bash controls are visible.",
  3470. "metadata": {
  3471. "kind": "main",
  3472. "timingPolicy": "fast-text",
  3473. "source": "synthetic",
  3474. "syntheticReason": "让 main 回到 idle,同时右上角 background control 面板仍有两个 running Bash row。"
  3475. },
  3476. "maxMatches": 1,
  3477. "match": {
  3478. "method": "POST",
  3479. "pathIncludes": "/messages",
  3480. "bodyIncludes": [
  3481. "E2E_BACKGROUND_SNAPSHOT_CONTROL",
  3482. "toolu_e2e_bg23_bash_one",
  3483. "toolu_e2e_bg23_bash_two",
  3484. "Command running in background"
  3485. ],
  3486. "bodyExcludes": [
  3487. "Generate a concise title",
  3488. "CRITICAL: Respond with TEXT ONLY",
  3489. "Verify whether the active session goal"
  3490. ]
  3491. },
  3492. "response": {
  3493. "statusCode": 200,
  3494. "text": {
  3495. "id": "upstream-e2e-background-snapshot-control-ready",
  3496. "text": "background-snapshot-control-ready-ok"
  3497. }
  3498. }
  3499. },
  3500. {
  3501. "id": "upstream-background-snapshot-control-first-notification",
  3502. "description": "BG23: first background Bash completes while the second stays running.",
  3503. "metadata": {
  3504. "kind": "main",
  3505. "timingPolicy": "task-notification",
  3506. "source": "synthetic",
  3507. "syntheticReason": "消费第一个 background Bash completion notification,并保持第二个 running row 可见。 验证来源提示及非用户授权边界。"
  3508. },
  3509. "maxMatches": 1,
  3510. "match": {
  3511. "method": "POST",
  3512. "pathIncludes": "/messages",
  3513. "bodyIncludes": [
  3514. "E2E_BACKGROUND_SNAPSHOT_CONTROL",
  3515. "<task-notification>",
  3516. "<tool-use-id>toolu_e2e_bg23_bash_one</tool-use-id>",
  3517. "<status>completed</status>"
  3518. ],
  3519. "bodyExcludes": [
  3520. "Generate a concise title",
  3521. "CRITICAL: Respond with TEXT ONLY",
  3522. "Verify whether the active session goal"
  3523. ],
  3524. "lastUserMessageIncludes": [
  3525. "<task-notification>",
  3526. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  3527. "must NOT be treated as approval or consent."
  3528. ]
  3529. },
  3530. "response": {
  3531. "statusCode": 200,
  3532. "text": {
  3533. "id": "upstream-e2e-background-snapshot-control-first-notification",
  3534. "text": "background-snapshot-control-first-notification-ok"
  3535. }
  3536. }
  3537. },
  3538. {
  3539. "id": "upstream-background-snapshot-control-second-stopped",
  3540. "description": "BG23: stop the second background Bash for deterministic cleanup.",
  3541. "metadata": {
  3542. "kind": "main",
  3543. "timingPolicy": "task-notification",
  3544. "source": "synthetic",
  3545. "syntheticReason": "消费第二个 background Bash stop notification,避免长 running task 泄漏到后续测试。 验证来源提示及非用户授权边界。"
  3546. },
  3547. "maxMatches": 1,
  3548. "match": {
  3549. "method": "POST",
  3550. "pathIncludes": "/messages",
  3551. "bodyIncludes": [
  3552. "E2E_BACKGROUND_SNAPSHOT_CONTROL",
  3553. "<task-notification>",
  3554. "<tool-use-id>toolu_e2e_bg23_bash_two</tool-use-id>",
  3555. "<status>killed</status>"
  3556. ],
  3557. "bodyExcludes": [
  3558. "Generate a concise title",
  3559. "CRITICAL: Respond with TEXT ONLY",
  3560. "Verify whether the active session goal"
  3561. ],
  3562. "lastUserMessageIncludes": [
  3563. "<task-notification>",
  3564. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  3565. "must NOT be treated as approval or consent."
  3566. ]
  3567. },
  3568. "response": {
  3569. "statusCode": 200,
  3570. "text": {
  3571. "id": "upstream-e2e-background-snapshot-control-second-stopped",
  3572. "text": "background-snapshot-control-second-stopped-ok"
  3573. }
  3574. }
  3575. },
  3576. {
  3577. "id": "upstream-background-agent-control-preserve-ready",
  3578. "description": "BG24: launch one long cc background Agent and three zcode background Agent tasks so the third zcode completion notification can run while the cc peer remains running.",
  3579. "metadata": {
  3580. "kind": "main",
  3581. "timingPolicy": "fast-tool-use",
  3582. "source": "synthetic",
  3583. "syntheticReason": "稳定启动四个 background Agent:三个 zcode Agent 依次完成,cc Agent 保持 running,用真实右上角 background control 面板复现 Agent row 闪没场景。"
  3584. },
  3585. "maxMatches": 1,
  3586. "match": {
  3587. "method": "POST",
  3588. "pathIncludes": "/messages",
  3589. "bodyIncludes": ["E2E_BACKGROUND_AGENT_CONTROL_PRESERVE"],
  3590. "bodyExcludes": [
  3591. "Async agent launched successfully",
  3592. "agentId: agent_",
  3593. "Generate a concise title",
  3594. "CRITICAL: Respond with TEXT ONLY",
  3595. "Verify whether the active session goal"
  3596. ],
  3597. "lastUserMessageIncludes": ["E2E_BACKGROUND_AGENT_CONTROL_PRESERVE"]
  3598. },
  3599. "response": {
  3600. "statusCode": 200,
  3601. "toolUses": [
  3602. {
  3603. "id": "toolu_e2e_bg24_cc_agent",
  3604. "name": "Agent",
  3605. "input": {
  3606. "description": "E2E BG24 cc keepalive agent",
  3607. "prompt": "E2E_BG24_CC_CHILD: Stay running until stopped. If not stopped, return E2E_BG24_CC_CHILD_UNEXPECTED.",
  3608. "run_in_background": true
  3609. }
  3610. },
  3611. {
  3612. "id": "toolu_e2e_bg24_zcode_one_agent",
  3613. "name": "Agent",
  3614. "input": {
  3615. "description": "E2E BG24 zcode one agent",
  3616. "prompt": "E2E_BG24_ZCODE_ONE_CHILD: Finish after a short delay and return exactly E2E_BG24_ZCODE_ONE_CHILD_DONE.",
  3617. "run_in_background": true
  3618. }
  3619. },
  3620. {
  3621. "id": "toolu_e2e_bg24_zcode_two_agent",
  3622. "name": "Agent",
  3623. "input": {
  3624. "description": "E2E BG24 zcode two agent",
  3625. "prompt": "E2E_BG24_ZCODE_TWO_CHILD: Finish after a short delay and return exactly E2E_BG24_ZCODE_TWO_CHILD_DONE.",
  3626. "run_in_background": true
  3627. }
  3628. },
  3629. {
  3630. "id": "toolu_e2e_bg24_zcode_three_agent",
  3631. "name": "Agent",
  3632. "input": {
  3633. "description": "E2E BG24 zcode three agent",
  3634. "prompt": "E2E_BG24_ZCODE_THREE_CHILD: Finish after a short delay and return exactly E2E_BG24_ZCODE_THREE_CHILD_DONE.",
  3635. "run_in_background": true
  3636. }
  3637. }
  3638. ]
  3639. }
  3640. },
  3641. {
  3642. "id": "upstream-background-agent-control-preserve-cc-child-keepalive-tool",
  3643. "description": "BG24: cc peer Agent stays running while zcode Agent completes.",
  3644. "metadata": {
  3645. "kind": "subagent",
  3646. "timingPolicy": "fast-tool-use",
  3647. "source": "synthetic",
  3648. "syntheticReason": "让 cc Agent 进入不会自行完成的 child Bash,保持 running,证明另一个 Agent completion notification 不会清掉它的 control row。"
  3649. },
  3650. "maxMatches": 1,
  3651. "match": {
  3652. "method": "POST",
  3653. "pathIncludes": "/messages",
  3654. "bodyIncludes": ["E2E_BG24_CC_CHILD"],
  3655. "lastUserMessageIncludes": ["E2E_BG24_CC_CHILD"]
  3656. },
  3657. "response": {
  3658. "statusCode": 200,
  3659. "toolUse": {
  3660. "id": "toolu_e2e_bg24_cc_keepalive_bash",
  3661. "name": "Bash",
  3662. "input": {
  3663. "command": "while true; do sleep 1; done",
  3664. "description": "E2E BG24 cc keepalive bash"
  3665. }
  3666. }
  3667. }
  3668. },
  3669. {
  3670. "id": "upstream-background-agent-control-preserve-zcode-one-child-result",
  3671. "description": "BG24: first zcode peer Agent completes first.",
  3672. "metadata": {
  3673. "kind": "subagent",
  3674. "timingPolicy": "delayed-text",
  3675. "source": "synthetic",
  3676. "syntheticReason": "短延迟完成第一个 zcode background Agent,稳定触发 parent task-notification。"
  3677. },
  3678. "maxMatches": 1,
  3679. "match": {
  3680. "method": "POST",
  3681. "pathIncludes": "/messages",
  3682. "bodyIncludes": ["E2E_BG24_ZCODE_ONE_CHILD"],
  3683. "lastUserMessageIncludes": ["E2E_BG24_ZCODE_ONE_CHILD"]
  3684. },
  3685. "response": {
  3686. "statusCode": 200,
  3687. "delayMs": 4000,
  3688. "text": {
  3689. "id": "upstream-e2e-bg24-zcode-one-child-done",
  3690. "text": "E2E_BG24_ZCODE_ONE_CHILD_DONE"
  3691. }
  3692. }
  3693. },
  3694. {
  3695. "id": "upstream-background-agent-control-preserve-zcode-two-child-result",
  3696. "description": "BG24: second zcode peer Agent completes second.",
  3697. "metadata": {
  3698. "kind": "subagent",
  3699. "timingPolicy": "delayed-text",
  3700. "source": "synthetic",
  3701. "syntheticReason": "短延迟完成第二个 zcode background Agent,稳定触发 parent task-notification。"
  3702. },
  3703. "maxMatches": 1,
  3704. "match": {
  3705. "method": "POST",
  3706. "pathIncludes": "/messages",
  3707. "bodyIncludes": ["E2E_BG24_ZCODE_TWO_CHILD"],
  3708. "lastUserMessageIncludes": ["E2E_BG24_ZCODE_TWO_CHILD"]
  3709. },
  3710. "response": {
  3711. "statusCode": 200,
  3712. "delayMs": 14000,
  3713. "text": {
  3714. "id": "upstream-e2e-bg24-zcode-two-child-done",
  3715. "text": "E2E_BG24_ZCODE_TWO_CHILD_DONE"
  3716. }
  3717. }
  3718. },
  3719. {
  3720. "id": "upstream-background-agent-control-preserve-zcode-three-child-result",
  3721. "description": "BG24: third zcode peer Agent completes third.",
  3722. "metadata": {
  3723. "kind": "subagent",
  3724. "timingPolicy": "delayed-text",
  3725. "source": "synthetic",
  3726. "syntheticReason": "短延迟完成第三个 zcode background Agent,复现真实场景中第三个 completion notification 触发 UI 闪没。"
  3727. },
  3728. "maxMatches": 1,
  3729. "match": {
  3730. "method": "POST",
  3731. "pathIncludes": "/messages",
  3732. "bodyIncludes": ["E2E_BG24_ZCODE_THREE_CHILD"],
  3733. "lastUserMessageIncludes": ["E2E_BG24_ZCODE_THREE_CHILD"]
  3734. },
  3735. "response": {
  3736. "statusCode": 200,
  3737. "delayMs": 24000,
  3738. "text": {
  3739. "id": "upstream-e2e-bg24-zcode-three-child-done",
  3740. "text": "E2E_BG24_ZCODE_THREE_CHILD_DONE"
  3741. }
  3742. }
  3743. },
  3744. {
  3745. "id": "upstream-background-agent-control-preserve-launch-ack",
  3746. "description": "BG24: parent finishes launch turn while all background Agent controls are visible.",
  3747. "metadata": {
  3748. "kind": "main",
  3749. "timingPolicy": "fast-text",
  3750. "source": "synthetic",
  3751. "syntheticReason": "让 main 回到 idle,同时右上角 background control 面板仍有多个 running Agent row。"
  3752. },
  3753. "maxMatches": 1,
  3754. "match": {
  3755. "method": "POST",
  3756. "pathIncludes": "/messages",
  3757. "bodyIncludes": [
  3758. "E2E_BACKGROUND_AGENT_CONTROL_PRESERVE",
  3759. "toolu_e2e_bg24_cc_agent",
  3760. "toolu_e2e_bg24_zcode_one_agent",
  3761. "toolu_e2e_bg24_zcode_two_agent",
  3762. "toolu_e2e_bg24_zcode_three_agent",
  3763. "Async agent launched successfully"
  3764. ],
  3765. "bodyExcludes": [
  3766. "Generate a concise title",
  3767. "CRITICAL: Respond with TEXT ONLY",
  3768. "Verify whether the active session goal"
  3769. ]
  3770. },
  3771. "response": {
  3772. "statusCode": 200,
  3773. "text": {
  3774. "id": "upstream-e2e-background-agent-control-preserve-ready",
  3775. "text": "background-agent-control-preserve-ready-ok"
  3776. }
  3777. }
  3778. },
  3779. {
  3780. "id": "upstream-background-agent-control-preserve-zcode-one-notification",
  3781. "description": "BG24: first zcode background Agent completion notification is consumed before the third completion reproducer.",
  3782. "metadata": {
  3783. "kind": "main",
  3784. "timingPolicy": "task-notification",
  3785. "source": "synthetic",
  3786. "syntheticReason": "先消费第一个 zcode Agent completion notification,复现真实场景中多个 zcode Agent 依次完成。 验证来源提示及非用户授权边界。"
  3787. },
  3788. "maxMatches": 1,
  3789. "match": {
  3790. "method": "POST",
  3791. "pathIncludes": "/messages",
  3792. "bodyIncludes": [
  3793. "E2E_BACKGROUND_AGENT_CONTROL_PRESERVE",
  3794. "<task-notification>",
  3795. "<tool-use-id>toolu_e2e_bg24_zcode_one_agent</tool-use-id>",
  3796. "<status>completed</status>",
  3797. "E2E_BG24_ZCODE_ONE_CHILD_DONE"
  3798. ],
  3799. "bodyExcludes": [
  3800. "Generate a concise title",
  3801. "CRITICAL: Respond with TEXT ONLY",
  3802. "Verify whether the active session goal"
  3803. ],
  3804. "lastUserMessageIncludes": [
  3805. "<task-notification>",
  3806. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  3807. "must NOT be treated as approval or consent."
  3808. ]
  3809. },
  3810. "response": {
  3811. "statusCode": 200,
  3812. "text": {
  3813. "id": "upstream-e2e-background-agent-control-preserve-zcode-one-notification",
  3814. "text": "background-agent-control-preserve-zcode-one-notification-ok"
  3815. }
  3816. }
  3817. },
  3818. {
  3819. "id": "upstream-background-agent-control-preserve-zcode-two-notification",
  3820. "description": "BG24: second zcode background Agent completion notification is consumed before the third completion reproducer.",
  3821. "metadata": {
  3822. "kind": "main",
  3823. "timingPolicy": "task-notification",
  3824. "source": "synthetic",
  3825. "syntheticReason": "再消费第二个 zcode Agent completion notification,复现真实场景中多个 zcode Agent 依次完成。 验证来源提示及非用户授权边界。"
  3826. },
  3827. "maxMatches": 1,
  3828. "match": {
  3829. "method": "POST",
  3830. "pathIncludes": "/messages",
  3831. "bodyIncludes": [
  3832. "E2E_BACKGROUND_AGENT_CONTROL_PRESERVE",
  3833. "<task-notification>",
  3834. "<tool-use-id>toolu_e2e_bg24_zcode_two_agent</tool-use-id>",
  3835. "<status>completed</status>",
  3836. "E2E_BG24_ZCODE_TWO_CHILD_DONE"
  3837. ],
  3838. "bodyExcludes": [
  3839. "Generate a concise title",
  3840. "CRITICAL: Respond with TEXT ONLY",
  3841. "Verify whether the active session goal"
  3842. ],
  3843. "lastUserMessageIncludes": [
  3844. "<task-notification>",
  3845. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  3846. "must NOT be treated as approval or consent."
  3847. ]
  3848. },
  3849. "response": {
  3850. "statusCode": 200,
  3851. "delayMs": 12000,
  3852. "text": {
  3853. "id": "upstream-e2e-background-agent-control-preserve-zcode-two-notification",
  3854. "text": "background-agent-control-preserve-zcode-two-notification-ok"
  3855. }
  3856. }
  3857. },
  3858. {
  3859. "id": "upstream-background-agent-control-preserve-zcode-three-notification",
  3860. "description": "BG24: third zcode background Agent completion notification asks the main model to update todos before the final reply.",
  3861. "metadata": {
  3862. "kind": "main",
  3863. "timingPolicy": "task-notification",
  3864. "source": "synthetic",
  3865. "syntheticReason": "复现真实场景:main 处理第三个 Agent completion notification 时先执行 TodoWrite,覆盖 notification turn 内部状态更新。 验证来源提示及非用户授权边界。"
  3866. },
  3867. "maxMatches": 1,
  3868. "match": {
  3869. "method": "POST",
  3870. "pathIncludes": "/messages",
  3871. "bodyIncludes": [
  3872. "E2E_BACKGROUND_AGENT_CONTROL_PRESERVE",
  3873. "<task-notification>",
  3874. "<tool-use-id>toolu_e2e_bg24_zcode_three_agent</tool-use-id>",
  3875. "<status>completed</status>",
  3876. "E2E_BG24_ZCODE_THREE_CHILD_DONE"
  3877. ],
  3878. "bodyExcludes": [
  3879. "Generate a concise title",
  3880. "CRITICAL: Respond with TEXT ONLY",
  3881. "Verify whether the active session goal"
  3882. ],
  3883. "lastUserMessageIncludes": [
  3884. "<task-notification>",
  3885. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  3886. "must NOT be treated as approval or consent."
  3887. ]
  3888. },
  3889. "response": {
  3890. "statusCode": 200,
  3891. "toolUse": {
  3892. "id": "toolu_e2e_bg24_todo_write",
  3893. "name": "TodoWrite",
  3894. "input": {
  3895. "todos": [
  3896. {
  3897. "content": "E2E_BG24_TODO_UPDATED",
  3898. "status": "completed",
  3899. "priority": "low"
  3900. }
  3901. ]
  3902. }
  3903. }
  3904. }
  3905. },
  3906. {
  3907. "id": "upstream-background-agent-control-preserve-after-todo",
  3908. "description": "BG24: final notification-turn reply after TodoWrite is delayed so the UI can assert the cc peer row remains visible while main is still processing.",
  3909. "metadata": {
  3910. "kind": "main",
  3911. "timingPolicy": "delayed-text",
  3912. "source": "synthetic",
  3913. "syntheticReason": "复现真实场景:TodoWrite 之后 main notification turn 仍在处理,另一个 still-running Agent row 不能从右上角闪没。"
  3914. },
  3915. "maxMatches": 1,
  3916. "match": {
  3917. "method": "POST",
  3918. "pathIncludes": "/messages",
  3919. "bodyIncludes": [
  3920. "E2E_BACKGROUND_AGENT_CONTROL_PRESERVE",
  3921. "toolu_e2e_bg24_todo_write",
  3922. "E2E_BG24_TODO_UPDATED"
  3923. ],
  3924. "bodyExcludes": [
  3925. "Generate a concise title",
  3926. "CRITICAL: Respond with TEXT ONLY",
  3927. "Verify whether the active session goal"
  3928. ]
  3929. },
  3930. "response": {
  3931. "statusCode": 200,
  3932. "delayMs": 15000,
  3933. "text": {
  3934. "id": "upstream-e2e-background-agent-control-preserve-zcode-notification",
  3935. "text": "background-agent-control-preserve-zcode-notification-ok"
  3936. }
  3937. }
  3938. },
  3939. {
  3940. "id": "upstream-background-agent-control-preserve-cc-stopped",
  3941. "description": "BG24: stop the cc Agent for deterministic cleanup.",
  3942. "metadata": {
  3943. "kind": "main",
  3944. "timingPolicy": "task-notification",
  3945. "source": "synthetic",
  3946. "syntheticReason": "测试结束前收口仍 running 的 cc Agent,避免长 running task 泄漏到后续测试。 验证来源提示及非用户授权边界。"
  3947. },
  3948. "maxMatches": 1,
  3949. "match": {
  3950. "method": "POST",
  3951. "pathIncludes": "/messages",
  3952. "bodyIncludes": [
  3953. "E2E_BACKGROUND_AGENT_CONTROL_PRESERVE",
  3954. "<task-notification>",
  3955. "<tool-use-id>toolu_e2e_bg24_cc_agent</tool-use-id>",
  3956. "<status>stopped</status>"
  3957. ],
  3958. "bodyExcludes": [
  3959. "Generate a concise title",
  3960. "CRITICAL: Respond with TEXT ONLY",
  3961. "Verify whether the active session goal"
  3962. ],
  3963. "lastUserMessageIncludes": [
  3964. "<task-notification>",
  3965. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  3966. "must NOT be treated as approval or consent."
  3967. ]
  3968. },
  3969. "response": {
  3970. "statusCode": 200,
  3971. "text": {
  3972. "id": "upstream-e2e-background-agent-control-preserve-cc-stopped",
  3973. "text": "background-agent-control-preserve-cc-stopped-ok"
  3974. }
  3975. }
  3976. },
  3977. {
  3978. "id": "upstream-agent-composition-mixed-launch",
  3979. "description": "Telemetry: main turn launches one foreground and one background Agent.",
  3980. "metadata": {
  3981. "kind": "main",
  3982. "timingPolicy": "fast-tool-use",
  3983. "source": "synthetic",
  3984. "syntheticReason": "同一 main turn 启动 foreground/background Agent,验证两类结果在同一 provider request 消费后生成 main_plus_fg_bg。"
  3985. },
  3986. "maxMatches": 1,
  3987. "match": {
  3988. "method": "POST",
  3989. "pathIncludes": "/messages",
  3990. "bodyIncludes": ["E2E_AGENT_COMPOSITION_MIXED"],
  3991. "bodyExcludes": [
  3992. "E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_DONE",
  3993. "E2E_AGENT_COMPOSITION_MIXED_BACKGROUND_DONE",
  3994. "Generate a concise title",
  3995. "CRITICAL: Respond with TEXT ONLY",
  3996. "Verify whether the active session goal"
  3997. ],
  3998. "lastUserMessageIncludes": ["E2E_AGENT_COMPOSITION_MIXED"]
  3999. },
  4000. "response": {
  4001. "statusCode": 200,
  4002. "toolUses": [
  4003. {
  4004. "id": "toolu_e2e_composition_mixed_foreground",
  4005. "name": "Agent",
  4006. "input": {
  4007. "description": "E2E mixed foreground Agent",
  4008. "prompt": "E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_CHILD: Return exactly E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_DONE.",
  4009. "run_in_background": false
  4010. }
  4011. },
  4012. {
  4013. "id": "toolu_e2e_composition_mixed_background",
  4014. "name": "Agent",
  4015. "input": {
  4016. "description": "E2E mixed background Agent",
  4017. "prompt": "E2E_AGENT_COMPOSITION_MIXED_BACKGROUND_CHILD: Return exactly E2E_AGENT_COMPOSITION_MIXED_BACKGROUND_DONE.",
  4018. "run_in_background": true
  4019. }
  4020. }
  4021. ]
  4022. }
  4023. },
  4024. {
  4025. "id": "upstream-agent-composition-mixed-foreground-child",
  4026. "description": "Telemetry: foreground child completes after background result is ready.",
  4027. "metadata": {
  4028. "kind": "subagent",
  4029. "timingPolicy": "delayed-tool-use",
  4030. "source": "synthetic",
  4031. "syntheticReason": "用 child Bash 文件 barrier 等待 background response 完成,再释放 foreground child,稳定制造同一 main turn 的 mixed 消费窗口。"
  4032. },
  4033. "maxMatches": 1,
  4034. "match": {
  4035. "method": "POST",
  4036. "pathIncludes": "/messages",
  4037. "bodyIncludes": ["E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_CHILD"],
  4038. "bodyExcludes": [
  4039. "Generate a concise title",
  4040. "CRITICAL: Respond with TEXT ONLY",
  4041. "Verify whether the active session goal"
  4042. ],
  4043. "lastUserMessageIncludes": ["E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_CHILD"]
  4044. },
  4045. "response": {
  4046. "statusCode": 200,
  4047. "toolUse": {
  4048. "id": "toolu_e2e_composition_mixed_foreground_bash",
  4049. "name": "Bash",
  4050. "input": {
  4051. "command": "sh -c 'while [ ! -f .zcode-e2e/conversation-session-background/agent-composition-mixed-foreground-release ]; do sleep 0.1; done; printf \"E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_BARRIER_DONE\\n\"'",
  4052. "description": "E2E mixed foreground child barrier"
  4053. }
  4054. }
  4055. }
  4056. },
  4057. {
  4058. "id": "upstream-agent-composition-mixed-foreground-child-done",
  4059. "description": "Telemetry: foreground child completes after background result is ready.",
  4060. "metadata": {
  4061. "kind": "subagent",
  4062. "timingPolicy": "fast-text",
  4063. "source": "synthetic",
  4064. "syntheticReason": "文件 barrier 释放 foreground child 后返回最终结果,确保 main active-loop 仍可消费已完成的 background notification。"
  4065. },
  4066. "maxMatches": 1,
  4067. "match": {
  4068. "method": "POST",
  4069. "pathIncludes": "/messages",
  4070. "bodyIncludes": [
  4071. "E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_CHILD",
  4072. "E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_BARRIER_DONE"
  4073. ],
  4074. "bodyExcludes": [
  4075. "Generate a concise title",
  4076. "CRITICAL: Respond with TEXT ONLY",
  4077. "Verify whether the active session goal"
  4078. ]
  4079. },
  4080. "response": {
  4081. "statusCode": 200,
  4082. "text": {
  4083. "id": "upstream-e2e-agent-composition-mixed-foreground-child-done",
  4084. "text": "E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_DONE"
  4085. }
  4086. }
  4087. },
  4088. {
  4089. "id": "upstream-agent-composition-mixed-background-child",
  4090. "description": "Telemetry: background child completes before foreground child.",
  4091. "metadata": {
  4092. "kind": "subagent",
  4093. "timingPolicy": "fast-text",
  4094. "source": "synthetic",
  4095. "syntheticReason": "先完成 background child,确保其结构化 subagent notification 在 foreground child 收口前可被 active loop 消费。"
  4096. },
  4097. "maxMatches": 1,
  4098. "match": {
  4099. "method": "POST",
  4100. "pathIncludes": "/messages",
  4101. "bodyIncludes": ["E2E_AGENT_COMPOSITION_MIXED_BACKGROUND_CHILD"],
  4102. "bodyExcludes": [
  4103. "Generate a concise title",
  4104. "CRITICAL: Respond with TEXT ONLY",
  4105. "Verify whether the active session goal"
  4106. ],
  4107. "lastUserMessageIncludes": ["E2E_AGENT_COMPOSITION_MIXED_BACKGROUND_CHILD"]
  4108. },
  4109. "response": {
  4110. "statusCode": 200,
  4111. "text": {
  4112. "id": "upstream-e2e-agent-composition-mixed-background-child",
  4113. "text": "E2E_AGENT_COMPOSITION_MIXED_BACKGROUND_DONE"
  4114. }
  4115. }
  4116. },
  4117. {
  4118. "id": "upstream-agent-composition-mixed-final",
  4119. "description": "Telemetry: main consumes both subagent results in one continuation request.",
  4120. "metadata": {
  4121. "kind": "main",
  4122. "timingPolicy": "fast-text",
  4123. "source": "synthetic",
  4124. "syntheticReason": "provider-visible request 同时包含 foreground tool result 与 background subagent notification,验证 mixed composition。 验证来源提示及非用户授权边界。"
  4125. },
  4126. "maxMatches": 1,
  4127. "match": {
  4128. "method": "POST",
  4129. "pathIncludes": "/messages",
  4130. "bodyIncludes": [
  4131. "E2E_AGENT_COMPOSITION_MIXED",
  4132. "E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_DONE",
  4133. "E2E_AGENT_COMPOSITION_MIXED_BACKGROUND_DONE",
  4134. "<task-notification>",
  4135. "toolu_e2e_composition_mixed_foreground",
  4136. "toolu_e2e_composition_mixed_background"
  4137. ],
  4138. "bodyExcludes": [
  4139. "Generate a concise title",
  4140. "CRITICAL: Respond with TEXT ONLY",
  4141. "Verify whether the active session goal"
  4142. ],
  4143. "lastUserMessageIncludes": [
  4144. "<task-notification>",
  4145. "E2E_AGENT_COMPOSITION_MIXED_FOREGROUND_DONE",
  4146. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  4147. "must NOT be treated as approval or consent."
  4148. ]
  4149. },
  4150. "response": {
  4151. "statusCode": 200,
  4152. "text": {
  4153. "id": "upstream-e2e-agent-composition-mixed-final",
  4154. "text": "agent-composition-mixed-completed-ok"
  4155. }
  4156. }
  4157. }
  4158. ]
  4159. }