Skip to content

fix(claude): version slash/tilde aliases under claude-ocx2- - #761

Merged
Wibias merged 2 commits into
lidge-jun:devfrom
Wibias:fix/alias-versioned-tilde-encoding
Jul 30, 2026
Merged

fix(claude): version slash/tilde aliases under claude-ocx2-#761
Wibias merged 2 commits into
lidge-jun:devfrom
Wibias:fix/alias-versioned-tilde-encoding

Conversation

@Wibias

@Wibias Wibias commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Mint escape-encoded Claude Code aliases under a new claude-ocx2- prefix so /~s and ~~t cannot collide with legacy claude-ocx- literals that already contained those two-char sequences.
  • Keep plain model ids on claude-ocx- (literal decode) for stability of existing picker selections.
  • Add aliasForNative tilde round-trip coverage; update EN + locale docs for the v1/v2 grammar.

Test plan

  • bun test ./tests/claude-alias.test.ts
  • bun test ./tests/claude-inbound.test.ts ./tests/claude-models-discovery.test.ts ./tests/claude-model-info.test.ts
  • bun x tsc --noEmit
  • CI green on Linux/Windows/macOS

Summary by CodeRabbit

  • New Features

    • Added versioned Claude Code model aliases for model IDs containing / or ~, using a new claude-ocx2- alias form.
    • Implemented reversible escaping (/~s, ~~t) for reliable alias generation and resolution.
    • Kept existing claude-ocx- (v1) aliases working for model IDs without / or ~.
  • Documentation

    • Updated the “From gateway” /model selector guidance and examples to reflect v2 alias formats, decoding rules, and fallback behavior.
  • Tests

    • Expanded coverage for v2 alias encoding/decoding and validation cases.

@github-actions github-actions Bot added the bug Something isn't working label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8de81792-826b-44f5-9033-fb867e929db3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Claude Code aliasing now uses versioned v1 and v2 prefixes. Model IDs containing / or ~ use reversible ~s/~t escaping under v2, with updated generation, resolution, tests, and localized documentation.

Changes

Claude alias versioning

Layer / File(s) Summary
Versioned alias encoding
src/claude/alias.ts
Exports v1/v2 prefixes and encodes or decodes / and ~ using ~s and ~t.
Alias generation and resolution
src/claude/alias.ts
Route and native aliases select v1 or v2 based on model contents; resolution decodes v2 aliases and retains v1 compatibility behavior.
Compatibility validation and documentation
tests/claude-alias.test.ts, docs-site/src/content/docs/**/guides/claude-code.md
Tests cover escaping, round trips, malformed aliases, and fallback behavior; guides document the revised grammar and v2 examples across localized guides.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ClaudeCodeCLI
  participant aliasForRoute
  participant resolveAlias
  ClaudeCodeCLI->>aliasForRoute: request v1 or v2 route alias
  aliasForRoute-->>ClaudeCodeCLI: return encoded or plain alias
  ClaudeCodeCLI->>resolveAlias: resolve selected alias
  resolveAlias-->>ClaudeCodeCLI: return provider/model or native slug
Loading

Possibly related PRs

  • lidge-jun/opencodex#738: Modifies the same Claude alias generation and resolution paths for reversible slash and tilde escaping.

Suggested reviewers: ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: introducing claude-ocx2- aliases for slash/tilde-encoded Claude aliases.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 47a7a9134f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

**エイリアス構文ルール:** provider には `/` や `--` を含められず `native` と同じでもいけません。
model ID には `/` を含められ、エイリアス内では `~s` として符号化します(例: `openrouter/anthropic/claude-opus-4-8` →
`claude-ocx-openrouter--anthropic~sclaude-opus-4-8`)。model ID のリテラル `~` は `~t` として符号化します。
`claude-ocx2-openrouter--anthropic~sclaude-opus-4-8`)。model ID のリテラル `~` は `~t` として符号化します。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Synchronize translated alias grammar with v2

The same partial edit in the Japanese, Korean, Russian, and Chinese pages changes only the slash example to claude-ocx2-, while each page's format table still says CLI aliases use only claude-ocx- and the surrounding text still implies ~s/~t are decoded without distinguishing v1 literal decoding from v2 escape decoding. Non-English users therefore receive internally inconsistent instructions and cannot determine which prefix to use; mirror the English page's plain-v1/escaped-v2 table and grammar in all four translations.

AGENTS.md reference: docs-site/AGENTS.md:L7-L10

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs-site/src/content/docs/guides/claude-code.md`:
- Around line 203-208: Correct the fallback sentence in the model alias
documentation so it reads “Routes that the readable form cannot express fall
back to the hashed alias.”

In `@docs-site/src/content/docs/ja/guides/claude-code.md`:
- Line 86: Update the CLI format table and grammar in
docs-site/src/content/docs/ja/guides/claude-code.md:86-86,
docs-site/src/content/docs/ko/guides/claude-code.md:121-121,
docs-site/src/content/docs/ru/guides/claude-code.md:91-91, and
docs-site/src/content/docs/zh-cn/guides/claude-code.md:93-93 to match the
English source, distinguishing plain v1 aliases from escaped v2 aliases and
documenting their decode rules: v1 preserves ~s/~t literally, while v2 expands
them. Ensure all localized guides consistently explain the compatibility
boundary and do not leave the claude-ocx2 examples implying v1-only syntax.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 44218ac0-9268-423f-a40d-287305141dbe

📥 Commits

Reviewing files that changed from the base of the PR and between 350a07b and 47a7a91.

📒 Files selected for processing (7)
  • docs-site/src/content/docs/guides/claude-code.md
  • docs-site/src/content/docs/ja/guides/claude-code.md
  • docs-site/src/content/docs/ko/guides/claude-code.md
  • docs-site/src/content/docs/ru/guides/claude-code.md
  • docs-site/src/content/docs/zh-cn/guides/claude-code.md
  • src/claude/alias.ts
  • tests/claude-alias.test.ts

Comment thread docs-site/src/content/docs/guides/claude-code.md Outdated
Comment thread docs-site/src/content/docs/ja/guides/claude-code.md Outdated
@Wibias

Wibias commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Wibias
Wibias merged commit be177ea into lidge-jun:dev Jul 30, 2026
10 checks passed
@Wibias
Wibias deleted the fix/alias-versioned-tilde-encoding branch July 30, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant