fix: strip OSC escape sequences from login shell path resolution#23
Closed
tuxfamily wants to merge 3 commits intojazzyalex:mainfrom
Closed
fix: strip OSC escape sequences from login shell path resolution#23tuxfamily wants to merge 3 commits intojazzyalex:mainfrom
tuxfamily wants to merge 3 commits intojazzyalex:mainfrom
Conversation
4983cbf to
38fb607
Compare
When resolving paths via interactive login shell (-lic), terminal integrations like iTerm2 inject OSC escape sequences (ESC]...BEL) into stdout, corrupting the resolved path. Changes: - Strip OSC sequences (\x1b\]...\x07) from output of all login shell path resolution functions in ClaudeStatusService and CodexStatusService (checkTmuxAvailable, resolveTmuxPath, resolveTerminalPATH, resolveTmuxPathFromLoginShell, resolveTerminalPATHFromLoginShell) - Resolve terminal PATH from login shell for probe script environment, replacing the minimal GUI PATH (/usr/bin:/bin:/usr/sbin:/sbin) - Respect user's custom Claude CLI binary path setting in probe execution instead of always passing customPath: nil - Update trust prompt detection to match Claude Code's new wording - Replace ((iterations++)) with iterations=$((iterations + 1)) to avoid silent exit under set -e when counter starts at zero Tool: Claude Code Model: claude-opus-4-6
Port two proven patterns from codex_status_capture.sh: - Set TMUX_TMPDIR="/tmp" to avoid UNIX socket path length issues with the GUI app's long TMPDIR path - Wrap tmux new-session in set +e with retry on failure, matching the resilient session creation used by the Codex probe Tool: Claude Code Model: claude-opus-4-6
The script's internal TIMEOUT_SECS (10s) was too short for Claude CLI to boot in the tmux session, especially on first run where shell initialization (fish/conda) adds several seconds. - Increase script TIMEOUT_SECS from 10 to 14 (matching Codex) - Increase Swift waitForProcessExit from 20s to 30s to accommodate the longer script timeout plus shell resolution overhead Tool: Claude Code Model: claude-opus-4-6
38fb607 to
a454c16
Compare
Owner
|
Thanks again for the detailed PR. I applied the fix directly on current main in commit e80b6e8 (adjusted to preserve newer timeout/runtime behavior while fixing the same root cause). Closing this PR as superseded by main. |
Author
|
Okay, thank you. I'll give it a try! :) |
Owner
|
Will be released in upcoming release this week |
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.
Summary
-liccommands). Terminal integrations like iTerm2 injectESC]...BELsequences into stdout, corrupting resolved paths (e.g. tmux, claude binary, terminal PATH)./usr/bin:/bin:/usr/sbin:/sbin) that preventednodefrom being found.customPath: nil."Yes, I trust this folder"instead of"Do you trust the files in this folder?").set -esilent exit —((iterations++))returns exit status 1 when counter is 0, replaced withiterations=$((iterations + 1)).Affected files
ClaudeStatusService.swiftresolveTerminalPATH()CodexStatusService.swiftresolveTerminalPATHFromLoginShellandresolveTmuxPathFromLoginShellclaude_usage_capture.shset -esafe iterationTest plan
swift -evalidates OSC regex strips sequences correctlyCLAUDE_BIN=...)