fix(hub): resume interrupted owned turns

Provider session rehydration does not continue foreground work lost during daemon shutdown. Persist narrowly scoped Hub execution intent and replay only an interrupted running initial turn.
This commit is contained in:
Mohamed Boudra
2026-07-13 12:50:24 +02:00
parent ca393ab436
commit 8f5685b4c4
9 changed files with 333 additions and 16 deletions
+7
View File
@@ -22,6 +22,8 @@ $PASEO_HOME/
├── agents/
│ └── {sanitized-cwd}/
│ └── {agentId}.json # One file per agent
├── hub-executions/
│ └── {relationship-execution-hash}.json # Interrupted Hub turn resume intent
├── schedules/
│ └── {scheduleId}.json # One file per schedule
├── chat/
@@ -39,6 +41,11 @@ $PASEO_HOME/
The `agents/{sanitized-cwd}/` directory name is derived from the agent's `cwd` by stripping the filesystem root and replacing path separators with `-` (Windows drive letters become a `C-` style prefix). Persistent server stores write atomically by writing a temp file in the target directory and then renaming it into place.
Hub execution resume intents contain the relationship ID, execution ID, original prompt, and stable
message ID only while the owned initial turn is running. They are separate from agent snapshots so
ordinary trusted-client prompts never acquire restart replay behavior. Terminal or completed Hub
turns remove the intent; a stored non-running agent also clears any stale file during reconciliation.
---
## 1. Agent Record
+7
View File
@@ -34,6 +34,13 @@ execution resolve to the same durable agent. On reconnect or daemon restart, Hub
reads that stored association and returns current state; transient stream frames are not durably
replayed.
While a Hub-owned initial turn is running, the daemon also keeps a relationship-owned resume intent
containing that prompt and a stable message ID. Provider session resume restores conversation state
but does not generically continue work interrupted by daemon shutdown, so reconciliation reloads the
same agent and replays only that armed turn. A normal socket reconnect or duplicate create sees the
live run and does not replay it. Completion, failure, cancellation, archive, or any persisted state
other than `running` disarms the intent.
Hub creates use the same agent creation path as trusted clients. They may select any existing
worktree target shape and may request `autoArchive`. Worktree creation and terminal auto-archive use
the shared workspace-aware lifecycle policy; Hub does not have a second launch or cleanup path.