Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/server/src/mcp/OrchestratorMcpService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,7 @@ describe("OrchestratorMcpService provider resolution", () => {
);
assert.isTrue(entry!.canRunCrossProviderChildTask);
assert.deepEqual(entry!.constraints, []);
assert.isUndefined(entry!.poolMemberInstanceIds);
}

assert.isUndefined(byId.get(disabledAntigravityInstanceId));
Expand Down Expand Up @@ -2419,13 +2420,18 @@ describe("OrchestratorMcpService provider resolution", () => {
capabilities.providers.map((provider) => provider.providerInstanceId),
[poolInstanceId],
);
assert.deepInclude(capabilities.providers[0], {
poolMemberInstanceIds: [codexInstanceId, workInstanceId],
});
const result = yield* service.delegateTask(scope, {
task: "Summarize the diff.",
target: { driverKind: codex },
mode: "async",
clientRequestId: "delegate-pool-driver-1",
});
assert.equal(result.status, "running");
assert.equal(result.providerInstanceId, workInstanceId);
assert.equal(result.model, "gpt-5.4");
const request = (yield* Ref.get(dispatched))[0] as {
modelSelection: { instanceId: string; model: string };
};
Expand Down
3 changes: 3 additions & 0 deletions apps/server/src/mcp/OrchestratorMcpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2382,6 +2382,9 @@ const make = Effect.gen(function* () {
});
return {
providerInstanceId: provider.instanceId,
...(provider.pool?.role === "pool"
? { poolMemberInstanceIds: provider.pool.memberInstanceIds }
: {}),
driverKind: provider.driver,
displayName: provider.displayName ?? null,
models: listed.map((model) => {
Expand Down
2 changes: 2 additions & 0 deletions evals/mcp-tool-use/cases/provider-pools.ndjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"id":"pool-member-provider-mismatch","area":"orchestration","kind":"bad","pattern":"pool route compared literally with selected account","experience":"An agent reported pool_claudeAgent versus claudeAgent as an unconfirmed provider mismatch despite matching model and effort.","source":{"report":"Maintainer report, 2026-11-05"},"privacy":"commit-safe","setup":{"role":"top","priorTurns":[{"role":"user","text":"Run the requested review with pool_claudeAgent, Claude Sonnet 5.5, high effort. Report any provider, model, or option mismatch."},{"role":"assistant","toolCalls":[{"tool":"orchestrator_capabilities","input":{},"result":{"providers":[{"providerInstanceId":"pool_claudeAgent","driverKind":"claudeAgent","displayName":"Claude pool","models":[{"id":"claude-sonnet-5-5","options":[{"id":"effort","values":["high"]}]}],"poolMemberInstanceIds":["claudeAgent","claudeAgent_work"]}]}}]},{"role":"assistant","toolCalls":[{"tool":"delegate_task","input":{"task":"Review the diff. Do not edit files.","role":"review","mode":"wait","target":{"providerInstanceId":"pool_claudeAgent","model":"claude-sonnet-5-5","options":{"effort":"high"}}},"result":{"taskId":"task-pool-review","childThreadId":"44444444-4444-4444-8444-444444444444","childRunId":"run-pool-review","status":"completed","workState":"result_available","providerInstanceId":"claudeAgent","model":"claude-sonnet-5-5","options":[{"id":"effort","value":"high"}],"summary":"No findings.","hasPendingQuestion":false,"pendingApproval":null}}]}]},"prompt":"Is the provider result a real mismatch? Use the tool evidence above to give a short, definite answer. Do not launch more work.","expect":{"notCalls":["delegate_task","t3_thread_send","task_status","task_cancel"],"finalTextMust":["(?i:(expected|confirmed|valid|correct|matches|no (?:provider )?mismatch|not a (?:provider )?mismatch))","(?i:(pool|member|account))"],"textMustNot":["(?i:(unconfirmed|haven.t confirmed|cannot confirm|can.t confirm|unable to confirm|assuming|presum(?:e|ing)|appears|likely|probably))"]},"maxSteps":4}
{"id":"pool-unrelated-provider-mismatch","area":"orchestration","kind":"guard","pattern":"pool route compared literally with selected account","experience":"An agent reported pool_claudeAgent versus claudeAgent as an unconfirmed provider mismatch despite matching model and effort.","source":{"report":"Maintainer report, 2026-11-05"},"privacy":"commit-safe","setup":{"role":"top","priorTurns":[{"role":"user","text":"Run the requested review with pool_claudeAgent, Claude Sonnet 5.5, high effort. Report any provider, model, or option mismatch."},{"role":"assistant","toolCalls":[{"tool":"orchestrator_capabilities","input":{},"result":{"providers":[{"providerInstanceId":"pool_claudeAgent","driverKind":"claudeAgent","displayName":"Claude pool","models":[{"id":"claude-sonnet-5-5","options":[{"id":"effort","values":["high"]}]}],"poolMemberInstanceIds":["claudeAgent","claudeAgent_work"]}]}}]},{"role":"assistant","toolCalls":[{"tool":"delegate_task","input":{"task":"Review the diff. Do not edit files.","role":"review","mode":"wait","target":{"providerInstanceId":"pool_claudeAgent","model":"claude-sonnet-5-5","options":{"effort":"high"}}},"result":{"taskId":"task-pool-review","childThreadId":"44444444-4444-4444-8444-444444444444","childRunId":"run-pool-review","status":"completed","workState":"result_available","providerInstanceId":"claudeAgent_other","model":"claude-sonnet-5-5","options":[{"id":"effort","value":"high"}],"summary":"No findings.","hasPendingQuestion":false,"pendingApproval":null}}]}]},"prompt":"Is the provider result a real mismatch? Use the tool evidence above to give a short, definite answer. Do not launch more work.","expect":{"notCalls":["delegate_task","t3_thread_send","task_status","task_cancel"],"finalTextMust":["(?i:(mismatch|not (?:a |in (?:the )?)?(?:pool )?member|outside|not listed))","claudeAgent_other"],"textMustNot":["(?i:(no (?:provider )?mismatch|not a (?:provider )?mismatch|expected (?:pool )?routing|confirmed (?:pool )?routing))"]},"maxSteps":4}
14 changes: 12 additions & 2 deletions packages/contracts/src/orchestratorMcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export type OrchestratorMcpTargetOptions = typeof OrchestratorMcpTargetOptions.T
export const OrchestratorMcpTarget = Schema.Struct({
providerInstanceId: Schema.optional(
ProviderInstanceId.annotate({
description: "Provider instance id from `orchestrator_capabilities`.",
description:
"Provider instance id from `orchestrator_capabilities`. Account pools route to a concrete member; results report that member's id. Verify it against the pool's poolMemberInstanceIds, and check model and options separately.",
}),
),
driverKind: Schema.optional(
Expand Down Expand Up @@ -214,7 +215,10 @@ export const OrchestratorMcpDelegateTaskResult = Schema.Struct({
latestTerminalStatus: Schema.NullOr(OrchestratorMcpTerminalDelegatedTaskStatus),
latestTerminalSummary: Schema.NullOr(Schema.String),
latestTerminalResultContextTransferId: Schema.NullOr(ContextTransferId),
providerInstanceId: ProviderInstanceId,
providerInstanceId: ProviderInstanceId.annotate({
description:
"Concrete provider account used by the task. For a pool target, this is a member id from orchestrator_capabilities, not the pool id.",
}),
model: Schema.NullOr(Schema.String),
options: Schema.optional(Schema.Array(ProviderOptionSelection)),
summary: Schema.NullOr(Schema.String),
Expand Down Expand Up @@ -595,6 +599,12 @@ export type OrchestratorMcpModelOption = typeof OrchestratorMcpModelOption.Type;

export const OrchestratorMcpProviderCapability = Schema.Struct({
providerInstanceId: ProviderInstanceId,
poolMemberInstanceIds: Schema.optional(
Schema.Array(ProviderInstanceId).annotate({
description:
"Present for account pools. Configured member ids, including temporarily unavailable accounts. Delegation reports the selected concrete member as providerInstanceId; a listed member is expected pool routing. Model and options must still match.",
}),
),
driverKind: ProviderDriverKind,
displayName: Schema.NullOr(Schema.String),
models: Schema.Array(
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/testing/providerEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const KEPT_ENV = new Set([
"T3CODE_TRANSFER_BUDGET_RESULT_PATH",
// Opt-in: points the HtmlRender tests at a headless browser, which they skip without.
"T3CODE_TEST_HEADLESS_SHELL",
// The mobile test script sets this; tests must see the platform their code was compiled for.
"T3_MOBILE_TEST_PLATFORM",
]);

if (process.env.T3CODE_TEST_KEEP_PROVIDER_ENV !== "1") {
Expand Down
Loading