Skip to content

fix(tmux): background the project-accent session-created hook#210

Merged
joshukraine merged 1 commit into
masterfrom
fix/gh-208-non-blocking-accent-hook
Jun 6, 2026
Merged

fix(tmux): background the project-accent session-created hook#210
joshukraine merged 1 commit into
masterfrom
fix/gh-208-non-blocking-accent-hook

Conversation

@joshukraine

Copy link
Copy Markdown
Owner

Summary

  • The per-project accent feature (feat(tmux): add per-project status bar accent color #207) installed its session-created hook with a foreground run-shell, which blocks tmux's command queue while the script forks bash plus several tmux subprocesses — landing on the critical path exactly as tmuxinator start spawns a project's 4–5 pane shells, adding shell-startup contention.
  • This backgrounds the hook with run-shell -b so the accent work runs off the command-queue critical path. The script's own refresh-client -S still repaints the bar, so the accent continues to appear immediately on new sessions.

Changes

  • tmux/.config/tmux/project-accent.tmux: add -b to the session-created hook's run-shell, and expand the inline comment to explain why it's backgrounded.

Testing

  • Isolated tmux server (-L accent-test, separate from live sessions): hook definition is now run-shell -b …; a mapped session (bfo1) receives @accent = #93db29 via the backgrounded hook in ~50–100ms — no paint regression; an unmapped session falls back to the theme default.
  • ./scripts/lint-shell — 42 scripts pass.
  • ./scripts/run-tests — 79 bats tests pass.
  • Best-effort real-world check: a morning of sequentially starting ~7 multi-pane sessions no longer produces job-queue timeout spam (validated over time in actual use, not from a single run).

Notes

  • Scope: primary change only. Skipped the optional "skip the refresh-client loop when unmapped" tweak — the local accent map covers every session actually run, so the unmapped branch never fires; it would add a conditional plus a stale-paint edge case for no real benefit. Left the config-source backfill (line 27) in the foreground — out of scope and off the session-creation critical path.
  • Confidence: this is the amplifier fix, not a proven root-cause fix. It removes the startup contention feat(tmux): add per-project status bar accent color #207 introduced; whether it fully ends the job-queue spam can only be confirmed across real launches. If it recurs, next steps are the abbr-queue-clear helper (feat(zsh): add abbr-queue-clear helper for a stuck zsh-abbr job queue #209) and instrumenting with JOB_QUEUE_DEBUG=1.

Closes #208

The session-created hook ran project-accent.sh via a foreground run-shell,
which blocks tmux's command queue while the script forks bash plus several
tmux subprocesses. During `tmuxinator start`, that work landed on the command
queue's critical path just as the project's panes were spawning their shells,
adding shell-startup contention.

Add `-b` so the hook runs in the background, off the critical path. The
script's own `refresh-client -S` still repaints the status bar, so the accent
continues to appear immediately on new sessions.
@joshukraine joshukraine merged commit d93520f into master Jun 6, 2026
1 check passed
@joshukraine joshukraine deleted the fix/gh-208-non-blocking-accent-hook branch June 6, 2026 07:09
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.

fix(tmux): make the project-accent session-created hook non-blocking

1 participant