refactor: pane-centric state handling redesign#58
Conversation
Use pane-id as the primary key for the sessions store instead of session-id. This eliminates duplicate entries when the same pane runs multiple sessions and removes all supersede logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96bdc3adf2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| updated (merge existing session-data)] | ||
| (write-state-file! |
There was a problem hiding this comment.
Clear stale last-message when session-id changes
With pane-id now used as the primary key, update-session! merges new events into the previous pane record even when the pane has started a different session-id. Because many start/progress events intentionally omit :last-message, the old session’s message is retained and shown for the new session, which produces incorrect UI state after pane reuse. This needs a reset path (e.g., when incoming :session-id differs from stored :session-id) before merging.
Useful? React with 👍 / 👎.
| key (store-key session-data)] | ||
| (if state-dir | ||
| (store/update-session! | ||
| state-dir session-id session-data) | ||
| state-dir key session-data) |
There was a problem hiding this comment.
Migrate legacy session-id entries on pane-key writes
This change writes tmux updates under pane-id keys, but existing state files from the previous model can still contain active entries keyed by session-id; writing the new pane key here leaves the old key untouched, so both records remain active for the same pane until it dies. Since duplicate-pane cleanup was removed in this commit, upgraded users can see duplicate live rows and duplicated refresh updates unless the legacy key is remapped or removed when pane-keyed writes occur.
Useful? React with 👍 / 👎.
Summary
Test plan