diff --git a/.story_kit/work/1_upcoming/93_bug_agent_session_id_is_null_while_running.md b/.story_kit/work/1_upcoming/93_bug_agent_session_id_is_null_while_running.md new file mode 100644 index 0000000..58d5efd --- /dev/null +++ b/.story_kit/work/1_upcoming/93_bug_agent_session_id_is_null_while_running.md @@ -0,0 +1,28 @@ +--- +name: "Agent session_id is null while running" +--- + +# Bug 93: Agent session_id is null while running + +## Description + +The session_id from Claude Code's initial `system` JSON event is captured during PTY streaming (agents.rs:2011) but only stored on the agent record after the process exits (agents.rs:1293 in run_server_owned_completion). While the agent is actively running, list_agents and get_agent_output always report session_id: null. + +## How to Reproduce + +1. Start an agent on any story via start_agent +2. Call list_agents while the agent is running +3. Observe session_id is null + +## Actual Result + +session_id is null for the entire duration of the agent run. Only populated after the process exits. + +## Expected Result + +session_id should be set on the agent record as soon as the first `system` JSON event is parsed from the PTY stream, making it available for live log retrieval and monitoring. + +## Acceptance Criteria + +- [ ] list_agents returns a non-null session_id within seconds of agent startup +- [ ] session_id is available for persistent log lookup while agent is still running