Skip to content

[WRONG BRANCH] fix(slug): prefer self-namespaced exact matches in resolveSlugSelection - #344

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-resolver-defect
Draft

[WRONG BRANCH] fix(slug): prefer self-namespaced exact matches in resolveSlugSelection#344
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-resolver-defect

Conversation

@luvs01

@luvs01 luvs01 commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Motivation

  • The selection resolver could misclassify selections that start with a provider prefix (for example orcarouter/auto) as already routed, which caused self-namespaced native IDs to be ignored or confused with a suffix-only ID.

Description

  • Change resolveSlugSelection to materialize knownIds and prefer a known native exact match before interpreting the input as a provider-prefixed routed slug by adjusting the qualified calculation in src/providers/slug-codec.ts.
  • Iterate over the captured ids array (instead of the original iterable) so the pre-check for an exact known-id is stable and available during matching.
  • Add two regression tests in tests/slug-codec.test.ts that assert orcarouter/auto resolves exactly both when it is the only known id and when auto also exists.

Testing

  • Verified the corrected behavior with a focused runtime check using bun -e 'import { resolveSlugSelection } from "./src/providers/slug-codec.ts"; ...', which confirmed the resolver returns the expected matches.
  • Ran bun run typecheck which passed and git diff --check which reported no issues.
  • Attempted bun test tests/slug-codec.test.ts but the test harness in this environment is blocked by Bun 1.2.14 lacking the node:zlib zstdDecompressSync export, so the new tests are present but could not be executed end-to-end here.

Codex Task

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7457018b-86ab-4094-86f1-6487ca5af3c2


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added the bug Something isn't working label Aug 28, 2026
@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot changed the title fix(slug): prefer self-namespaced exact matches in resolveSlugSelection [WRONG BRANCH] fix(slug): prefer self-namespaced exact matches in resolveSlugSelection Aug 28, 2026
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 28, 2026 02:03

@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: f056c40a57

ℹ️ 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".

Comment on lines +145 to +147
const qualified = ids.includes(selection) || !selection.startsWith(`${provider}/`)
? routedSlug(provider, selection)
: selection;

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 Resolve against each provider's complete model set

When customModels contains both orcarouter/auto and auto, this preference does not reach the production removal flow: handleCustomRemove calls resolveSlugSelection separately with each singleton [model.modelId], so this condition treats the first row as a native exact match and the second row as a routed suffix, causing both indices to match and ocx models remove orcarouter/auto --yes to fail as ambiguous. Resolve once against all IDs for the provider (or preselect the native exact row) and add a focused CLI regression covering the two-row case.

AGENTS.md reference: AGENTS.md:L284-L286

Useful? React with 👍 / 👎.

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

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant