todo: give plans their own table and recover them after a crash
Todo already survived restarts inside the generic session_store KV row, but
the plan there was opaque JSON with no timestamp: after a server crash the
agent resumed a step marked in_progress with no way to tell whether it had
ever been done.

session_todos (user_id, session_id, tasks JSONB, revision, updated_at) now
holds the plan. Existing rows are migrated on first use and the KV source is
deleted in the same step, so clearing a plan is not undone by the next
process start.

Each step gains provenance fields (source, step_id, protocol_run_id) for the
protocol work, and insert_steps() splices a block after the step the agent
has already reached instead of making it re-issue the whole plan.

get_progress_message() now flags a plan whose in_progress step predates this
process once per (session, revision): re-check the real result before
marking it done.

The todo op "clear" now uses the same user scope as load/save; it used to
prefer ctx.user_id and could delete a different row than the one written.
1 parent 42a110c commit 6f1740c62779bf58d1ccfa243aa22e4475055598
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored 1 day ago
Showing 12 changed files
View
docs/index.md
View
docs/store.md
View
docs/todo-store.md 0 → 100644
View
manuals/todo.md
View
navi/api/deps.py
View
navi/api/routes/sessions.py
View
navi/core/container.py
View
navi/core/registry.py
View
navi/todo_store.py 0 → 100644
View
navi/tools/todo.py
View
tests/unit/store/test_todo_store.py 0 → 100644
View
tests/unit/tools/test_todo.py