t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: delegate_task model_unavailable doesn't list the models the provider advertises

Open Guria opened this issue 3 weeks ago • 1 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Have a Codex instance codex enabled.
  2. From an agent thread, call delegate_task with a model slug codex does not advertise, e.g. target: {providerInstanceId: "codex", model: "codemie/gpt-6.1-terra", options: {reasoningEffort: "xhigh"}}.

Expected behavior

The error lists the models codex advertises, or the closest ones, so the agent can retry with a valid slug in one step.

Actual behavior

{"code":"model_unavailable","message":"Model codemie/gpt-6.1-terra is not advertised by provider codex."}

The message comes from apps/server/src/mcp/OrchestratorMcpService.ts:1427-1434. provider.models is in scope there, but the message doesn't include it, so the agent needs another orchestrator_capabilities call before it can retry.

We audited about 170 Claude Code sessions in T3 Code on one project (Oct 18 to Nov 6 2026) and found 4 of these failures in 3 sessions:

  • model: "codemie/gpt-6.1-terra" on providerInstanceId: "codex", twice, in two sessions.
  • target: {driverKind: "codex", model: "gpt-6.1-sol"} returned Model gpt-6.1-sol is not advertised by provider codex.

Each time the agent built the slug from prose instead of calling orchestrator_capabilities first. The sources were a project AGENTS.md naming codex/gpt-6.1-terra and a user saying "codemie". Agents will keep doing this, so the error message is where they need the answer.

Impact

Minor bug or occasional failure

Version or commit

main @ 2756da402b

Environment

Linux. Claude Code agents in T3 Code calling delegate_task against a Codex instance.

Suggested fix

Put the advertised slugs in the model_unavailable message. If the list is long, put the closest matches there instead, e.g. slugs ending in the same segment (gpt-6.1-terra for codemie/gpt-6.1-terra). #26619 and #25723 add the same check to t3_thread_launch and t3_thread_configure, so a shared helper would give all three the same message.

Workaround

Call orchestrator_capabilities and retry with a slug it lists.

Related

#26619 and #25723 cover tools that skip this check. The other delegate_task refusal in the audit, target.projectId naming another local project, is #30329.

Filed with Claude Code (Opus 5.5) in T3 Code.

Guria avatar Nov 06 '26 08:11 Guria

We hit this too, plus a related case: providers whose slugs carry an account or vendor prefix (e.g. openai-codex/gpt-6-luna) refuse the bare gpt-6-luna or a differently cased name with model_unavailable, so parallel fan-outs fail several times with the same target.

What we run in a fork, in OrchestratorMcpService (advertisedModel / resolveTarget):

  1. After the exact-slug and alias checks, accept a unique case-insensitive match, or (for a request with no /) a unique match on each slug's last / segment. The child runs the matched slug; two matches are refused naming both. It never substitutes a different model.
  2. model_unavailable lists up to 5 advertised slugs sharing the most name parts with the request, then points to orchestrator_capabilities with search.
  3. provider_unavailable appends up to 5 instance IDs that are orchestration-capable, healthy and enabled for the project (data orchestrator_capabilities already returns).
  4. The capabilities description no longer says "Any catalog model works"; it says to use a model id with its own providerInstanceId where canRunChildTask is true.

Happy to send this as a PR if it's useful.

yaacovcorcos avatar Nov 15 '26 01:11 yaacovcorcos