Skip to content

fix: CLI reports waiting for acknowledged sessions instead of idle#385

Merged
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
amkopyt:fix/cli-acknowledged-status-idle
Mar 26, 2026
Merged

fix: CLI reports waiting for acknowledged sessions instead of idle#385
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
amkopyt:fix/cli-acknowledged-status-idle

Conversation

@amkopyt
Copy link
Copy Markdown
Contributor

@amkopyt amkopyt commented Mar 19, 2026

Summary

  • list --json and status --json reported "waiting" for sessions the user had already acknowledged in the TUI, where they correctly appeared as "idle" (gray)
  • Root cause: LoadInstances() didn't SELECT the acknowledged column, and SaveInstances() used INSERT OR REPLACE without it — silently resetting it to 0 on every save
  • The conductor heartbeat wasted tokens re-checking these already-acknowledged sessions

Changes

  • Added Acknowledged field to InstanceRow struct
  • LoadInstances() now SELECTs and scans the acknowledged column
  • SaveInstance() / SaveInstances() now include acknowledged in INSERT (prevents INSERT OR REPLACE from clobbering the flag)
  • LoadLite() and LoadWithGroups() compute effective status: waiting + acknowledgedidle
  • SaveWithGroups() persists tmuxSession.IsAcknowledged() back to the DB

When a user acknowledges a waiting session in the TUI, the DB sets
acknowledged=1 but status stays "waiting". The TUI correctly shows
"idle" via in-memory state, but CLI commands (list --json, status --json)
never read the acknowledged column from the DB, so they always report
"waiting". This causes the conductor heartbeat to waste tokens
re-checking already-acknowledged sessions.

Root cause: LoadInstances() didn't SELECT the acknowledged column,
and SaveInstances() used INSERT OR REPLACE without it — silently
resetting it to 0 on every save.

Changes:
- Add Acknowledged field to InstanceRow struct
- Include acknowledged in LoadInstances SELECT and scan
- Include acknowledged in SaveInstance/SaveInstances INSERT
- Compute effective status in LoadLite/LoadWithGroups: waiting + acknowledged → idle
- Persist acknowledged flag from tmux session state in SaveWithGroups
@asheshgoplani asheshgoplani merged commit f0816d8 into asheshgoplani:main Mar 26, 2026
1 check passed
asheshgoplani added a commit that referenced this pull request Mar 26, 2026
PR #385 added the acknowledged column to the instances table in the
CREATE TABLE statement but missed adding an ALTER TABLE migration for
existing databases. This caused session creation to fail on machines
with pre-existing state.db files.

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.

2 participants