docs(global-settings): finish the toast correction, harden the CLI-path snippet - #718
docs(global-settings): finish the toast correction, harden the CLI-path snippet#718WilcoLouwerse wants to merge 2 commits into
Conversation
…th snippet Two findings from the Quick re-review of this PR: - The one-session-switch paragraph still said the EPERM toast follows a typed /model, contradicting the table two screens up (which the previous commit did correct). Say instead that "for this session only" IS Claude Code reporting the refused persist, and that the picker is what raises the toast. - The PATH fallback used an unquoted glob in a command substitution. VSCode keeps several extension versions during an upgrade, so with two installed the glob expands to two paths and the snippet breaks. Verified: two matching dirs give 2 words with the old form, 1 with 'ls -1d … | tail -1'. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
| # If `command -v claude` comes up empty, point at the bundled binary instead. | ||
| # VSCode keeps several extension versions during an upgrade, so take the newest | ||
| # match rather than letting the glob expand to more than one path. | ||
| CLAUDE="$(command -v claude || ls -1d ~/.vscode-server/extensions/anthropic.claude-code-*/resources/native-binary/claude 2>/dev/null | tail -1)" |
There was a problem hiding this comment.
🟡 Concern — tail -1 after plain ls -1d picks lexicographically last, not newest, so it breaks on the exact scenario this fix targets
The stated purpose of this change is "take the newest match rather than letting the glob expand to more than one path." It solves the multi-path-expansion problem, but ls -1d sorts its output byte-wise (locale collation), not by version number — so tail -1 does not reliably select the newest extension directory once a version bump crosses a digit-width boundary (e.g. 1.9.0 → 1.10.0).
Verified directly:
$ mkdir -p anthropic.claude-code-1.9.0/... anthropic.claude-code-1.10.0/...
$ ls -1d anthropic.claude-code-*/resources/native-binary/claude
anthropic.claude-code-1.10.0/resources/native-binary/claude
anthropic.claude-code-1.9.0/resources/native-binary/claude
$ ls -1d anthropic.claude-code-*/resources/native-binary/claude | tail -1
anthropic.claude-code-1.9.0/resources/native-binary/claude # wrong — 1.10.0 is newer
VSCode extension version bumps routinely cross this boundary (e.g. 1.9.x → 1.10.x), so the snippet can silently point $CLAUDE at a stale binary during exactly the upgrade window the fix was written for.
Suggested fix — sort by modification time instead of lexicographically (matches "newest" semantically and needs no numeric-version parsing):
CLAUDE="$(command -v claude || ls -1dt ~/.vscode-server/extensions/anthropic.claude-code-*/resources/native-binary/claude 2>/dev/null | head -1)"…newest binary ls -1d | tail -1 sorts byte-wise, so it silently picks an older extension directory once a version bump crosses a digit-width boundary (1.9.0 vs 1.10.0) — exactly the upgrade window the snippet was meant to handle. ls -1dt | head -1 sorts by modification time instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
What
Two findings from the Quick re-review of #701. That PR merged while the re-review was still running, so its fixes could not ride along and land here instead.
1. The doc contradicted itself on its own central claim
#701's first round flagged that the
Failed to set model: EPERMtoast comes from the model picker, not from a typed/model. The fix commit corrected the comparison table but missed the "Switching to another model for one session" paragraph two screens down, which still read:So the merged doc explains the mechanism one way in the table and the opposite way in the prose. Corrected here: the "for this session only" wording is Claude Code reporting the refused persist, and the picker is what raises the toast with no switch at all.
2. The CLI-path fallback broke with two extension versions installed
The verification recipe used an unquoted glob inside a command substitution:
CLAUDE="$(command -v claude || echo ~/.vscode-server/extensions/anthropic.claude-code-*/resources/native-binary/claude)"VSCode keeps several extension versions during an upgrade — this machine currently has
2.1.260and2.1.263side by side. As soon as two of them ship the binary, the glob expands to two paths,$CLAUDEholds both, and every later use fails. Verified against two matching directories:Now uses
ls -1d … | tail -1, which yields exactly one path (the newest) regardless of how many versions are present.No VERSION bump
Docs-only —
docs/claude/global-claude-settings.mdis the single changed file and nothing underglobal-settings/is touched, so no installed artifact changes. This is exactly the case #701 amended the bump policy to cover.Related
v2.4.3), which does bump VERSION because it changes an installed artifact.🤖 Generated with Claude Code