Skip to content

docs(global-settings): finish the toast correction, harden the CLI-path snippet - #718

Open
WilcoLouwerse wants to merge 2 commits into
mainfrom
docs/global-settings-model-switch-eperm
Open

docs(global-settings): finish the toast correction, harden the CLI-path snippet#718
WilcoLouwerse wants to merge 2 commits into
mainfrom
docs/global-settings-model-switch-eperm

Conversation

@WilcoLouwerse

Copy link
Copy Markdown
Contributor

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: EPERM toast 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:

The Failed to set model: EPERM toast that follows is the extension's failed attempt to persist the choice — ignore it

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.260 and 2.1.263 side by side. As soon as two of them ship the binary, the glob expands to two paths, $CLAUDE holds both, and every later use fails. Verified against two matching directories:

old glob form  -> words: 2
new ls|tail -1 -> words: 1  [.../anthropic.claude-code-2.1.263-.../native-binary/claude]

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.md is the single changed file and nothing under global-settings/ is touched, so no installed artifact changes. This is exactly the case #701 amended the bump policy to cover.

Related

🤖 Generated with Claude Code

…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>
Comment thread docs/claude/global-claude-settings.md Outdated
# 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)"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.01.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>
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.

1 participant