fix: CLI reports waiting for acknowledged sessions instead of idle#385
Merged
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom Mar 26, 2026
Merged
Conversation
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
list --jsonandstatus --jsonreported"waiting"for sessions the user had already acknowledged in the TUI, where they correctly appeared as"idle"(gray)LoadInstances()didn't SELECT theacknowledgedcolumn, andSaveInstances()usedINSERT OR REPLACEwithout it — silently resetting it to0on every saveChanges
Acknowledgedfield toInstanceRowstructLoadInstances()now SELECTs and scans theacknowledgedcolumnSaveInstance()/SaveInstances()now includeacknowledgedin INSERT (preventsINSERT OR REPLACEfrom clobbering the flag)LoadLite()andLoadWithGroups()compute effective status:waiting+acknowledged→idleSaveWithGroups()persiststmuxSession.IsAcknowledged()back to the DB