Repository navigation
Issue 6194 session restore resume cwd #6458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4714974
5eb3a18
9993961
7637f8b
711e6c7
ec5151f
a0c1d71
35a26a9
47df7bc
80250aa
f08e50f
b05b804
ce73aba
1e97a08
26e22ee
9d43d43
4202fb4
ea66e85
dd55181
d9c2102
0e840de
053b5ab
0f93c53
f1e104b
de2f5a4
d0b9577
b86b4e1
e9efdad
a416381
1adba51
2e2a07e
16a7b2e
c730a0a
a8c26d8
17ad80c
9645718
78d09b3
43f1c4b
4147f96
7a99666
52f5952
7741fb0
4fad54b
e807dde
6eca863
e8928e8
79df83f
31fcd98
22e3939
ac299ea
397248a
8aa4f89
bfe42d8
1780d27
6bf5d56
1cc03e1
c707f64
9ff87f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,9 +120,43 @@ extension TerminalSurface { | |
| try fileManager.createDirectory(at: shimDirectory, withIntermediateDirectories: true) | ||
| let script = """ | ||
| #!/usr/bin/env bash | ||
| cmux_wrapper=\(shellSingleQuoted(wrapperURL.path)) | ||
| if [[ ! -x "$cmux_wrapper" && -n "${CMUX_BUNDLED_CLI_PATH:-}" ]]; then | ||
| cmux_candidate="$(dirname "$CMUX_BUNDLED_CLI_PATH")/cmux-claude-wrapper" | ||
| if [[ -x "$cmux_candidate" ]]; then | ||
| cmux_wrapper="$cmux_candidate" | ||
| fi | ||
| fi | ||
| if [[ ! -x "$cmux_wrapper" ]]; then | ||
| cmux_cli="$(command -v cmux 2>/dev/null || true)" | ||
| if [[ -n "$cmux_cli" ]]; then | ||
| cmux_candidate="$(dirname "$cmux_cli")/cmux-claude-wrapper" | ||
| if [[ -x "$cmux_candidate" ]]; then | ||
| cmux_wrapper="$cmux_candidate" | ||
| fi | ||
| fi | ||
| fi | ||
| export CMUX_CLAUDE_WRAPPER_SHIM=\(shellSingleQuoted(shimURL.path)) | ||
| export CMUX_CLAUDE_WRAPPER_SHIM_ROOT=\(shellSingleQuoted(shimDirectory.path)) | ||
| exec \(shellSingleQuoted(wrapperURL.path)) "$@" | ||
| if [[ -x "$cmux_wrapper" ]]; then | ||
| exec "$cmux_wrapper" "$@" | ||
| fi | ||
| cmux_path_without_shim="" | ||
| cmux_old_ifs="$IFS" | ||
| IFS=: | ||
| for cmux_entry in ${PATH:-}; do | ||
| if [[ "$cmux_entry" == "$CMUX_CLAUDE_WRAPPER_SHIM_ROOT" || "$cmux_entry" == */cmux-cli-shims/* || "$cmux_entry" == */cmux-cli-shims ]]; then | ||
| continue | ||
| fi | ||
| if [[ -z "$cmux_path_without_shim" ]]; then | ||
| cmux_path_without_shim="$cmux_entry" | ||
| else | ||
| cmux_path_without_shim="$cmux_path_without_shim:$cmux_entry" | ||
| fi | ||
| done | ||
| IFS="$cmux_old_ifs" | ||
| export PATH="$cmux_path_without_shim" | ||
| exec claude "$@" | ||
|
Comment on lines
+141
to
+159
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The final fallback strips all cmux shim directories from |
||
| """ | ||
| try script.write(to: shimURL, atomically: true, encoding: .utf8) | ||
| try fileManager.setAttributes([.posixPermissions: 0o700], ofItemAtPath: shimURL.path) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,9 @@ cmux_claude_wrapper_is_self_or_shim() { | |
| return 0 | ||
| fi | ||
| case "$candidate" in | ||
| */cmux-cli-shims/*/claude|*/cmux-cli-shims/claude) | ||
| return 0 | ||
| ;; | ||
| */Contents/Resources/bin/claude|*/Resources/bin/claude) | ||
| return 0 | ||
| ;; | ||
|
|
@@ -306,7 +309,6 @@ extract_claude_resume_session_id() { | |
| fi | ||
| ;; | ||
| *) | ||
| return 1 | ||
| ;; | ||
| esac | ||
| index=$((index + 1)) | ||
|
Comment on lines
309
to
314
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The removal of the early Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
|
|
@@ -337,7 +339,6 @@ claude_explicit_session_flag_present() { | |
| fi | ||
| ;; | ||
| *) | ||
| return 1 | ||
| ;; | ||
| esac | ||
| index=$((index + 1)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callerTTYBindingCachestaysnilwhen TTY binding is stale and process binding is also not listedThe new code validates both
ttyBindingandprocessBindingagainstclaudeHookSurfaceIsListed. When the TTY binding exists but its surface is not listed (stale), the code falls through toprocessBinding. IfprocessBindingis also non-nil but its surface is also not listed (e.g., the socket is transiently unavailable during the listing check),callerTTYBindingCacheremainsniland the hook call is silently dropped. Previously the code would have used the stale TTY binding. The intentional "block fall-through on invalid surface" design is sound, but it introduces a new failure mode whenclaudeHookSurfaceIsListedhas transient false negatives — and there's no observability (no log, no metric) to distinguish a correctly-blocked stale surface from a spurious socket-read failure.