Fix case-sensitive client-name matching in hyp attach/detach (#300)#301
Merged
Conversation
`hyp attach Claude` (and `hyp detach Claude`, `hyp attach ALL`) failed with `unknown client 'Claude'` because the client token was matched case-sensitively end to end. The products are branded "Claude"/"Codex" with capitals, so the mixed-case token is a very plausible user mistake. Both `runAttach` and `runDetach` route through `runClientLifecycle`, which parses the token once via `parseClientArgs`/`setClient`. Lowercasing the user-supplied token there normalizes all three resolution paths in one spot: attach's live gateway registry (`getClient`), detach's client-descriptor map (keyed by lowercase manifest names), and the lowercase `all` sentinel. Adapter registration (`CLIENT_NAME = 'claude'`) is unchanged. Adds a regression test that fails on the prior code (attach Claude, attach ALL, detach Claude all exit 1 `unknown client`) and passes after the fix, plus an already-lowercase control to prove behavior is preserved. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
neutral PR-review round 1 — PR #301 — cleanPath: dual-review (Codex + Claude, both ran, converged). Verdict: Verified (not trusting self-report)
FindingsNone (no blocker/major/minor). Non-blocking, not actionable for this PR
Marker = |
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.
Problem
hyp attach Claudefailed witherror: unknown client 'Claude'. Registered clients: claude, codex. Client-name matching was case-sensitive end to end. The products are branded "Claude"/"Codex" with capitals, so the mixed-case token is a very plausible user mistake. The issue (#300) also calls outhyp detach Claude(a different resolution path) and thehyp attach ALLsentinel.Root cause (verified)
parseClientArgsinsrc/core/commands/clients.jsstored the positional /--clienttoken verbatim (default'claude'). Downstream:getClient(name)(state.clients.get(name)); the adapter registers lowercase (CLIENT_NAME = 'claude').allsentinel is an exact=== 'all'compare in bothexpandClientNameandexpandDetachClientNames.Both
runAttachandrunDetachroute throughrunClientLifecycle, which parses the token once viaparseClientArgs/setClient. So lowercasing the user-supplied token insetClientnormalizes all three paths in one spot. Confirmed the shared code path by reading the source: detach's descriptor map is built bybuildClientDescriptorMap, which returns keys['claude','codex'], somap.get('Claude')missed pre-fix.Fix
Lowercase the user token once in
setClient(insideparseClientArgs). Adapter registration is unchanged. The multiple-specified guard and error text now compare the normalized token.Tests (fail -> pass)
New
test/core/client-name-case-insensitive.test.js:attach Clauderesolves to the lowercaseclaudeadapter (attach runs, exit 0).attach ALLexpands to every registered client (claude,codex).detach Clauderesolves via the client-descriptor map (no-op success on a temp HOME, notunknown client).attach claude(already lowercase) is unchanged.On unmodified code, tests 1-3 fail with
unknown client/ exit 1; the control passes. After the fix all four pass. Fullnpm testis green (2156 pass, 0 fail, 1 pre-existing skip).Covers attach, detach, and the
ALLsentinel as required.🤖 Generated with Claude Code
Fixes #300