Skip to content

fix(claude): stop native ~/.local/bin/claude shadowing the Alpine dispatcher - #1

Merged
Crypt0Shmipt0 merged 1 commit into
mainfrom
fix/claude-dispatcher-shadow
Jul 1, 2026
Merged

fix(claude): stop native ~/.local/bin/claude shadowing the Alpine dispatcher#1
Crypt0Shmipt0 merged 1 commit into
mainfrom
fix/claude-dispatcher-shadow

Conversation

@Crypt0Shmipt0

Copy link
Copy Markdown
Owner

Problem

On Alpine-mode installs, claude is a thin Termux→Alpine dispatcher. But a native claude self-update (or a bare-Termux install) drops a ~/.local/bin/claude that sits ahead of $PREFIX/bin in PATH and silently shadows the dispatcher — so claude breaks while grok/agy/codex keep working (the "works for everyone but Claude" paradox). The existing persistence hook re-labels MLS but never re-asserts the dispatcher, so it recurs on every Claude update.

Fix

  • install_claude_dispatcher (lib/common.sh): writes the dispatcher to all three entry points a native install can occupy (~/.local/bin, ~/bin, $PREFIX/bin), keeps a canonical copy under $PREFIX/libexec/root-aicli/, and re-applies Termux MLS.
  • install_claude_session_guard (lib/common.sh): drops etc/profile.d/root-aicli-claude.sh, a login-shell guard that reasserts the dispatcher if a self-update re-shadows it — zero-gap (heals on the next terminal open, as the Termux user, so context is inherited automatically).
  • 20-claude.sh: now calls both helpers instead of writing a single entry point.
  • 50-persistence.sh: the boot hook now reasserts the dispatcher on every boot in Alpine mode (in addition to the MLS relabel).

Bionic/Path-B (native claude) installs are unaffected — the dispatcher/guard/boot-reassert are all gated on detect_runtime_preference = alpine.

Testing

  • bash -n passes on all three changed shell files.
  • Verified live on an Ayn Odin 3 (Snapdragon 8 Gen 3, Magisk): after the fix, claude resolves to the dispatcher even with ~/.local/bin first in PATH.

🤖 Generated with Claude Code
https://claude.ai/code/session_01RCBu9ooZapfHJLDy9MHTrs

…op native shadow

A native `claude` self-update (or bare-Termux install) drops a
~/.local/bin/claude ahead of $PREFIX/bin in PATH and silently shadows the
Alpine dispatcher, so `claude` breaks while every other CLI keeps working
(the "works for everyone but Claude" paradox).

- install_claude_dispatcher: write the dispatcher to all three entry points
  (~/.local/bin, ~/bin, $PREFIX/bin) + a canonical copy under $PREFIX/libexec.
- install_claude_session_guard: profile.d login-shell guard that reasserts the
  dispatcher if a self-update re-shadows it (zero-gap; heals on next terminal).
- 50-persistence.sh: boot hook now reasserts the dispatcher on every boot in
  Alpine mode, in addition to the existing MLS relabel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RCBu9ooZapfHJLDy9MHTrs
@Crypt0Shmipt0
Crypt0Shmipt0 merged commit 8b9ff10 into main Jul 1, 2026
1 check passed
@Crypt0Shmipt0
Crypt0Shmipt0 deleted the fix/claude-dispatcher-shadow branch July 1, 2026 11:14
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.

2 participants