psmux: retire the per-window option channel (`__blw@N` keys) once a psmux release gives windows their own user options (psmux master f720eddc)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 15/100
Direzione di ricerca
Start with tests/test_psmux_live.py::test_premise_window_scoped_option_write_lands_at_session_scope and the @ branches in src/bmad_loop/adapters/psmux_backend.py (lines 824-1225 hold the channel). Do not begin until a psmux release ships the per-window user-option change, and first settle the floor bump, the session_options readers and the parked-trailer override listed in the issue. Done means the premise test is inverted into a regression test, the channel and its unit tests are removed, and the docs and CHANGELOG are updated.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
psmux master gives user options the scope of their flags (4eb94983, "user options take the scope of their flags"): set-option -w -t S:@N @k v now stores on window @N's own table, and show-options -wqv -t S:@N @k reads it back. bmad-loop's psmux backend routes every @ window option through a substitute channel, session-scoped keys named <option>__blw@<N>, because on the installed psmux v3.4.0 (20aa1d7) a -w user-option write lands in the session map (#310). On master the existing option channel continues to work in the measured paths, and the base-class -w path it replaces now works too, so the channel becomes retirable behind a floor bump. As checked on 2026-10-14, the latest published release is v3.4.0, released 2026-10-13; the tested change is on unreleased master. This issue tracks the retirement, as #914 does for _transportable's --leading clause; it tracks a future retirement rather than a reproduced production regression.
Environment
psmux master f720eddc (built from source, unreleased) and the control psmux 3.4.0 (20aa1d7), Windows 11 build 26200, PowerShell 7.6.6 (launching shell; SHELL removed), PSMUX_NO_WARM=1; bmad-loop 45bac91c.
The trigger
tests/test_psmux_live.py::test_premise_window_scoped_option_write_lands_at_session_scope fails on master, 3 of 3 runs (and in a separate 2 of 2), with its own message: psmux now has real per-window option storage — the @opt_@N scoped-option channel in psmux_backend is droppable (assert 'v' == ''). On 3.4.0 it passes. In one full-file run on master it was one of exactly two premise failures (the other is #914's tripwire). The weekly psmux-canary run against the latest release is where it will show first.
Measured (observed, both binaries, through bmad-loop's code)
The channel keeps working on master. Through PsmuxMultiplexer bound to each binary: set_window_option / show_window_option / unset_window_option, the @ column of list_windows, _scoped_options, and kill_window's key cleanup give identical results on master and 3.4.0 (two windows, two tags, each reads its own; the unset reads "" with no warning; a killed window's keys are freed). In one measurement, writes followed immediately by reads from a second client missed 0 times in 1200 pairs (100 per path per binary per warm-pool setting). No regression was observed in the exercised option-channel paths on f720eddc.
The base-class path the channel replaces is correct on master (BaseTmuxBackend.set_window_option / show_window_option / unset_window_option / list_windows, called on a PsmuxMultiplexer instance):
| step | psmux master f720eddc | psmux 3.4.0 (control) |
|---|---|---|
-w tag tag-a on S:@2, tag-b on S:@3, then base show_window_option each |
tag-a, tag-b |
'', '' |
base list_windows(S, ["window_id", "@bmad_project"]) |
@1 '', @2 tag-a, @3 tag-b |
every row tag-b (the #310 bleed) |
@-lines in show-options -q -t S (the session map) |
none from the base writes | @bmad_project "tag-b" |
base unset_window_option on S:@2, then read @2 / @3 |
'' / tag-b |
'' / '' |
show-options -wqv on an unset name |
rc 0, empty | rc 0, empty |
show-options -wv (no -q) on an unset name |
rc 1, psmux: invalid option: @bmad_project |
rc 0, empty line |
What retires
In src/bmad_loop/adapters/psmux_backend.py: the @ branches of set_window_option, unset_window_option and show_window_option; _option_scope, _window_id_for_name, _SCOPE_MARKER, _scoped_option_key, _KEY_SUFFIX, _read_scoped, _warn_unroutable, _scoped_options, _free_scoped_key, _sweep_orphan_keys (and its call in new_parked_window), the key cleanup in kill_window, and the @-column substitution in list_windows (its window_id qualification stays). Also the module docstring's "Per-window user options do not exist at all" sentence, the "Window options" paragraph of docs/multiplexer-backends.md, and the channel's unit tests in tests/test_psmux_backend.py.
What must stay or change (preconditions, each measured or marked)
- The parked trailer keeps its pane pin.
BaseTmuxBackend._parked_trailerreadsshow-options -wqv <opt>with no-t. Measured on master from inside two real panes, with focus on the other window, in every run of three independent measurements: the target-less read answered the active window's value, whileshow-options -wqv -t $env:TMUX_PANE @kanswered the pane's own. This is the same psmux trait #669 pinned fordisplay-message(test_premise_target_less_display_message_ignores_tmux_pane). SoPsmuxMultiplexer._parked_trailerstays an override; it changes its read toshow-options -wqv -t $env:TMUX_PANE <opt>and drops its$widprobe, the key splice and theset-option -u $keyfree. That replacement is not yet implemented or validated end to end: the measurements validate its read target, not an attached client's return action. list-sessions -F '#{@bmad_project}'sees window tags. On master, after base-class-wtags on a session's windows,session_options("@bmad_project")answeredtag-b, the active window's tag, for a session with no session-level tag:#{@k}resolves through the active window before the session. Once control-session windows carry real-wtags, everysession_options(PROJECT_OPTION)reader that meets a control session gets a window's tag back.superseded_ctl_may_be_runinruns.pyrests on the opposite premise ("no release ever set one on a control session (its windows carry the tag)"); it answers True for any non-empty tag, which is the direction that withholds an attach command, so the failure mode there is a withheld command rather than a wrong kill (source-derived; no superseded-control-session cleanup was driven).prunable_sessionsskips control sessions only by name and needs the same re-check. Re-check those readers before retiring. With only channel-backed window tags in these runs,session_optionsreturned no project tag on either tested binary.- The floor moves first. As in #914: set
_LAST_UNSUPPORTEDto the last release without4eb94983(the gate is exclusive) and move the CI pin. On 3.4.0 the base path brings back the #310 bleed (measured above: every row reads the last tag written). A control session served by a pre-floor psmux server that outlived the upgrade is the same case. That is source-derived, not observed: the version gate checks the client binary, and the write is applied by the server. Mixed client and server builds were not tested. - Windows parked before bmad-loop removes the channel (source-derived; migration not exercised). Their trailer is baked in at creation and still reads the session-scoped
__blw@Nkey. If a later bmad-loop attach writes its return target only to a native-woption, that write does not arm the old trailer; an absent old key can leave the return action unarmed, while an old retained key can supply a stale target. Existing channel-backed project tags also do not appear in native-wreads until migrated or retagged (the prune then falls back to run-dir evidence, as the channel's own comment describes for pre-marker keys). Restart the affected control server and recreate its windows as part of adopting the removal. Upgrading psmux alone is not shown to cause this failure: the unchanged channel still works on master. - The premise test turns into an adopted row:
-wwrites are per window, and the session map holds no@key afterwards. Add a regression test that fails when the old v3.4.0 storage behaviour is substituted. Add a CHANGELOG entry (an upgrade item for the floor, plusRemovedfor the channel).
Repro
Run from PowerShell 7 (pwsh) with SHELL removed, in a bmad-loop checkout at 45bac91c after uv sync --all-extras; $Bin is the psmux to test, by full path; the registry is a throwaway directory under %TEMP%; remove it and probechan.py afterwards.
Remove-Item Env:SHELL -ErrorAction SilentlyContinue
$env:PSMUX_NO_WARM = '1'; $env:PYTHONUTF8 = '1'
$Bin = 'C:\path\to\psmux.exe' # master build; then the installed 3.4.0 as the control
$Data = "$env:TEMP\psmux-chan-probe"; New-Item -ItemType Directory -Force $Data | Out-Null
@'
import sys
from pathlib import Path
from bmad_loop.adapters.psmux_backend import PsmuxMultiplexer
from bmad_loop.adapters.tmux_base import BaseTmuxBackend as B
binary, data = sys.argv[1], sys.argv[2]
mux = type("M", (PsmuxMultiplexer,), {"_BINARY": binary})(registry_root=data)
S = "probe-chan"; cwd = Path(data)
mux.new_session(S, cwd)
park = "pwsh -NoProfile -Command 'Start-Sleep 300'"
a = mux.new_window(S, "a", cwd, {}, park); b = mux.new_window(S, "b", cwd, {}, park)
mux.set_window_option(a, "@t", "chan-a"); mux.set_window_option(b, "@t", "chan-b")
print("channel:", mux.show_window_option(a, "@t"), mux.show_window_option(b, "@t"))
B.set_window_option(mux, a, "@bmad_project", "tag-a"); B.set_window_option(mux, b, "@bmad_project", "tag-b")
print("base -w:", repr(B.show_window_option(mux, a, "@bmad_project")), repr(B.show_window_option(mux, b, "@bmad_project")))
print("base list_windows:", B.list_windows(mux, S, ["window_id", "@bmad_project"]))
print("session_options:", mux.session_options("@bmad_project"))
mux.kill_session(S)
'@ | Set-Content "$env:TEMP\probechan.py"
uv run python "$env:TEMP\probechan.py" $Bin $Data
$env:PSMUX_DATA_DIR = $Data; & $Bin kill-server; Remove-Item Env:PSMUX_DATA_DIR
Master prints channel: chan-a chan-b, base -w: 'tag-a' 'tag-b', a list_windows with each window's own tag, and session_options naming the active window's tag (tag-b). 3.4.0 prints the same channel line, base -w: '' '', every list_windows row tag-b, and session_options tag-b (from the session map).
Source
psmux at f720eddc, src/server/options.rs:104-106 (the write now admits @ names):
pub(crate) fn is_window_scoped_write(name: &str) -> bool {
is_window_option(name) || name.starts_with('@')
}
At v3.4.0 (src/server/options.rs:105-107, with its comment at :97-104) the same function excluded them ("User options (@...) are deliberately NOT included ... set -wg @k v and set -g @k v therefore remain the way to set one"). The causing commit is 4eb94983 (the psmux/psmux#795 follow-up, "user options take the scope of their flags"), which also routes #{@name} through the window (pane_user_option(app, window, pane, name): pane, window, global window table, then the session store). The psmux commits after f720eddc on the touched files, as of 2026-10-14, leave the user-option stores unchanged; the measurements stay pinned to f720eddc.
bmad-loop at 45bac91c: the channel block src/bmad_loop/adapters/psmux_backend.py:824-1225 and the trailer psmux_backend.py:545-600.
Impact on bmad-loop
No regression observed in the exercised option-channel paths on f720eddc. Retiring the channel removes the channel block (about 400 lines) and the two or three extra listing round-trips each psmux kill_window pays, and stops the control server accumulating keys, under the five preconditions above.
- Lingua principale
- Python
- Stelle
- 196
- Fork
- 78
- Merge medio
- 9h 24m
- PR unite (30g)
- 44
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bmad-code-org/bmad-loop
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bmad-code-org/bmad-loop#1063 ·
I maintainer di solito rispondono entro 1 giorno
-
psmux: task window name starting with '-' creates no window; session reads as crashedForse già presa @RECOHA l’ha presa 8 giorni fa. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
bmad-code-org/bmad-loop#1061 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
bmad-code-org/bmad-loop#1057 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
bmad-code-org/bmad-loop#973 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bmad-code-org/bmad-loop#965 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di bmad-code-org/bmad-loop
Issue simili
-
Ubuntu for Debian DevelopersApertaDMB documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ubuntu/ubuntu-project-docs#921 ·
I maintainer di solito rispondono entro 1 giorno
-
⏳ Pending feedback 🐛 Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jumpserver/jumpserver#18282 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 76/100
ClickHouse/loom#2014 ·
I maintainer di solito rispondono entro 1 giorno
-
accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
future-agi/future-agi#5274 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 2 giorni