fix(session): remove invalid recovery input guard

This commit is contained in:
Tianyi Cui committed 2026-09-25 23:48:44 +08:00
1 parent 6a6f350b94
commit eafd5b6068
2 files changed
+1 -23

No files matched your search

@@ -96,28 +96,6 @@ describe('ToolCallRecovery', () => {
expect(recovery.results().map(event => event.data.message.toolCallId)).toEqual([ToolCallId('started'), ToolCallId('pending')])
})
it('ignores historical assistant replacements when tracking current requests', () => {
const recovery = new ToolCallRecovery()
const current = liveToolRequests()
recovery.observe(current)
recovery.observe({
...current, seq: SessionSeq(22),
surfaceOp: { op: 'replace', startSeq: SessionSeq(10), endSeq: SessionSeq(10) },
data: {
...current.data, turn: 2, step: 1,
message: createMessage({
role: 'assistant', source: { kind: 'model', provider: 'mock', model: 'mock' },
content: [
...current.data.message.content,
{ type: 'tool-call', id: ToolCallId('old-only'), name: 'bash', arguments: '{}' },
],
}),
},
})
expect(recovery.results().map(event => [event.data.message.toolCallId, event.data.turn, event.data.step]))
.toEqual([[ToolCallId('started'), 3, 2], [ToolCallId('pending'), 3, 2]])
})
})
const causes: OpenTurnCloseCause[] = [{ kind: 'interrupted' }, { kind: 'forked' }]
+1 -1
View File
@@ -2559,7 +2559,7 @@ def normalize_snapshot_value(
if isinstance(dt, list):
member["dt"] = [0] * len(dt)
if isinstance(normalized.get("id"), str) and normalized.get("role") in ("assistant", "system", "user", "tool", "developer"):
# Released artifact validation binds unstarted-result ids to their call and event sequence.
# Replay fixtures retain deterministic repair ids with the call id and original event sequence.
source = normalized.get("source")
call_id = normalized.get("toolCallId") if normalized.get("role") == "tool" else (
source.get("callId") if isinstance(source, dict) and source.get("kind") == "tool" else None