Persist the agent session id on the sidecar #161

Closed
opened 2026-09-03 23:05:15 +01:00 by naps62-yolo · 0 comments
Collaborator

The Claude Code hook already receives the agent's own conversation id — every payload carries session_id — but the daemon only forwards the UserPromptSubmit payload to the naming route and drops the field everywhere else. Without it stored, a session can be respawned in the right directory but cannot resume the conversation it was having.

Parse session_id out of the body in the activity route (crates/maestro-daemon/src/local_api.rs) and persist it on the Session as agent_session_id, written through to the sidecar. Write it once and leave it alone afterwards; a session id does not change mid-session, and re-writing the sidecar on every PreToolUse would be a lot of disk churn for nothing.

The field is the input to issue "Add POST /api/sessions/:id/resume". Sessions that never run an agent (plain shells) simply leave it unset.

The Claude Code hook already receives the agent's own conversation id — every payload carries `session_id` — but the daemon only forwards the `UserPromptSubmit` payload to the naming route and drops the field everywhere else. Without it stored, a session can be respawned in the right directory but cannot resume the conversation it was having. Parse `session_id` out of the body in the activity route (`crates/maestro-daemon/src/local_api.rs`) and persist it on the `Session` as `agent_session_id`, written through to the sidecar. Write it once and leave it alone afterwards; a session id does not change mid-session, and re-writing the sidecar on every `PreToolUse` would be a lot of disk churn for nothing. The field is the input to issue "Add POST /api/sessions/:id/resume". Sessions that never run an agent (plain shells) simply leave it unset.
naps62-yolo added this to the Reboot resilience milestone 2026-09-03 23:05:15 +01:00
naps62-yolo added the area/protocolarea/daemondifficulty/mediumtype/feat labels 2026-09-03 23:05:15 +01:00
naps62-yolo added a new dependency 2026-09-03 23:06:13 +01:00
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Reference: naps62/maestro#161