Skip to content

feat: support multi-slash model IDs and provider hint extraction#2758

Open
hunghoang3011 wants to merge 2 commits intocode-yeongyu:devfrom
hunghoang3011:fix/forward-model-to-subagents
Open

feat: support multi-slash model IDs and provider hint extraction#2758
hunghoang3011 wants to merge 2 commits intocode-yeongyu:devfrom
hunghoang3011:fix/forward-model-to-subagents

Conversation

@hunghoang3011
Copy link
Copy Markdown

@hunghoang3011 hunghoang3011 commented Mar 23, 2026

Summary

  • Fix model resolution for multi-slash model IDs (e.g., aws/anthropic/bedrock-claude-opus-4-6) where the first /-segment is not a real provider, causing agents to
    fall through to free/default models
  • Forward user-configured model overrides to sub-agents dispatched via call-omo-agent, which previously sent prompts without any model field

Changes

  • New extractProviderHint utility (src/shared/extract-provider-hint.ts): Validates the first segment of a model string against the connected-providers cache
    before using it as a provider filter. Returns undefined for unrecognized providers, enabling cross-provider matching.
  • fuzzyMatchModel cross-provider fallback (src/shared/model-availability.ts): When provider-filtered candidates = 0, retries without the provider filter instead
    of returning null immediately. Acts as a universal safety net for multi-slash IDs.
  • extractModelPrefix fix (src/hooks/think-mode/switcher.ts): Changed indexOf("/") to lastIndexOf("/") so think-mode correctly extracts the base model name
    from multi-slash IDs.
  • Model resolution pipeline (src/shared/model-resolution-pipeline.ts): Replaced naive [parts[0]] provider hint extraction at 4 sites with extractProviderHint
    validated against connected providers.
  • Delegate-task model selection (src/tools/delegate-task/model-selection.ts): Same extractProviderHint fix for the category-default and user fallback model paths.
  • call-omo-agent model forwarding (src/tools/call-omo-agent/tools.ts, sync-executor.ts, background-executor.ts): Added resolveModelForCallOmoAgent to read
    agent override model from config, and pass model/variant in the promptAsync body and manager.launch() call -- matching how delegate-task already handles this.

Testing

bun run typecheck        # Clean
bun test                 # 2514 pass, 3 pre-existing failures (jest.clearAllTimers in unrelated files)
                                                                                                                                                                          
New test coverage for multi-slash model ID handling in:                                                                                                                   
- src/shared/extract-provider-hint.test.ts                                                                                                                                
- src/shared/model-availability.test.ts                                                                                                                                   
- src/shared/model-resolution-pipeline.test.ts                                                                                                                          
- src/tools/delegate-task/model-selection.test.ts                                                                                                                         
- src/hooks/think-mode/switcher.test.ts 

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds robust support for multi-slash model IDs and forwards user-selected models to sub-agents, including inheriting model/variant from user categories. This prevents unintended fallbacks and keeps sub-agent runs aligned with user-selected models.

- **New Features**
- Extracts a validated provider hint from model strings using connected providers; supports IDs like `aws/anthropic/bedrock-claude-opus-4-6` when the first segment isn’t a real provider.
- `fuzzyMatchModel` retries without the provider filter if no candidates remain after filtering, enabling cross-provider resolution.
- For `call-omo-agent`, forwards the configured `model` and optional `variant` to both sync and background executors, and inherits them from user categories when the override references a category.

- **Bug Fixes**
- Think-mode now uses the last slash to extract the base model, so high-variant logic works with multi-slash IDs.
- Model resolution and delegate-task selection use validated provider hints instead of naive splitting, fixing multi-slash category defaults and user fallbacks.

<sup>Written for commit b6bc1a24a5945e551b93ae5f238aa673bb947826. Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

- Add extractProviderHint utility to extract provider from model strings
- Update fuzzyMatchModel to retry without provider filter when no matches
- Fix extractModelPrefix to use lastIndexOf for multi-slash IDs
- Update model resolution to use provider hints instead of naive split
- Pass agent model overrides to background and sync executors
- Add tests for multi-slash model ID handling and provider hint extraction
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 23, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@hunghoang3011
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Mar 23, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 14 files

Confidence score: 3/5

  • There is a concrete regression risk in src/tools/call-omo-agent/tools.ts: model resolution currently skips category-level inheritance and only uses agentOverride.model, which can cause the wrong primary model to be selected at runtime.
  • The other findings in src/shared/model-resolution-pipeline.ts and src/shared/model-availability.ts are lower severity (duplicate/shadowed initialization and unreachable fallback branch) and are more about correctness clarity and maintainability than immediate breakage.
  • Given one medium-severity, high-confidence user-facing behavior issue plus a couple of minor refactor artifacts, this carries some merge risk but is likely manageable with a focused fix.
  • Pay close attention to src/tools/call-omo-agent/tools.ts, src/shared/model-resolution-pipeline.ts, src/shared/model-availability.ts - ensure inheritance-based model selection is restored and clean up shadowed/dead fallback logic.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/shared/model-resolution-pipeline.ts">

<violation number="1" location="src/shared/model-resolution-pipeline.ts:49">
P2: Refactor introduced duplicate `connectedProviders` initialization; inner fallback-chain declaration shadows outer variable and redundantly re-reads cache.</violation>
</file>

<file name="src/tools/call-omo-agent/tools.ts">

<violation number="1" location="src/tools/call-omo-agent/tools.ts:51">
P2: `call-omo-agent` model resolution ignores category-level model inheritance and only reads `agentOverride.model`, so category-configured primary models are silently skipped.</violation>
</file>

<file name="src/shared/model-availability.ts">

<violation number="1" location="src/shared/model-availability.ts:68">
P3: The added `else` branch in the empty-candidates fallback is dead code and cannot be reached with current control flow.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread src/shared/model-resolution-pipeline.ts
Comment thread src/tools/call-omo-agent/tools.ts Outdated
Comment thread src/shared/model-availability.ts Outdated
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 4 files (changes from recent commits).

Auto-approved: Fixes multi-slash model resolution and adds model forwarding to sub-agents. Changes are well-tested and improve robustness of provider/model mapping.

@code-yeongyu code-yeongyu added the triage:bug Confirmed bug with repro steps label Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:bug Confirmed bug with repro steps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants