Skip to content

feat(platform): pin task-agent models to their serving provider - #2959

Merged
larryro merged 5 commits into
mainfrom
feat/task-agent-model-provider
Aug 11, 2026
Merged

larryro merged 5 commits into
mainfrom
feat/task-agent-model-provider

Conversation

@larryro

@larryro larryro commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Problem

The Edit-agent Model field was a flat, unsearchable list of bare model ids. With two credentials configured (e.g. Anthropic subscription broker + OpenRouter env key) there was no way to tell which provider serves an entry, let alone choose one:

  • the tab deduped the listing by model id, deliberately dropping the provider dimension;
  • projectAgents.model stored a bare string — no provider anywhere;
  • resolveServingTarget walked connectors alphabetically over default direct credentials with fuzzy id matching, so picking OpenRouter's anthropic/claude-x could silently serve (and bill) via the Anthropic connector, and vice versa;
  • deeper: subscription-broker credentials were run-dead for task agents — the delivery side (harness yml subscription: injection, exec-builder override, broker redemption) all existed, but nothing produced serving: {kind:'subscription'}. "Select the Anthropic provider" was impossible regardless of UI.

What ships

Provider-visible, provider-pinned selection

  • The dialog's Model picker is a searchable list with one option per (provider, model) pair, the serving provider named under every entry; the pick stores the pair (projectAgents.modelProvider, snapshotted onto the run row like model).
  • Resolution honors the pin fail-closed: resolveServingTarget(..., {pinnedProvider}) resolves only that connector and fails the run with the reason instead of silently routing another provider. Unpinned rows keep the legacy walk byte-for-byte; automation nodes unchanged.
  • Agent rows read Claude Code · Anthropic · claude-sonnet-5 · 6 equipped.

Subscription serving lane for task agents

  • convex/tasks/task_serving.ts splits the lanes: a pinned provider whose default credential is subscription-flavored serves the turn on the redeemed vendor token, gated by resolveExecution (forced-harness match + byo policy) and the harness's yml subscription delivery.
  • mintTurnServing (shared by fresh start + steer restart): gateway lane mints the session VK exactly as before; the subscription lane mints no VK — the capability bridge rides a random session token (llmGatewayKeyId optional), and the exec composes the managed env shell (bridge token, model-pin slots) with the vendor auth pair overriding ANTHROPIC_AUTH_TOKEN/ANTHROPIC_BASE_URL.
  • Subscription-served models are offered only while the Agent type is the harness the subscription drives.
  • Broker failures surface their typed CREDENTIAL_BROKER_* messages as the run error; no gateway metering on the subscription lane (vendor flat-rate).

Docs

  • platform/projects/project-agents.md rewritten for the real Agents tab (en/de/fr authored natively) — it still documented the retired "Agents & models" curation feature — plus the sibling claims that surface invalidated (projects overview tab strip + card, concepts crew paragraph, the "both label the field Harness" sentences; the project dialog says Agent type / Agent-Laufzeit).
  • project-agents-models.webp still shows the retired UI; the manifest entry already captures the current tab, so bun run docs:screenshots -- --only project-agents-models against the seeded capture stack refreshes it (not run here — the hermetic stack needs :3000, held by the live dev stack).

Verification

  • bun run check green (incl. ~20 new tests: pin arms in llm_call.test.ts, lane split + refusals in task_serving.test.ts, managed+subscription exec composition in external_turn_bridge_exec.test.ts, mutation normalization); migrations:check classes the new optional fields as data-safe (no migration); docs suite 194/194.
  • Live on a dev org with both credentials: the picker shows anthropic/claude-sonnet-5 — OpenRouter and claude-sonnet-5 — Anthropic · Subscription side by side; a task run on the subscription pick did real multi-turn PDF work on the brokered token, harvested a deliverable, and settled to In review (no-VK release path included). Rendered docs pages eyeballed on the docs dev server.

The agent dialog's model picker now lists one option per (provider,
model) pair - searchable, with the serving provider named under every
entry - and stores the pair on the agent. Run resolution honors the pin
fail-closed: a pinned provider that cannot serve fails the run with the
reason instead of silently routing (and billing) another provider.
Unpinned rows keep the legacy first-match walk unchanged.

A pinned provider whose default credential is a vendor subscription
(anthropic subscription-broker forcing claude-code today) now serves the
turn on the redeemed subscription token: no virtual key is minted, the
capability bridge rides a random session token, and the harness yml's
subscription delivery overrides the auth pair over the managed env
shell. Subscription-served models are offered only for their forced
harness in the dialog.
The page still documented the retired Agents & models curation tab
(Recommended/Restricted). Rewrite it around what ships: named per-project
agents with an Agent type (harness), a model pinned to its serving
provider (subscription entries offered only for their forced harness),
equipment, and standing instructions - plus the task loop that runs them.

Sweep the sibling claims the same surface invalidated: the projects
overview tab strip and card, the concepts crew paragraph, and the field-
label sentences in agents/concepts and agents/harnesses (the dialog says
"Agent type" / "Agent-Laufzeit"; only the automation node says
"Harness"). EN, DE, and FR authored natively; frontmatter manifest
regenerated via build-search-index.

The project-agents-models.webp still shows the retired UI - the manifest
entry already captures the current Agents tab, so a docs:screenshots run
against the seeded stack refreshes it (not run here: the hermetic capture
stack needs :3000, which the live dev stack holds).
Build the model option without a per-iteration spread, and narrow the
default-credential row field by field instead of asserting to the
narrower shape - a drifted row now degrades to the no-active-credential
error instead of an unsound read.
@larryro
larryro force-pushed the feat/task-agent-model-provider branch from 97e2e88 to cbc6b32 Compare August 10, 2026 23:42
@larryro
larryro merged commit dd96f0c into main Aug 11, 2026
68 of 69 checks passed
@larryro
larryro deleted the feat/task-agent-model-provider branch August 11, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant