Dashboard › opencode › Distillation
8b3ab4bc-89f4-4d57-a9c6-569900be5dc4["lore_tm_v1_qdugHMPWiIVTUIQFw6uwXJMD_Mr_HyzuDZzoGA6RWVU","lore_tm_v1_oEJcc3XGtins-NyXFsMByESpLkSYDxy432yBwUtcAzM","lore_tm_v1_-8wQYeQD_vutBYnBvPi_BfdVnOOq7copS4kfyieEKXA","lore_tm_v1_fobulWOrxZgTR5D0iRfrXREmgDwBdSCo-cYZPiu9m8Y","lore_tm_v1_tSkgi0tU-Jzff3xi8O4Z5XwEfyy4QAeGOoNQM3PEukg","lore_tm_v1_7HbTf9d3J-A5S8Xpc-Gk1riQ01VQDyjXKvhGZd0X9mI","lore_tm_v1_uUK50tHUFfaNKxKiIuwSSfUmmdC1_Hw2dFpiFj4ELb0","lore_tm_v1_4NMiXMRWpT5UuUPmX7v2imjFAk29DMZG56LLfLYImsU"]
Date: Sep 17, 2026
packages/core/src/database/migration.gen.ts dynamically imports 39 migrations in chronological order, ending with 20260914170650_session-recovery, and maps each moduleβs default export to DatabaseMigration.Migration[].packages/core/src/database/migration.gen.ts, in order, are: 1. 20260127222353_familiar_lady_ursula, 2. 20260211171708_add_project_commands, 3. 20260213144116_wakeful_the_professor, 4. 20260225215848_workspace, 5. 20260227213759_add_session_workspace_id, 6. 20260228203230_blue_harpoon, 7. 20260303231226_add_workspace_fields, 8. 20260309230000_move_org_to_state, 9. 20260312043431_session_message_cursor, 10. 20260323234822_events, 11. 20260410174513_workspace-name, 12. 20260413175956_chief_energizer, 13. 20260423070820_add_icon_url_override, 14. 20260427172553_slow_nightmare, 15. 20260428004200_add_session_path, 16. 20260501142318_next_venus, 17. 20260504145000_add_sync_owner, 18. 20260507164347_add_workspace_time, 19. 20260510033149_session_usage, 20. 20260511000411_data_migration_state, 21. 20260511173437_session-metadata, 22. 20260601010001_normalize_storage_paths, 23. 20260601202201_amazing_prowler, 24. 20260602002951_lowly_union_jack, 25. 20260602182828_add_project_directories, 26. 20260603001617_session_message_projection_indexes, 27. 20260603040000_session_message_projection_order, 28. 20260603141458_session_input_inbox, 29. 20260603160727_jittery_ezekiel_stane, 30. 20260604172448_event_sourced_session_input, 31. 20260605003541_add_session_context_snapshot, 32. 20260605042240_add_context_epoch_agent, 33. 20260611035744_credential, 34. 20260611192811_lush_chimera, 35. 20260612174303_project_dir_strategy, 36. 20260622142730_simplify_session_context_epoch, 37. 20260622170816_reset_v2_session_state, 38. 20260622202450_simplify_session_input, 39. 20260914170650_session-recovery.packages/core/src/database/schema.gen.ts creates session_execution with primary key session_execution_pk, a cascading foreign key from session_id to session.id, and session_execution_phase_check restricting phase to 'ready', 'safe', 'unknown', 'continue', 'cancelling', or 'cancelled'.packages/core/src/database/schema.gen.ts creates session_recovery keyed by execution_id; it has cascading foreign keys from session_id to session.id, assistant_message_id to session_message.id, and continuation_message_id to session_input.id. Its wake_pending defaults to true, wake_attempts defaults to 0, and session_recovery_wake_attempts_check requires wake_attempts between 0 and 9007199254740991.session_execution_session_idx on session_execution(session_id), session_execution_owner_idx on session_execution(owner_id), session_execution_recovery_scan_idx on (recovery_error, expires_at, time_created, id), session_input_wake_pending_promoted_session_idx on (wake_pending, promoted_seq, session_id), unique session_recovery_continuation_message_idx on session_recovery(continuation_message_id), and session_recovery_wake_pending_error_attempts_created_execution_idx on (wake_pending, recovery_error, wake_attempts, time_created, execution_id).abf93718acd0193fa2ca6cfc205cde8714eff23d7df42a4f093a55e9921fd1a3, prior schema ID f14a9b18-8207-487e-a3d3-227e629ba9ad, and ID list ['169a0f0f-d58f-479f-b024-fa1c7b9a09db'].SessionExecutionLocal to never start a second owner while the lease is live.SessionExecutionLocal to never overwrite an expired lease.SessionExecutionLocal to never re-enter its own uncertain live lease.SessionExecutionLocal to never revive an expired claim on heartbeat.packages/core/test/session-execution-local.test.ts uses testEffect(Database.layerFromPath(":memory:")), defines sessionID as SessionSchema.ID.make("ses_execution_local"), and contains concurrency tests using Deferred, child fibers/scopes, finalizer gates, TestClock.adjust("10 seconds"), and direct inspection of execution claims.packages/core/test/session-run-coordinator.test.ts verifies that concurrent interruptions join behind one cleanup barrier: while cleanup is gated, cleanups remains 1, both interruption fibers remain unfinished, and runs remains 1; after releasing cleanupGate, both interruption fibers join, a follow-up starts, cleanups remains 1, and runs becomes 2.SessionRunCoordinator test "starts one follow-up when a wake races with failure" makes the first run wait and then fail with new Error("failed"); a concurrent wake("session") causes exactly one second run, the original waiter receives the same failure, and runs equals 2.SessionRunCoordinator test "does not cancel execution when a joined waiter is interrupted" starts two callers for the same "session" key, interrupts the joined second waiter, releases the active run, and verifies the drain ran exactly once.SessionRunCoordinator test "runs different keys concurrently" starts keys "first" and "second" and waits until both drains are active simultaneously.SessionRunCoordinator test "trampolines synchronous self-waking execution" repeatedly wakes "session" synchronously up to limit = 20_000 and verifies exactly 20_000 runs, guarding against recursive stack growth.SessionRunCoordinator coverage includes joining a wake-started execution without forcing a successor, follow-up runs after wakes, repeated waking during a follow-up, cleanup/interruption barriers, failure behavior, and coordinator active key tracking.packages/core/test/session-projector.test.ts contains 41 named recovery/projector scenarios, in order: 1. "atomically reconciles one abandoned execution into one continuation", 2. "never continues a Step that durably failed before owner loss", 3. "records a recovery continuation without forging an assistant identity", 4. "recovers each abandoned execution once across repeated startup scans", 5. "never recovers a live execution lease", 6. "never recovers an execution superseded by a newer assistant", 7. "recovers assistant-less continuation at its current assistant boundary", 8. "redrives a durable recovery wake after admission", 9. "quarantines a malformed recovery row without blocking a valid wake", 10. "quarantines a full batch of poison recovery rows before redriving valid work", 11. "fairly redrives recovery and ordinary work beyond a full bounded batch", 12. "resets ordinary wake retry debt after fresh prompt promotion", 13. "rejects invalid persisted wake attempt counters", 14. "never wakes work settled between selection and redrive CAS", 15. "quarantines a continuation that belongs to another Session", 16. "redrives durable ordinary input execution intent after a lost advisory wake", 17. "redrives ordinary input without recovering a claim that crashed before promotion", 18. "redrives an explicitly resumed admit-only input after a pre-promotion crash", 19. "redrives one existing recovery after its replacement claim crashes before promotion", 20. "never recovers a pre-promotion claim when input commits at the recovery boundary", 21. "rejects a recovered assistant from another Session", 22. "rejects a recovery execution identity owned by another Session", 23. "quarantines an execution claim blocked by a conflicting recovery identity", 24. "quarantines a recovery wake behind a newer assistant", 25. "never promotes a recovery superseded before scanner validation", 26. "never quarantines an exact recovery conflict after ownership transfer", 27. "quarantines an assistant-less recovery superseded before scanner validation", 28. "never promotes a quarantined recovery continuation as an ordinary steer", 29. "never recovers an expired cancellation claim", 30. "never quarantines cancellation after recovery ownership expires", 31. "never quarantines cancellation after recovery ownership transfers", 32. "never quarantines projection failure after recovery ownership expires", 33. "never quarantines projection failure after recovery ownership transfers", 34. "quarantines failed execution conversion before scanning later claims", 35. "rotates maximum wake attempt counters before issuing wakes", 36. "bounds each deterministic recovery scan", 37. "rolls back promotion and Context Epoch mutation after ownership loss", 38. "never advances the Context Epoch after ownership changes", 39. "fences a paused owner after expiry, reconciliation, and takeover", 40. "does not revive a stale incomplete in-memory assistant projection", 41. "does not revive a stale incomplete assistant projection".