Skip to content

Concurrent workspace builder (opt-in)#1067

Open
tony wants to merge 3 commits into
masterfrom
builder-concurrent
Open

Concurrent workspace builder (opt-in)#1067
tony wants to merge 3 commits into
masterfrom
builder-concurrent

Conversation

@tony

@tony tony commented Jun 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Add ConcurrentWorkspaceBuilder, an opt-in builder (workspace_builder: concurrent) that observes a window's pane readiness through one concurrent barrier instead of waiting pane-by-pane — addressing the serial per-pane wait that made loads scale with pane count (Very slow performance opening layouts/workspaces #1053).
  • Add an overridable ClassicWorkspaceBuilder._build_window seam so the variant overrides only per-window construction; classic builder behavior is unchanged (the full classic suite passes).
  • Honor workspace_builder_options.pane_readiness (auto/always/never) and fall back to the classic one-pane-at-a-time path when a later pane's start_directory depends on an earlier pane's command.

Changes

  • workspace/builder/concurrent.py (new): builder, readiness barrier, adaptive space-reclaim (no space for new pane with main-horizontal and a few panes #800), sequential fallback.
  • workspace/builder/classic.py: extract behavior-preserving _build_window seam.
  • pyproject.toml + builder/__init__.py: register/export the concurrent entry point.
  • Tests, docs (custom-workspace-builders guide + API page), CHANGES.

Supersedes #1056, re-homed onto the #1066 builder framework as a separate opt-in builder rather than changing the default. #1056's CLI progress / before_script / synchronize-panes follow-ons are intentionally out of scope here.

Test plan

  • uv run py.test --reruns 0 — full suite green
  • uv run mypy ., ruff check ., ruff format --check .
  • just build-docs — no new warnings
tony added 3 commits June 28, 2026 20:04
why: The per-window pane-construction body was inlined in
ClassicWorkspaceBuilder.build(), leaving no override point for a builder
that wants a different pane-creation strategy without duplicating the
window iteration, plugin hooks, focus handling, and build events.

what:
- Move the per-window pane loop into an overridable _build_window()
  that returns the window's focus pane
- Have build() call _build_window() and keep on_window_create,
  config_after_window, after_window_finished, focus, and window_done
  unchanged around it
- Add a doctest for the new seam
why: Loading a workspace waited on each pane's shell prompt one at a
time, so a window with several panes paid the prompt-startup cost
serially even though tmux warms every pane's shell concurrently.

what:
- Add ConcurrentWorkspaceBuilder, an opt-in builder that creates a
  window's panes up front, waits for their prompts in one shared
  barrier, lays out once, then dispatches each pane's commands
- Port _pane_has_drawn_prompt and _wait_for_panes_ready (one
  shared-timeout polling loop, 10ms interval) from the source change
- Port _split_pane_reclaiming_space (reclaim layout space only on a
  no-space split failure) and the sequential fallback for panes whose
  start_directory depends on an earlier pane's command
- Respect workspace_builder_options.pane_readiness via the classic
  _pane_readiness_wait resolution; skip the barrier under never
- Register the `concurrent` entry point and export the class
- Register the module's doctests with the tmux-fixture set in conftest
- Add functional tests: multi-window/pane build, command dispatch,
  single-pass layout, readiness policy, space reclaim, sequential
  start_directory fallback
why: The new opt-in builder needs user-facing guidance and an API
reference page, and the change should be discoverable in the changelog.

what:
- Add a Concurrent builder section to the custom-workspace-builders
  guide and list it under Choosing an approach and Reference
- Add the concurrent autodoc page and link it from the builder index
  grid and toctree
- Add a What's new CHANGES entry under 1.74.0
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.24852% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.50%. Comparing base (812dcca) to head (f36c706).

Files with missing lines Patch % Lines
src/tmuxp/workspace/builder/concurrent.py 81.36% 18 Missing and 12 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1067      +/-   ##
==========================================
- Coverage   82.56%   82.50%   -0.06%     
==========================================
  Files          31       32       +1     
  Lines        2770     2933     +163     
  Branches      518      550      +32     
==========================================
+ Hits         2287     2420     +133     
- Misses        346      364      +18     
- Partials      137      149      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant