Skip to content

[WRONG BRANCH] fix(cli): refuse ambiguous self-namespaced removals - #394

Closed
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-custom-model-deletion-issue
Closed

[WRONG BRANCH] fix(cli): refuse ambiguous self-namespaced removals#394
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-custom-model-deletion-issue

Conversation

@luvs01

@luvs01 luvs01 commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent silent, destructive removals when a <provider>/<modelId> selector can be read both as a provider-qualified target and as a literal self-namespaced native id.
  • Ensure destructive CLI commands refuse ambiguous selectors and require the UUID in collision cases to avoid accidental deletion of the wrong custom-model row.

Description

  • Detect provider-qualified vs. native-id collisions in src/cli/models.ts and treat a <provider>/<modelId> that names both a self-namespaced native id and a provider-qualified sibling as ambiguous rather than choosing the native interpretation.
  • When such a collision is detected, the removal flow refuses the operation and asks the user to use the custom-model UUID instead of deleting either row.
  • Add regression coverage in tests/cli-models.test.ts asserting that models remove acme/turbo --yes fails as ambiguous when both acme/turbo and turbo exist, while preserving the existing behavior for a sole self-namespaced row.

Testing

  • Ran the focused tests: node_modules/.bin/bun test tests/cli-models.test.ts tests/slug-codec.test.ts, and the affected tests passed (focused run: 59 tests across the two files passed).
  • Typecheck passed with node_modules/.bin/bun run typecheck.
  • A full node_modules/.bin/bun run test run was started for broader verification but surfaced unrelated environment/concurrency failures; the focused tests and typecheck that verify this change succeeded.

Codex Task

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T01:04:55.994269Z b3171af PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Aug 31, 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: 784c8d4c-b908-406e-8299-b6d9bbd5e834


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.

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

ℹ️ 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 thread src/cli/models.ts
qualifiedModelId
&& target !== qualifiedModelId
&& admitted.has(target)
&& existing.some(model => model.provider === selectedProvider && model.modelId === qualifiedModelId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Resolve the full qualified collision class

When the self-namespaced ID contains another slash, this exact equality check misses an encoded qualified sibling. For example, the valid custom rows { provider: "acme", modelId: "acme/a/b" } and { provider: "acme", modelId: "a-b" } make models remove acme/a/b name the first row literally while its provider-qualified reading a/b is equivalent to the second row under resolveSlugSelection; because qualifiedModelId is a/b, this predicate finds no sibling and the command silently deletes the literal row instead of refusing the ambiguous destructive operation. Resolve the qualified reading through the shared resolver and admit its entire matched set rather than checking only exact modelId equality.

Useful? React with 👍 / 👎.

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

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions

github-actions Bot commented Aug 31, 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 changed the title fix(cli): refuse ambiguous self-namespaced removals [WRONG BRANCH] fix(cli): refuse ambiguous self-namespaced removals Aug 31, 2026
@github-actions
github-actions Bot marked this pull request as draft August 31, 2026 01:18
@luvs01 luvs01 closed this Aug 31, 2026
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