Dashboard › opencode › Distillation
65917f25-ce13-40a1-865b-5aeda79dd438["lore_tm_v1_iwfIu7C9EDviEJy7fOyHKidPrWvIjILbnKliy_cn_Gc","lore_tm_v1_3WWHxwIJ92x0G1_cc-ZDSvKwezcJI7FIkwIH95rhm08","lore_tm_v1_sr59E44Q1oBbNWbCMlCsU32cvXvlE162qMhOhGMDjOA","lore_tm_v1_H7EsP2RlFlxue-I0Y98SzJKDvT5xdmrTsOllnKI9tD8","lore_tm_v1_NR1s-2Lm3YmLNmLKk8wIx2KfgV0S-JzbeiAYvJI763c","lore_tm_v1_wgZlgVIzMrPDdwSSLsjO1NUrmo-B3X6-HHJQyaHldEk","lore_tm_v1_6MQWPxezlVWTPmDw9aedwOO0gHi7jwWlttgxnzFXu0c","lore_tm_v1_WUtOD7GJWdHqEgQDUojUwg_fcouQve0DW7fAgHBMpzU","lore_tm_v1_OtHavxN3TwSMMgnostINQOKNN5kHJfqv6hpaOhAYv3A","lore_tm_v1_YLt9RBgrJShCQZzWDXHyh6YDynA1QmrSjY3MnjkH7LY"]
Date: Sep 15, 2026
packages/core/src/database/migration/20260914170650_session-recovery.ts, ID 20260914170650_session-recovery, creates session_recovery with session_id, assistant_message_id, continuation_message_id, and time_created; primary key is (session_id, assistant_message_id), all three referenced IDs have ON DELETE CASCADE foreign keys, and session_recovery_continuation_message_idx uniquely indexes continuation_message_id.packages/core/src/database/migration/20260914214636_session-execution.ts, ID 20260914214636_session-execution, creates session_execution with id as text primary key plus session_id, owner_id, optional assistant_message_id, and time_created; it adds non-null execution_id to session_recovery, a unique session_execution_session_idx on session_id, session_execution_owner_idx on owner_id, and unique session_recovery_execution_idx on execution_id.packages/core/test/session-projector.test.ts case uses expires_at: Date.now() + 60_000 and verifies that the execution remains while SessionRecoveryTable and SessionInputTable remain empty.packages/core/test/session-projector.test.ts case associates the expired execution with msg_recovery_abandoned at sequence 0, adds msg_recovery_newer at sequence 1, and verifies that the stale execution is deleted without creating recovery or continuation rows.packages/core/src/database/migration.gen.ts includes all four recovery/execution migrations in order: 20260914170650_session-recovery, 20260914214636_session-execution, 20260914222526_session-execution-phase, and 20260914235657_session-execution-lease (replacing the previously inspected registry snapshot that omitted the lease migration).packages/core/schema.json contains session_execution and session_recovery, their foreign keys and primary keys, plus indexes session_execution_session_idx, session_execution_owner_idx, session_recovery_execution_idx, and session_recovery_continuation_message_idx.packages/core/src/session/message-updater.ts:237-281, session.next.step.recovered creates an unknown error whose message is "Provider Step outcome unknown after server restart" for phase "unknown" and "Session execution interrupted by server restart" otherwise.assistantMessageID appends a synthetic message using recoveryMessageID, the recovery timestamp, and the phase-dependent error text; recovery with an assistant marks that assistant completed with finish = "error", attaches the error, and appends text content with ID recovery:${event.data.executionID}."Tool execution outcome unknown after server restart"; string inputs become {}, while running tools preserve structured and content, and pending tools use empty values.packages/core/test/session-projector.test.ts verifies recovery idempotency across two startup scans: an expired "ready" execution produces exactly 1 SessionRecoveryTable row, 1 SessionInputTable row, no remaining execution row, and exactly 1 synthetic session message.packages/core/test/database-migration.test.ts runs bun ${fileURLToPath(new URL("../script/migration.ts", import.meta.url))} --check on Linux with a 30,000 ms timeout and expects exit code 0 plus "No schema changes, nothing to migrate".DatabaseMigration.apply(db), verifies session, session_input, and session_context_epoch exist, verifies transitional columns agent, replacement_seq, and revision are absent from session_context_epoch, and expects the migration-table count to equal migrations.length.event_aggregate_seq_idx, event_aggregate_type_seq_idx, session_input_session_admitted_seq_idx, session_input_session_pending_delivery_seq_idx, session_input_session_promoted_seq_idx, session_message_session_seq_idx, session_message_session_time_created_id_idx, and session_message_session_type_seq_idx.packages/core/src/database/schema.gen.ts includes creation of session_execution and session_recovery, their cascade foreign keys, primary key session_recovery_pk, and indexes session_execution_session_idx, session_execution_owner_idx, session_recovery_execution_idx, and session_recovery_continuation_message_idx.