You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: eager session-id persistence via on_session_id_resolved callback (#4072)
The dispatch system silently dropped dispatched_session_id (and related
identity fields) on CancelledError: only status/reason/ended_at were
written via mark_dispatch_interrupted(). The session ID was known in
acc.stdout_session_id/acc.channel_b_session_id inside the task group
but never persisted to state.
Add an on_session_id_resolved callback fired from _extract_stdout_session_id
inside the live-execution task group, mirroring the existing on_pid_resolved
pattern. The closure calls mark_dispatch_session_identity to eagerly persist
the session ID while the dispatch is still RUNNING.
Three layers of defense:
1. Eager callback writes to state during execution
2. CancelledError handler passes captured_session_id + marker_dir to
mark_dispatch_interrupted (additive — only writes empty fields)
3. Normal completion path prefers eagerly-captured value over skill_result
mark_dispatch_interrupted now accepts optional dispatched_session_id,
session_chain, and dispatched_session_log_dir. New mark_dispatch_session_identity
function is idempotent and status-guarded (RUNNING only).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments