Skip to content

Fix #325: correct CLI status reporting for live sessions#329

Draft
asheshgoplani wants to merge 1 commit intomainfrom
fix/325-cli-incorrect-status
Draft

Fix #325: correct CLI status reporting for live sessions#329
asheshgoplani wants to merge 1 commit intomainfrom
fix/325-cli-incorrect-status

Conversation

@asheshgoplani
Copy link
Owner

Fixes #325

Summary

  • Cold-load hook status from disk in UpdateStatus(): When hookStatus is empty (CLI path without StatusFileWatcher), reads the .json hook file once to give CLI the same hook fast path as the TUI
  • Reset stale acknowledged flag during cold load: ReconnectSessionLazy sets acknowledged=true for previousStatus="idle", causing sessions that transitioned idle→waiting to remain stuck as idle in CLI output
  • Write .sid sidecar in Restart(): After successful RespawnPane() for Claude, Gemini, Codex, and OpenCode, persists the session ID anchor so hook events after restart can be correlated with the instance

Test plan

  • TestUpdateStatus_ColdLoadHookFile — verifies readHookStatusFile reads hook status from disk
  • TestUpdateStatus_ColdLoadResetsAcknowledged — verifies cold-loading "waiting" status resets stale acknowledged flag (requires tmux)
  • TestWriteHookSessionAnchor_InRestart — verifies .sid file is written correctly
  • Full test suite passes (make ci — all 19 packages green)

CLI commands (list --json, status --json) reported incorrect status
(error/idle) for live sessions because they lacked the StatusFileWatcher
that the TUI uses. Three fixes:

1. Cold-load hook status file from disk in UpdateStatus() when hookStatus
   is empty, giving CLI the same hook fast path as the TUI.

2. Reset stale acknowledged flag during cold load. ReconnectSessionLazy
   sets acknowledged=true for previousStatus="idle", causing sessions
   that transitioned idle->waiting to remain stuck as idle in CLI.

3. Write .sid sidecar file in Restart() after successful RespawnPane()
   for Claude, Gemini, Codex, and OpenCode. Without this anchor, hook
   events fired after restart cannot be correlated with the instance.

Fixes #325

Committed by Ashesh Goplani
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI commands report incorrect status (error/idle) for live sessions

1 participant