Skip to content

fix(aibridge): track Charm Crush client and session ID#24630

Merged
dannykopping merged 1 commit into
mainfrom
fix/crush-client-session-tracking
Apr 22, 2026
Merged

fix(aibridge): track Charm Crush client and session ID#24630
dannykopping merged 1 commit into
mainfrom
fix/crush-client-session-tracking

Conversation

@dannykopping
Copy link
Copy Markdown
Contributor

Disclaimer: implemented by a Coder Agent using Claude Opus 4.6

Porting coder/aibridge#277 to coder/coder after the aibridge code move.

Summary

Fixes client detection and session ID tracking for the Charm Crush AI coding client.

Changes

Bug fix: User-Agent matching

The actual Crush user-agent is Charm-Crush/{version} (https://charm.land/crush) (hyphenated), but GuessClient only checked for charm crush/ (space-separated). After lowercasing, Charm-Crush/0.2.0 becomes charm-crush/0.2.0, which did not match the charm crush/ prefix.

Now matches both formats for backwards compatibility.

Session ID tracking

Adds an explicit ClientCrush case to GuessSessionID. Crush does not currently send a session ID header to upstream AI providers, so this returns nil (consistent with how ClientZed, ClientRoo, and ClientCursor are handled).

Tests

  • Added charm_crush_hyphen test case for GuessClient using the real user-agent format.
  • Added crush_returns_empty test case for GuessSessionID.

The actual Crush user-agent is Charm-Crush/{version} (hyphenated),
but GuessClient only checked for the space-separated charm crush/ prefix.
Now matches both formats for backwards compatibility.

Adds an explicit ClientCrush case to GuessSessionID. Crush does not
currently send a session ID header, so this returns nil (consistent
with ClientZed, ClientRoo, and ClientCursor).

Ported from coder/aibridge#277
@dannykopping dannykopping requested a review from pawbana April 22, 2026 16:04
@dannykopping dannykopping marked this pull request as ready for review April 22, 2026 16:04
@dannykopping dannykopping merged commit 8aa3294 into main Apr 22, 2026
33 checks passed
@dannykopping dannykopping deleted the fix/crush-client-session-tracking branch April 22, 2026 17:02
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 22, 2026
@johnstcn
Copy link
Copy Markdown
Member

❤️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants