Repository navigation
Description
What happened
Runtime Host recovery aborts the entire workspace when a non-terminal ScheduledTask root admission still exists after its pending fire has already been settled or removed.
During hosted execution recovery, assertRecoveryAdmission() requires every non-terminal ScheduledTask admission to have an exact matching pending fire. If the process stops after fire settlement but before the AgentRun terminal fact is committed, the next startup throws:
ScheduledTask admission <turn-id> has no matching pending fire
The error is surfaced to CLI/TUI as INTERNAL_STARTUP_FAILURE, so unrelated Sessions in the same workspace cannot be opened even though the SQLite database remains valid.
Expected behavior: recovery should reconcile this crash boundary into a durable terminal Run state, or otherwise isolate the affected admission, without preventing the workspace from starting.
How to reproduce
This requires an interruption at a specific durable-state boundary and may be intermittent:
- Allow a ScheduledTask fire to create its root admission and AgentRun.
- Let the pending fire be settled or removed.
- Stop the process before the corresponding AgentRun receives a terminal RuntimeEvent/header update.
- Restart Runtime Host for the same workspace.
- Startup fails while validating the ScheduledTask admission.
The current source path demonstrates the ordering:
packages/runtime-host/src/server/hosted-execution-recovery.ts:80-86validates every non-terminal ScheduledTask admission before ordinary recovery closure.packages/runtime-host/src/server/scheduled-task-coordinator.ts:168-187throws whenever no exact pending-fire match exists.
The missing state combination is:
root admission: present
AgentRun: running
pending fire: absent
terminal RuntimeEvent: absent
Environment
- Maka commit:
b21392287(origin/main, verified 2026-08-29) - OS: Linux
- Surface: CLI/TUI and Runtime Host
- Node.js: 26.3.0
Logs, screenshots, or additional context
The database integrity check can still report ok; this is a cross-record recovery invariant gap rather than SQLite corruption.
The repair should preserve the Session, messages, ScheduledTask record, and admission history. Only the interrupted execution needs a canonical terminal/recovery fact. A regression test should construct the four-record state above and verify that Runtime Host reaches ready state without replaying the ScheduledTask effect.
Activity
me2seeks commentedon Aug 29, 2026
I'd like to work on this. I'll open a PR once the fix and tests are ready.