Restore races the shell: the injected 'claude --resume' is partly swallowed, leaving 'esume' in the session picker · Issue #251 · amirlehmam/wmux · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Restore races the shell: the injected 'claude --resume' is partly swallowed, leaving 'esume' in the session picker #251
With Resume Claude Code sessions on restore enabled, the claude --resume <id> that
wmux injects on restore is raced against the shell's startup. The leading characters are
swallowed, and whatever survives lands wherever the focus happens to be by then.
What it looks like from the user's side: the pane comes back and Claude Code's session
picker is open with esume typed into its search box. That string is the tail of --resume.
Reproduced repeatedly on Windows 11 Pro 10.0.26200. Code below verified still present in 2.13.1.
Where it comes from
Px() appends the command to the pane's startup commands:
functionPx(e){let{base:t,surfaceId:n,claudeSessionId:r,enabled:i}=e;return(!i||!n||!r||!Mx.test(r)||Nx.has(n))
? t
: (Nx.add(n),[...t??[],`claude --resume ${r}`]);}
and that array goes straight into pty.create({ shell, cwd, env, surfaceId, startupCommands, … }).
The command is handed over at pty creation, with nothing waiting for the shell to be ready
to read it.
Why the shell loses it
Shell startup on this machine, median of 5 runs:
shell
time to ready
pwsh 7 (the pane default here)
1.533 ms
cmd.exe
372 ms
No pwsh profile is involved — -NoProfile measures the same, so it is the interpreter
itself. A window that wide swallows most of a short command.
Switching the pane shell to cmd.exe shrinks the window ~4x and makes it much rarer, which is
consistent with the race and is what I am using as a stopgap. It does not close it.
Suggested fix
Wait for the shell to be ready before writing startupCommands — the OSC 133 prompt mark
wmux already consumes for its prompt features would be a natural signal, since it means the
shell has drawn a prompt and is reading. Writing the command into the pty only after that
would make this deterministic instead of timing-dependent.
Any approach that doesn't assume "pty created" means "shell listening" would do.
Why it bites harder than it looks
The command that gets mangled is the one that restores the conversation. When it fails, the
pane comes back without its context, which is the whole point of the setting. And the
leftover text lands in a picker search box, so the recovery path is also the thing that
looks broken.
v2.14.0 fixes the race for every shell without the PowerShell integration (cmd, Git Bash, WSL, pwsh with the integration off). Restore used to type claude --resume on a blind 600 ms timer. PtyManager now types startup commands only once the shell is ready: an OSC 133 prompt mark, a prompt-shaped line or a quiet shell, with a 5 s ceiling.
For pwsh with the integration, though, the command isn't typed as keystrokes at all: the integration runs it during init. Driving pwsh 7 exactly the way wmux does, I got --resume <id> intact through the npm claude.ps1 shim on every run, so I can't reproduce esume there yet. Could you run this in an affected pane right after a restore, and tell me whether the pane shows wmux's integration (the git branch in the sidebar is a good tell)?
An honest update: this is not fixed, and I was wrong to present the 2.14.0 readiness gate as a fix for it.
What I've established since:
The symptom is Claude receiving -resume with one dash. Running the real CLI with claude -resume <uuid> opens Resume session with ⌕ esume in the search box — exactly your screenshot. Its parser reads -resume as -r with the value esume, and the picker's search box is seeded from argv, not from keystrokes (type-ahead sitting in the console buffer when the picker opens is discarded).
No wmux path drops that dash. About 1,900 measured deliveries — the old blind 600 ms timer at every delay from 0 to 1.8 s, the current gate, and the PowerShell integration path; cmd, pwsh 7 (including slowed to your ~1.8 s startup) and Windows PowerShell 5.1; bundled and inbox ConPTY; .ps1 shim, .cmd shim and native exe — and --resume arrived intact every time. Typing before the shell is ready turned out to be lossless.
Your pwsh panes were never on the typed path. A restored pwsh pane gets the integration, which runs the command during init with no keystrokes at all.
So the remaining candidate is whatever claude resolves to on your machine. Next time the picker is open in an affected pane, could you run these from another pane?
Get-CimInstance Win32_Process -Filter "name='claude.exe'"|Select-Object ProcessId, CommandLine
Get-Command claude -All |Format-List CommandType, Source, Definition
claude --version
The first shows the argv Claude actually received, the second shows any wrapper (a function, an alias, a shim). That should pin it down in one go.
Unrelated to the dash, the hunt did find a real bug, fixed in v2.16.0: the startup command inherited WMUX_STARTUP_COMMANDS, so a restored Claude carried its own command line in its environment.
Ran those three. The dash is real in argv, and the parent is not what either of us assumed.
claude.exe -resume <- one dash, and no uuid at all
└─ bash.exe --login -i <- Git Bash
└─ wmux.exe --updated
└─ explorer.exe
Caught live, a few minutes old, alongside ten sibling processes that are all intact:
claude.exe --resume b6f5bc32-5eb5-4322-8c69-8c0492d556e8
claude.exe --resume 4ff41e26-8914-4917-8528-aea47667b7cf
claude.exe --resume da25fdd2-511c-4574-9041-21546c24ae74
...
claude.exe -resume <- the broken one
Note it lost the uuid too, not just a dash. claude -resume with no value is what opens the picker seeded with esume.
No wrapper in the way — Get-Command claude -All returns a single Application pointing straight at .local\bin\claude.exe. No function, no alias, no shim.
The part that matters: my panes are Git Bash now, not pwsh.
When you wrote "your pwsh panes were never on the typed path", that was true at the time. But #252 landed in 2.14.0 and my defaultShell = bash.exe finally took effect — so every pane moved to Git Bash, which has no PowerShell integration and is on the typed path. Fixing #252 moved me onto the code path where this still reproduces.
So the 1,900 deliveries you measured may simply not cover the shell I'm on now. Worth retrying the matrix against bash.exe --login -i specifically, with a slow startup — Git Bash takes ~280 ms cold here, but this machine has an endpoint agent that scans every process spawn and startup times swing a lot under load.
Environment: wmux 2.17.0, Claude Code 2.1.287, Windows 11 Pro 10.0.26300, Git for Windows bash at Git\usr\bin\bash.exe.
Happy to run anything else against a live affected pane — they reproduce often enough that I can usually catch one.
Activity
fix(shell): honour the Git Bash default shell, type startup commands …
amirlehmam commentedon Sep 29, 2026
v2.14.0 fixes the race for every shell without the PowerShell integration (cmd, Git Bash, WSL, pwsh with the integration off). Restore used to type
claude --resumeon a blind 600 ms timer. PtyManager now types startup commands only once the shell is ready: an OSC 133 prompt mark, a prompt-shaped line or a quiet shell, with a 5 s ceiling.For pwsh with the integration, though, the command isn't typed as keystrokes at all: the integration runs it during init. Driving pwsh 7 exactly the way wmux does, I got
--resume <id>intact through the npmclaude.ps1shim on every run, so I can't reproduceesumethere yet. Could you run this in an affected pane right after a restore, and tell me whether the pane shows wmux's integration (the git branch in the sidebar is a good tell)?fix(shell): a startup command no longer inherits WMUX_STARTUP_COMMAND…
docs: keep a pipe out of the CLAUDE.md table cell for #251
amirlehmam commentedon Sep 30, 2026
An honest update: this is not fixed, and I was wrong to present the 2.14.0 readiness gate as a fix for it.
What I've established since:
-resumewith one dash. Running the real CLI withclaude -resume <uuid>opens Resume session with⌕ esumein the search box — exactly your screenshot. Its parser reads-resumeas-rwith the valueesume, and the picker's search box is seeded from argv, not from keystrokes (type-ahead sitting in the console buffer when the picker opens is discarded)..ps1shim,.cmdshim and native exe — and--resumearrived intact every time. Typing before the shell is ready turned out to be lossless.So the remaining candidate is whatever
clauderesolves to on your machine. Next time the picker is open in an affected pane, could you run these from another pane?The first shows the argv Claude actually received, the second shows any wrapper (a function, an alias, a shim). That should pin it down in one go.
Unrelated to the dash, the hunt did find a real bug, fixed in v2.16.0: the startup command inherited
WMUX_STARTUP_COMMANDS, so a restored Claude carried its own command line in its environment.javierguevara-habi commentedon Oct 2, 2026
Ran those three. The dash is real in argv, and the parent is not what either of us assumed.
Caught live, a few minutes old, alongside ten sibling processes that are all intact:
Note it lost the uuid too, not just a dash.
claude -resumewith no value is what opens the picker seeded withesume.No wrapper in the way —
Get-Command claude -Allreturns a singleApplicationpointing straight at.local\bin\claude.exe. No function, no alias, no shim.The part that matters: my panes are Git Bash now, not pwsh.
When you wrote "your pwsh panes were never on the typed path", that was true at the time. But #252 landed in 2.14.0 and my
defaultShell = bash.exefinally took effect — so every pane moved to Git Bash, which has no PowerShell integration and is on the typed path. Fixing #252 moved me onto the code path where this still reproduces.So the 1,900 deliveries you measured may simply not cover the shell I'm on now. Worth retrying the matrix against
bash.exe --login -ispecifically, with a slow startup — Git Bash takes ~280 ms cold here, but this machine has an endpoint agent that scans every process spawn and startup times swing a lot under load.Environment: wmux 2.17.0, Claude Code 2.1.287, Windows 11 Pro 10.0.26300, Git for Windows bash at
Git\usr\bin\bash.exe.Happy to run anything else against a live affected pane — they reproduce often enough that I can usually catch one.
feat(workspace): project-local workspace manifests (#284)