From 8595a80f66287486de9a56b36b6b0da99f8f6728 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Sat, 26 Sep 2026 13:19:14 -0400 Subject: [PATCH] Tighten welcome, cmux-cua build, and codex wrapper follow-ups - Skip the automatic welcome for workspaces launched with an explicit command; `shell -lc` never loads the integration that prints it. - Read the uid once in the codex wrapper's emitter shell before the helper command substitutions. - Do not add an empty (current-directory) PATH entry in build-cmux-cua.sh when PATH is empty. - Count duplicate cask macOS requirement lines instead of deduplicating. - Assert the tmux welcome case still consumes the token. Co-Authored-By: Claude Opus 5.5 (1M context) --- Resources/bin/cmux-codex-wrapper | 4 +++- Sources/TabManager.swift | 5 +++++ scripts/build-cmux-cua.sh | 2 +- tests/test_ci_homebrew_cask_macos_dependency.sh | 2 +- tests/test_shell_welcome_banner_startup.py | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Resources/bin/cmux-codex-wrapper b/Resources/bin/cmux-codex-wrapper index bc03f162f916..80d6860617ad 100755 --- a/Resources/bin/cmux-codex-wrapper +++ b/Resources/bin/cmux-codex-wrapper @@ -376,6 +376,9 @@ cmux_codex_emit_computer_use_args() { # ownership, daemon credentials, and the installed approval broker. cmux_computer_use_surface_socket_available || return 0 local client default_session runtime_scope runtime_uid cua_socket state_dir auth_token + # Read the uid in this shell first: the helpers below run in command + # substitutions, so a uid they cache would not survive back here. + cmux_codex_wrapper_effective_uid || return 1 client="$(cmux_computer_use_resolve_client)" || return 1 auth_token="$(cmux_computer_use_auth_token)" || return 1 # Stable per-terminal session id so the branded cursor survives helper restarts. @@ -387,7 +390,6 @@ cmux_codex_emit_computer_use_args() { runtime_scope="$(printf '%s' "$runtime_scope" | LC_ALL=C /usr/bin/tr -c 'A-Za-z0-9_.-' '-' | /usr/bin/sed -E 's/^[.-]+//; s/[.-]+$//' | /usr/bin/cut -c1-64)" fi [[ -n "$runtime_scope" ]] || runtime_scope="default" - cmux_codex_wrapper_effective_uid || return 1 runtime_uid="$cmux_codex_wrapper_uid" cua_socket="${CMUX_CUA_CODEX_SOCKET_PATH:-/tmp/cmux-cua-${runtime_uid}/${runtime_scope}/cmux-cua-codex.sock}" state_dir="${CMUX_CUA_STATE_DIR:-${HOME}/Library/Application Support/cmux/cmux-cua/runtime/${runtime_scope}/state}" diff --git a/Sources/TabManager.swift b/Sources/TabManager.swift index 2822b8da508b..7b40e65e770a 100644 --- a/Sources/TabManager.swift +++ b/Sources/TabManager.swift @@ -1389,7 +1389,12 @@ class TabManager: ObservableObject { let insertIndex = newTabInsertIndex(snapshot: snapshot, placementOverride: placementOverride) var welcomeDelivery: WelcomeBannerDelivery? var resolvedInitialTerminalEnvironment = initialTerminalEnvironment + // An explicit command runs via `shell -lc`, which never loads cmux's + // interactive shell integration, so it could not print the banner. + let hasInitialTerminalCommand = !(initialTerminalCommand? + .trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ?? true) if autoWelcomeIfNeeded && select && initialSurface == .terminal + && !hasInitialTerminalCommand && !UserDefaults.standard.bool(forKey: AccountCatalogSection().welcomeShown.userDefaultsKey) { let launch = WelcomeBannerDelivery.prepareLaunch(welcomeBannerDeliveryResolver()) welcomeDelivery = launch.delivery diff --git a/scripts/build-cmux-cua.sh b/scripts/build-cmux-cua.sh index c4ef24c99e22..490008499050 100755 --- a/scripts/build-cmux-cua.sh +++ b/scripts/build-cmux-cua.sh @@ -14,7 +14,7 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # Append rather than prepend: tools the caller already put on PATH (a pinned # toolchain, or the fake git/cargo in tests/test_cmux_cua_build_cache_safety.py) # must keep precedence over Homebrew's copies. -export PATH="${PATH}:${CARGO_HOME:-${HOME}/.cargo}/bin:/opt/homebrew/bin:/usr/local/bin" +export PATH="${PATH:+${PATH}:}${CARGO_HOME:-${HOME}/.cargo}/bin:/opt/homebrew/bin:/usr/local/bin" OUTPUT="" ARCHS_RAW="" diff --git a/tests/test_ci_homebrew_cask_macos_dependency.sh b/tests/test_ci_homebrew_cask_macos_dependency.sh index d4128ee09050..cbb7f927a910 100755 --- a/tests/test_ci_homebrew_cask_macos_dependency.sh +++ b/tests/test_ci_homebrew_cask_macos_dependency.sh @@ -50,7 +50,7 @@ for file in "${FILES[@]}"; do sub(/[[:space:]]*$/, "") print } - ' "$file" | sort -u + ' "$file" )" symbol_count="$(printf '%s\n' "$symbols" | sed '/^$/d' | wc -l | tr -d ' ')" if [ "$symbol_count" -ne 1 ]; then diff --git a/tests/test_shell_welcome_banner_startup.py b/tests/test_shell_welcome_banner_startup.py index 5c1c5c2e521e..f5082b8b06f4 100644 --- a/tests/test_shell_welcome_banner_startup.py +++ b/tests/test_shell_welcome_banner_startup.py @@ -103,7 +103,7 @@ def source(env: dict[str, str]) -> str: env[ENV_KEY] = str(token) env["TMUX"] = "/tmp/tmux-test/default,1,0" output = source(env) - if output.count(BANNER) != 0 or "after=unset" not in output: + if output.count(BANNER) != 0 or "after=unset" not in output or token.exists(): print(f"FAIL: {shell} printed the banner inside tmux") print(output) return 1