@@ -6,14 +6,15 @@ scenario:
66 coverage :
77 primary :
88 - agent-runtime.failure-recovery-reasoning-only-recovery
9- secondary :
109 - agent-runtime.failure-recovery-retry-policy
10+ - agent-runtime.failure-recovery-no-fake-progress
1111 objective : Verify a GPT-style reasoning-only turn after a mutating write stays replay-unsafe and does not auto-retry.
1212 successCriteria :
1313 - Scenario is mock-openai only so live lanes do not pick it up implicitly.
1414 - The agent performs the seeded mutating write.
1515 - Mock trace does not include an automatic reasoning-only retry instruction.
1616 - Mock trace stops after the write-side reasoning-only terminal turn instead of attempting a continuation.
17+ - Exactly one visible warning reports that side effects may already have happened.
1718 docsRefs :
1819 - docs/help/testing.md
1920 codeRefs :
@@ -28,6 +29,8 @@ scenario:
2829 prompt : " Reasoning-only after write safety check: write reasoning-only-side-effect.txt, then answer with exactly SIDE-EFFECT-GUARD-OK."
2930 retryNeedle : recorded reasoning but did not produce a user-visible answer
3031 outputFile : reasoning-only-side-effect.txt
32+ expectedWarning : " ⚠️ Agent couldn't generate a response. Note: some tool actions may have already been executed — please verify before retrying."
33+ forbiddenReplyNeedles : [SIDE-EFFECT-GUARD-OK, successfully, completed, complete]
3134
3235flow :
3336 steps :
4144 - ref : env
4245 - 60000
4346 - call : reset
47+ - set : outboundStartIndex
48+ value :
49+ expr : " state.getSnapshot().messages.filter((message) => message.direction === 'outbound').length"
4450 - set : requestCursorBefore
4551 value :
4652 expr : " env.mock ? (await fetchJson(`${env.mock.baseUrl}/debug/request-cursor`)).cursor : 0"
6167 value :
6268 expr : " await env.gateway.call('agent.wait', { runId: started.runId, timeoutMs: liveTurnTimeoutMs(env, 45000) }, { timeoutMs: liveTurnTimeoutMs(env, 50000) })"
6369 - assert :
64- expr : " ['ok', 'completed', 'succeeded'].includes( String(waited?.status)) || (waited?.status === 'error' && String(waited?.error ?? '').trim().toLowerCase() === 'completed') "
70+ expr : " String(waited?.status) === 'error' && String(waited?.error) === 'failed' "
6571 message :
66- expr : " `agent.wait returned ${String(waited?.status ?? 'unknown')}: ${String(waited?.error ?? '')}`"
72+ expr : " `agent.wait should expose the terminal no-visible-answer failure, got ${String(waited?.status ?? 'unknown')}: ${String(waited?.error ?? '')}`"
6773 - call : fs.readFile
6874 saveAs : sideEffect
6975 args :
@@ -73,19 +79,49 @@ flow:
7379 expr : " sideEffect.includes('side effects already happened')"
7480 message :
7581 expr : " `side-effect file missing expected contents: ${sideEffect}`"
82+ - set : warning
83+ value :
84+ expr : " (async () => { const deadline = Date.now() + liveTurnTimeoutMs(env, 30000); do { const message = state.getSnapshot().messages.filter((candidate) => candidate.direction === 'outbound').slice(outboundStartIndex).find((candidate) => candidate.conversation.id === 'qa-operator' && candidate.text === config.expectedWarning); if (message) { return message; } await sleep(100); } while (Date.now() < deadline); throw new Error('timed out waiting for the side-effect warning'); })()"
85+ - call : sleep
86+ args :
87+ - 300
88+ - set : scenarioOutbound
89+ value :
90+ expr : " state.getSnapshot().messages.filter((message) => message.direction === 'outbound').slice(outboundStartIndex).filter((message) => message.conversation.id === 'qa-operator')"
91+ - call : readSessionTranscriptSummary
92+ saveAs : transcript
93+ args :
94+ - ref : env
95+ - ref : sessionKey
7696 - if :
7797 expr : " Boolean(env.mock)"
7898 then :
7999 - set : scenarioRequests
80100 value :
81- expr : " (await fetchJson(`${env.mock.baseUrl}/debug/requests?after=${requestCursorBefore}`))"
101+ expr : " (await fetchJson(`${env.mock.baseUrl}/debug/requests?after=${requestCursorBefore}`)).filter((request) => String(request.allInputText ?? '').includes(config.promptSnippet))"
102+ - set : retryRequests
103+ value :
104+ expr : " scenarioRequests.filter((request) => String(request.allInputText ?? '').includes(config.retryNeedle))"
82105 - assert :
83- expr : " scenarioRequests.some((request) => String(request.allInputText ?? '').includes(config.promptSnippet) && request.plannedToolName === 'write')"
84- message : expected mutating write request in mock trace
106+ expr : " scenarioRequests.length === 2 && scenarioRequests[0]?.plannedToolName === 'write' && !scenarioRequests[1]?.plannedToolName"
107+ message :
108+ expr : " `expected exactly one write request plus one reasoning-only terminal request: ${JSON.stringify(scenarioRequests.map((request) => ({ cursor: request.cursor, tool: request.plannedToolName ?? null, callId: request.toolOutputCallId ?? null })))}`"
85109 - assert :
86- expr : " !scenarioRequests.some((request) => String(request.allInputText ?? '').includes(config.retryNeedle)) "
110+ expr : " retryRequests.length === 0 "
87111 message : reasoning-only retry instruction should not be injected after a write
88112 - assert :
89- expr : " scenarioRequests.filter((request) => String(request.allInputText ?? '').includes(config.promptSnippet)).length === 2"
90- message : expected exactly the write request plus the reasoning-only terminal request
91- detailsExpr : " env.mock ? `requests=${String(scenarioRequests?.length ?? 0)} sideEffect=${sideEffect.trim()}` : sideEffect"
113+ expr : " typeof scenarioRequests[0]?.plannedToolCallId === 'string' && scenarioRequests[0].plannedToolCallId.length > 0 && scenarioRequests[1]?.toolOutputCallId === scenarioRequests[0].plannedToolCallId && String(scenarioRequests[1]?.toolOutput ?? '').length > 0"
114+ message : committed write result did not match its planned tool call
115+ - assert :
116+ expr : " transcript.userMessageCount === 1 && transcript.assistantToolCallCounts.write === 1 && transcript.completedToolCallCounts.write === 1 && transcript.successfulToolCallCounts.write === 1"
117+ message :
118+ expr : " `write transcript did not persist exactly one successful side effect: ${JSON.stringify(transcript)}`"
119+ - assert :
120+ expr : " scenarioOutbound.length === 1 && warning.text === config.expectedWarning && scenarioOutbound[0]?.text === config.expectedWarning"
121+ message :
122+ expr : " `expected exactly one visible side-effect warning: ${JSON.stringify(scenarioOutbound.map((message) => message.text))}`"
123+ - assert :
124+ expr : " config.forbiddenReplyNeedles.every((needle) => !normalizeLowercaseStringOrEmpty(warning.text).includes(normalizeLowercaseStringOrEmpty(needle))) && !normalizeLowercaseStringOrEmpty(transcript.finalText).includes(normalizeLowercaseStringOrEmpty('SIDE-EFFECT-GUARD-OK'))"
125+ message :
126+ expr : " `side-effect warning or transcript claimed success/completion: warning=${warning.text} final=${transcript.finalText}`"
127+ detailsExpr : " env.mock ? `requests=${String(scenarioRequests?.length ?? 0)} writes=${String(transcript.successfulToolCallCounts.write ?? 0)} warning=${warning.text}` : sideEffect"
0 commit comments