v2: split session DB into inbound/outbound for write isolation
Eliminates SQLite write contention across the host-container mount boundary by splitting the single session.db into two files, each with exactly one writer: inbound.db — host writes (messages_in, delivered tracking) outbound.db — container writes (messages_out, processing_ack) Key changes: - Host uses even seq numbers, container uses odd (collision-free) - Container heartbeat via file touch instead of DB UPDATE - Scheduling MCP tools now emit system actions via messages_out (host applies them to inbound.db during delivery) - Host sweep reads processing_ack + heartbeat file for stale detection - OneCLI ensureAgent() call added (was missing from v2, caused applyContainerConfig to reject unknown agent identifiers) Verified: tsc clean, 327 tests pass, real e2e through Docker works. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -162,7 +162,7 @@ describe('channel + router integration', () => {
|
||||
it('should route inbound message from adapter to session DB', async () => {
|
||||
const { routeInbound } = await import('../router.js');
|
||||
const { findSession } = await import('../db/sessions.js');
|
||||
const { sessionDbPath } = await import('../session-manager.js');
|
||||
const { inboundDbPath } = await import('../session-manager.js');
|
||||
|
||||
// Simulate what the adapter bridge does: stringify content, call routeInbound
|
||||
const inboundContent = { sender: 'TestUser', senderId: 'u1', text: 'Hello from adapter', isFromMe: false };
|
||||
@@ -183,7 +183,7 @@ describe('channel + router integration', () => {
|
||||
const session = findSession('mg-1', null);
|
||||
expect(session).toBeDefined();
|
||||
|
||||
const dbPath = sessionDbPath('ag-1', session!.id);
|
||||
const dbPath = inboundDbPath('ag-1', session!.id);
|
||||
const db = new Database(dbPath);
|
||||
const rows = db.prepare('SELECT * FROM messages_in').all() as Array<{ id: string; content: string }>;
|
||||
db.close();
|
||||
|
||||
Reference in New Issue
Block a user