OpenProgram Docs

In-flight state recovery

What happensWhat the chat showsSource
Page refresh, worker aliveThe running row with its latest saved state, then numbered updates and text frames placed by offsetThe row as stored, running_task frame, transcript_update
Run ended during the loadThe running slot closesrunning_task_clear
Worker restartRow marked interrupted, amber, with “Worker restarted before this turn finished”reconcile_interrupted_runs
Open question or approvalThe card is drawn again_replay_open_waits

Placeholders

Work that runs for a while writes its node before it starts. Status lives in metadata; the Call dataclass does not change.

ProducerWritten bySaved while running
Assistant replyturn_lifecycle.py: empty role="llm" row with status="running", worker_id, started_atText and thinking blocks as they stream, through stream_tap's quiet path (update_stream_progress, not fsynced) before each frame goes out; the full row at the end of the turn, partial output on cancel
Agent method runPlaceholder <msg_id>_replyThe live reader in execution/projections/dag.py writes context_tree, status and last_update_at
Agent method called by the modelruntime_attach.py: display=runtime rowSame tree
/task --async, mergeslash_actions.py: attach pointerJob status on the card
Sub-agentsub_agent_run.pyJob status on the card

The tree is read again when the run writes a node, at most once a second. It flushes once more at the end, so a refresh after the run shows it done.

Status values
Waiting
pending, paused
Producing
running, streaming, cancelling
Finished
completed, done, error, cancelled, interrupted
No status
_node_to_msg reads an older node as done

Reconnect

A session load returns the saved rows, then running_task for the live run:

{ "type": "running_task",
  "data": { "session_id", "msg_id", "func_name", "execution_id", "status_version",
            "started_at", "display_params", "partial_tree": null,
            "stream_events", "status", "reason_code", "run_seq" } }

Frames are per session; run_seq orders them so a late frame cannot revive a closed slot.

Rows and live trees arrive as numbered transcript_update changes: a function run's tree as a row_patch, a model-issued call's tree in its reply's callRoots. A reloaded tab reads first and then follows the updates; a missed update or a text frame past the row's text makes it read once more.

Worker restart

A new worker has nothing running, so startup reconciles sessions on a background thread, archived ones included: those written since the last finished pass, and those that pass left open (the restart pass). There is no age threshold.

NodeResult
runningBecomes interrupted
cancelling, owner deadBecomes cancelled
cancelling, owner aliveCancellation resumes
Has an open durable waitStays resumable
Execution still activeLeft to the execution

Continuing an execution after a restart is the job of openprogram/runtime/execution/recovery/restart.py, within execution.auto_resume_window_seconds.

Implementation status

ItemState
BuiltPlaceholders, tree persistence, saving a reply's partial text while it streams, status rendering, reconnect frames, restart reconcile
Not builtSubscribing to one message; a panel of active work across sessions
Last updated · 2026-11-25