v2: fix agent-runner lifecycle and session DB reliability
- Use DELETE journal mode for session DBs instead of WAL. WAL doesn't sync reliably across Docker volume mounts (VirtioFS), causing dropped writes and duplicate deliveries. - Add 20s idle detection to end the query stream. The concurrent poll tracks SDK activity via a new 'activity' provider event. When no SDK events arrive for 20s and no messages are pending, the stream ends and the poll loop continues. - Add touchProcessing heartbeat so the host can distinguish active agents from idle ones by checking status_changed recency. - Catch query errors in the poll loop and write error responses to messages_out instead of crashing the process. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -120,10 +120,11 @@ describe('mock provider', () => {
|
||||
events.push(event);
|
||||
}
|
||||
|
||||
expect(events.length).toBeGreaterThanOrEqual(2);
|
||||
expect(events[0].type).toBe('init');
|
||||
expect(events[1].type).toBe('result');
|
||||
expect((events[1] as { text: string }).text).toBe('Echo: Hello');
|
||||
const typed = events.filter((e) => e.type !== 'activity');
|
||||
expect(typed.length).toBeGreaterThanOrEqual(2);
|
||||
expect(typed[0].type).toBe('init');
|
||||
expect(typed[1].type).toBe('result');
|
||||
expect((typed[1] as { text: string }).text).toBe('Echo: Hello');
|
||||
});
|
||||
|
||||
it('should handle push() during active query', async () => {
|
||||
|
||||
Reference in New Issue
Block a user