fix review findings for session queries

This commit is contained in:
Hypatia May
2026-07-24 15:58:03 +08:00
parent bc47884a77
commit 01b70fd6fd
4 changed files with 58 additions and 11 deletions

View File

@@ -134,7 +134,7 @@ Additional instructions from: nested\AGENTS.md`,
type: 'content',
content: {
type: 'text',
text: 'Target event:\n```json\n{\n "seq": 4,\n "time": 1784876275593,\n "data": {}\n}\n```',
text: 'Session prior — title\nTarget event seq 4:\n```json\n{\n "seq": 4,\n "time": 1784876275593,\n "data": {}\n}\n```',
},
}],
},
@@ -145,6 +145,28 @@ Additional instructions from: nested\AGENTS.md`,
expect(out).not.toContain('1784876275593')
})
it('preserves event-like timestamps in unrelated output text', () => {
const raw = JSON.stringify({
jsonrpc: '2.0',
method: 'session/update',
params: {
update: {
sessionUpdate: 'tool_call_update',
content: [{
type: 'content',
content: {
type: 'text',
text: 'bash output:\n```json\n{\n "time": 1784876275593,\n "data": {}\n}\n```',
},
}],
},
},
})
const out = normalizeStdout(raw, ctx)
expect(out).toContain('1784876275593')
expect(out).not.toContain('{{eventTime}}')
})
it('throws on a non-JSON stdout line (the purity check)', () => {
const raw = `${JSON.stringify({ jsonrpc: '2.0', id: 1 })}\noops a log leaked\n`
expect(() => normalizeStdout(raw, ctx)).toThrow()