Skip to content

feat: show shell-specific labels for terminal tabs - #3

Merged
amirlehmam merged 1 commit into
amirlehmam:masterfrom
Optuber01:pr/shell-tab-labels
Apr 15, 2026
Merged

amirlehmam merged 1 commit into
amirlehmam:masterfrom
Optuber01:pr/shell-tab-labels

Conversation

@Optuber01

@Optuber01 Optuber01 commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • return the resolved shell from PTY creation
  • store the resolved shell on terminal surfaces
  • show a shell-specific tab label instead of the generic Terminal label

Why

When multiple terminals are open, shell-specific labels make it much easier to understand which tab is PowerShell, Command Prompt, Bash, WSL, or another shell.

Testing

  • npm run build:main
  • npm run build:renderer

@amirlehmam
amirlehmam merged commit c005a86 into amirlehmam:master Apr 15, 2026
@amirlehmam

Copy link
Copy Markdown
Owner

Great PR! Clean implementation, well-structured across all the layers (pty-manager → ipc → preload → renderer).

The getShellLabel() mapping is a nice touch — much better UX than seeing "Terminal" everywhere when you have multiple shells open.

Merged into v0.6.8. Thanks for the contribution @Optuber01!

amirlehmam added a commit that referenced this pull request Jun 15, 2026
…ick-launch profiles, winget) + bump 0.8.6

#1 Notification sounds: ship a default chime and play it on every notification
   fire, gated on notificationPrefs.sound. Main signals notification:play-sound;
   a single renderer listener (initNotificationSound) plays the bundled WAV.

#3 wmux browser new-instance bug: add app.requestSingleInstanceLock() with a
   second-instance focus handler so a stray `wmux ...` launch focuses the running
   window instead of spawning a new one (named WMUX_INSTANCE isolates userData so
   dev/prod still coexist). Rebuild resources/cli/wmux.js so the shipped CLI honors
   WMUX_PIPE again.

#4 Quick-launch profiles in the + caret dropdown: {name,icon,type,shell,cwd,
   startupCommands,url} model, global profiles in settings (with a Profiles panel
   + Windows Terminal profile import) and project-level .wmux.json. PTY startup
   commands run once on fresh creation; relative cwd resolves against the workspace.

#2 Winget: manifest set + auto-publish workflow (portable-zip install, no signing).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
amirlehmam pushed a commit that referenced this pull request Jun 20, 2026
Addresses the critical/high findings from the security review:

- Pipe auth (#1): privileged V2 methods now require a per-instance token
  (crypto.randomBytes, 0600 file in APPDATA, timing-safe compare). Public
  telemetry methods stay open via an allowlist so detection/hooks keep
  working. Token injected into spawned shells as WMUX_PIPE_TOKEN; CLI and
  hook clients read it from env or the token file.
- CDP proxy (#2): reject DNS-rebinding via a loopback-only Host allowlist
  (HTTP 403 + WS verifyClient) AND a browser-Origin guard on the WS upgrade
  (WebSockets bypass CORS, so a passing Host alone lets a malicious page
  open ws://127.0.0.1:9222 and reach Runtime.evaluate). Absent Origin is
  allowed so chrome-devtools-mcp/puppeteer/native ws clients still connect.
- Markdown XSS (#3): sanitize marked output with DOMPurify before
  dangerouslySetInnerHTML in the privileged renderer.
- markdown.load_file: extension allowlist + 5MB cap + isFile check so a
  pipe caller can't slurp arbitrary secrets into the viewer.
- Webview hardening (#9): central web-contents-created handler strips
  preload/nodeIntegration from webviews, routes window.open to the OS
  browser, and blocks the main window from navigating off its own UI.

Tests: pipe-server token auth (9) + new cdp-proxy host/origin guard (9).
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
The helper ran a hidden powershell.exe recursively piping the install dir
into Unblock-File. It stripped nothing: net.request + createWriteStream
write no :Zone.Identifier stream, and executables under the install dir are
already unblocked in-process by stripMotw() on every launch. What it did do
was emit the helper's strongest behavioural-AV signal (MOTW bypass,
T1553.005).

Also corrects the self-delete comment: %TEMP% is not reclaimed on its own.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
Since the apply helper stopped deleting itself, one .cmd per update piles
up in %TEMP%, which Windows does not reclaim without Storage Sense. An
extract dir whose rmdir failed on a locked file leaks the same way.

The names are now built in one place (updateStampName / updateZipName /
updateHelperName) and parsed back by classifyUpdateLeftover, so creation
and removal cannot drift. sweepUpdateLeftovers runs 60 s after a packaged
Windows start, unawaited and unref'd, whatever the install type or the
updater kill switch. Every rule keeps on doubt:

- age <= 1 h, negative or unreadable: keep (a helper may still run)
- zip or extract dir with a fresh helper of the same PID: keep (after
  "Later" the payload is old while a helper copies from it)
- PID alive, or liveness unknown: keep (a staged update)
- symlink/junction, or type not matching the name: keep

main.log gets one update-sweep line with counts and error codes when
anything was removed or failed.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
"Install and restart" on a portable zip quit unconditionally. Two ways to
end up with wmux closed and nothing to restart it:

- the staged payload vanished while the update sat behind "Later" (Storage
  Sense, a temp cleanup): the helper's own check exits before :relaunch;
- the helper could not be written, or cmd.exe never started (an antivirus
  blocking either): spawn() reported that as an 'error' event after the
  quit had begun, with no listener, so also an uncaught exception in main.

applyStagedPortableUpdate is now async: it checks <payload>\wmux.exe first
(rejecting with PAYLOAD_MISSING), and quits only after the child's 'spawn'
event. The 'error' listener stays attached for late errors.

Both callers in updater.ts go through applyStagedZipOrReset, which sets the
error state, clears installPrompted so the next update still asks, and drops
the staged payload only when the payload is what is missing. A click on the
error badge retries a still-staged payload instead of downloading again, and
a second click while the helper is starting does not start another one.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
The helper was spawned as `cmd /d /c <helper> <pid> <src> <dst> <exe>` with
Node quoting each piece. When %TEMP% contains a space (any account named
"First Last"), the helper path is quoted, the line holds more than two
quotes, and cmd /c strips the first and the last one: the helper arrives
as `C:\Users\First`, "is not recognized", and cmd.exe exits 1 having done
nothing. By then wmux has quit, and since cmd.exe itself started, the
'spawn' guard from the previous commit cannot see it.

buildHelperArgs builds `/d /s /c ""<helper>" "<pid>" ... "<exe>""` for a
verbatim spawn, the documented form where cmd strips exactly the outer
pair. A piece containing a double quote is refused.

Reproduced with a real child_process.spawn against a "Jan Kowalski\Temp"
path (exit 1, "...\Jan is not recognized"); with this change the same run
copies the payload and removes it.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
Adds the design spec for #3 with its verification results: the helper run
by hand end to end, A1 confirmed (robocopy replaces the destination's
streams, so an overwritten exe keeps no :Zone.Identifier), and two findings
from running the helper through a real spawn — the %TEMP%-with-a-space
failure fixed in the previous commit (F12/D11), and timeout.exe refusing
the ignored stdin, left for the wait-loop follow-up (F13).

The zip-updater.ts row in CLAUDE.md now covers the install guards, the
verbatim helper command line, why the helper neither strips MOTW nor
deletes itself, and the sweep's keep rules.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
Code review of the install guards found two problems with the error-badge
retry:

- A failure that repeats (an antivirus blocking the helper every time)
  re-ran the same install on every click. The badge never changed, and
  requestUpdateNow kept answering handled: true, so the release-page
  fallback was never offered.
- A retry that worked quit wmux and every session without a dialog, from
  a badge that reads "Click to try again", not "Restart".

The retry now goes back through the install dialog. After the retry of the
same staged payload has failed too, the click answers
{ handled: false, reason: 'install_failed' } and the renderer opens the
release page. The count resets whenever a new update is staged.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
…k that opens

From the Copilot review of the error-badge retry:

- Retrying set the phase to `ready` and only then deferred the dialog with
  setImmediate. A second click reaching main in that gap took the `ready`
  branch and applied the update, quitting wmux behind the open dialog. The
  phase now stays `error` and promptToInstall starts synchronously, so its
  `installPrompted` guard catches the second click.
- `install_failed` handed over to the release page, but the renderer only
  opens one it has cached from the notify-only poller, which may not have
  answered when the update was started from Help. Main now returns the page
  (`releasePageUrl`) with the result, and `fallbackReleaseUrl` prefers it.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
The zip-updater header said the helper "must not start again", which reads
as if the helper itself should not run. What must not be reintroduced is
the MOTW strip. The spec now also records the changes made after the
Copilot review.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
Quoting stops cmd /c from splitting a path, not from expanding it: a
%NAME% naming a defined variable is rewritten inside quotes. Measured with
a verbatim spawn: "C:\x\%OS%\y" reached the batch as C:\x\Windows_NT\y,
while a lone % and an undefined %NAME% passed through unchanged. A rewritten
install or payload path makes the helper exit on a path that does not
exist, after wmux has quit, with 'spawn' already reported.

buildHelperArgs now refuses any piece containing a %...% pair, so
applyStagedPortableUpdate rejects while wmux is still running and the
error badge / release-page fallback takes over. A lone % is still allowed.

Raised by the second Copilot review.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
The second Copilot review pointed out that the spec still documented
pre-review behaviour a future change could copy back in:

- the apply snippet used once('error'), contradicting the late-error
  guarantee beside it;
- the retry snippet applied straight from the error badge, the exact
  confirmation bypass fixed in 9ad5800;
- the impact section said the renderer was not changed.

§6.5 is rewritten around the code as it is (applyingZip, the attempt cap,
the synchronous dialog, the fallback URL), §6.6 and CLAUDE.md cover the
%...% refusal, and the impact table lists update-checker.ts, useUpdate.ts
and the new test file.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
amirlehmam pushed a commit that referenced this pull request Sep 18, 2026
…ly wait

The apply helper's console cannot be hidden: `detached: true` implies
DETACHED_PROCESS, Windows ignores CREATE_NO_WINDOW beside it, and cmd.exe
allocates a console of its own (measured — a detached spawn adds a
conhost.exe, an otherwise identical non-detached one does not). So a user
running T1 on a test build got an empty window titled
`findstr.exe /I /C:" 39944 "` and could not tell whether it wanted input.

Hiding it is the wrong fix twice over. Dropping `detached` risks the helper
dying with wmux, which is the one failure with no way back, since wmux has
already quit; and a hidden detached script that overwrites an unsigned exe
and relaunches it is the dropper shape #3 is about. The window stays and
introduces itself instead, with the title re-set inside the loop because
Windows renames a console after its current child.

The wait is fixed while here (F13): `timeout.exe` refuses the helper's NUL
stdin, so `/t 3` returned in 66 ms and the loop spun `tasklist` with no
pause at all — 0.31 s of CPU over an 8 s wait, with its error line repeated
into the console. `waitfor /t N` honours that stdin; the same run now costs
0 s of CPU. Not `ping -n`, which is the dropper batch-sleep idiom.

Refs #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqkiCr8Gum46GymUfiAngg
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.

2 participants