Skip to content

refactor: pane-centric state handling redesign#58

Merged
boxp merged 2 commits intomainfrom
pane-centric-state-handling
Mar 11, 2026
Merged

refactor: pane-centric state handling redesign#58
boxp merged 2 commits intomainfrom
pane-centric-state-handling

Conversation

@boxp
Copy link
Copy Markdown
Owner

@boxp boxp commented Mar 11, 2026

Summary

  • Use pane-id as the primary key for the sessions store instead of session-id, eliminating duplicate entries when the same pane runs multiple sessions
  • Remove all supersede logic (supersede-key, supersede-old-sessions, close-dup-pane-sessions, etc.) which is no longer needed with pane-id keying
  • Remove SESSION column from TUI table/card views, clean up dead code (truncate, list-pane-cwds, unused parameters)
  • Deduplicate capturable-statuses to single source in store.clj, remove redundant ensure-state-dir! calls, make with-file-lock private

Test plan

  • make ci passes (format-check + lint + test)
  • Verify same pane-id updates produce single entry
  • Verify different pane-ids produce separate entries
  • Verify session-id does not appear in TUI output
  • Verify closed session reactivation works correctly
  • Verify non-tmux sessions fall back to session-id as key

boxp and others added 2 commits March 11, 2026 08:50
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>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +159 to 160
updated (merge existing session-data)]
(write-state-file!
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +174 to +177
key (store-key session-data)]
(if state-dir
(store/update-session!
state-dir session-id session-data)
state-dir key session-data)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@boxp boxp merged commit 3562013 into main Mar 11, 2026
6 checks passed
@boxp boxp deleted the pane-centric-state-handling branch March 11, 2026 09:16
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.

1 participant