Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #920 +/- ##
==========================================
+ Coverage 61.99% 62.08% +0.09%
==========================================
Files 29 29
Lines 5091 5109 +18
Branches 1082 1085 +3
==========================================
+ Hits 3156 3172 +16
- Misses 1595 1597 +2
Partials 340 340 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tony
force-pushed
the
fix/914-select-existing-literal
branch
from
November 23, 2026 00:47
5d9e119 to
4588c58
Compare
tony
force-pushed
the
feat/916-get-or-create
branch
from
November 23, 2026 00:59
2c03631 to
6e0f3e6
Compare
tony
force-pushed
the
feat/916-get-or-create
branch
from
November 23, 2026 02:33
6e0f3e6 to
a1f2035
Compare
tony
force-pushed
the
feat/916-get-or-create
branch
from
November 23, 2026 23:35
a1f2035 to
f19f663
Compare
This was referenced Nov 24, 2026
This was referenced Nov 24, 2026
tony
force-pushed
the
feat/916-get-or-create
branch
from
November 24, 2026 01:44
f19f663 to
839fb35
Compare
tony
force-pushed
the
feat/916-get-or-create
branch
from
November 25, 2026 08:24
839fb35 to
afdeeea
Compare
tony
force-pushed
the
feat/916-get-or-create
branch
from
November 28, 2026 12:49
afdeeea to
383dd5c
Compare
why: Idempotent setup asks "make this window or session unless it exists". new_window(select_existing=True) names that with a tmux flag that does not say what comes back, and sessions had no helper (#916). what: - Add Session.get_or_create_window, which calls new_window with select_existing=True and the creation arguments - Add Server.get_or_create_session: exact lookup, new_session, and a re-read when the creation is refused as a duplicate, so a concurrent creator's session is returned - Raise any other creation error, even if the session appeared - No Window or Pane variant: panes have no name to look up
tony
force-pushed
the
feat/916-get-or-create
branch
from
November 29, 2026 02:42
383dd5c to
933bee7
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Sequenced in #925 (
0.71.0) behind safe{Session,Window,Pane}.__exit__teardown and the get-or-create /createdvocabulary decision (#916, #804). Rebase ontov0.70.0checks annotations withty(uv run ty check) and RuffANN(#682) in place ofmypy.Summary
Session.get_or_create_window(name, ...): return the window with that name in the session, or create it.Server.get_or_create_session(name, ...): return the session with that name, or create it, returning a concurrent creator's session when tmux refuses the duplicate.WindoworPanevariant: panes have no name to look up.Fixes #916. Builds on #917, whose name lookup
get_or_create_windowuses.Design decisions
get_or_create_windowcallsnew_window(select_existing=True)with the creation arguments and no index, so the lookup is Session(fix[new_window]): Look up reuse by name #917's exact-name match on every tmux.kill_existingandwindow_indexare not accepted:-kand an index key on the window index, not the name.get_or_create_sessionlooks the name up exactly, creates it withnew_session, and when creation is refused as a duplicate (libtmux's own check or tmux'sduplicate session), re-reads and returns the session the other caller created. Any other creation error is raised, even if a session with the name appeared meanwhile.Test plan
Formatwindow nameduplicate sessionrefusalBadSessionNameruff check,ruff format --check,mypy, the full test suite andjust build-docs(no warnings)