Skip to content

feat(tmux): keep window indices gap-free (renumber-windows on)#28

Merged
jakemassoth merged 1 commit into
mainfrom
window-reindex
Jul 20, 2026
Merged

feat(tmux): keep window indices gap-free (renumber-windows on)#28
jakemassoth merged 1 commit into
mainfrom
window-reindex

Conversation

@jakemassoth

Copy link
Copy Markdown
Owner

What

Add set -g renumber-windows on to tmux.conf so the brigade's window
indices stay gap-free.

Why

When a cook window closed — whether killed with yeschef kill, or
auto-dropped when its agent process exits (tmux's default, see the
Liveness note) — the surviving windows kept their original indices,
leaving a hole. Killing the middle of 0,1,2,3 left 0,1,3. That
breaks the kitchen manual's promise that prefix+<n> jumps to the nth
cook, and leaves the tab bar visually ragged.

renumber-windows on makes tmux renumber the survivors on any window
close, so the head chef stays at window 0 and the cooks stay 1, 2, 3…
contiguously.

Safe by construction

yeschef addresses every window by name (yeschef:<window>), never by
index (WindowInfo doesn't even carry an index). So renumbering is
invisible to send/peek/kill/status — it only fixes the human's
tab order and prefix+<n> navigation.

Testing

  • New e2e test killing_a_middle_cook_reindexes_windows_gap_free:
    spawns 3 cooks (0,1,2,3), kills the middle one, and asserts the
    survivors renumber to 0,1,2 with the last cook sliding into the
    freed slot. Verified it fails (0,1,3) with the option off, proving
    it's a real regression guard.
  • nix flake check green (fmt, nixfmt, clippy, unit tests).
  • Full e2e suite green (20 passed).

All tmux work was done on throwaway per-test sockets — never the live
yeschef server.

When a cook window closed — killed, or auto-dropped when its agent
process exits — the survivors kept their original indices, leaving a
hole (e.g. 0, 2, 3). That broke the manual's promise that `prefix+<n>`
jumps to the nth cook.

Add `set -g renumber-windows on` to tmux.conf so tmux renumbers the
survivors on any window close: the head chef stays at 0 and cooks stay
1, 2, 3… contiguously. yeschef addresses windows by name, never index,
so this is invisible to send/peek/kill — it only fixes the human's tab
order and prefix+<n> navigation.

Add an e2e test (spawn 3 cooks, kill the middle one, assert the
survivors renumber to 0,1,2 with the last cook sliding into the freed
slot) and document the behavior in DEVELOPMENT.md's tmux notes.
@jakemassoth
jakemassoth merged commit a4891ac into main Jul 20, 2026
2 checks passed
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