fix(mcp): honour configured fallback for implicit tasks #28222
Closedryoppippi(GitHub profile, opens in a new tab)wants to merge 6 commits into
main fromrefs/pull/28222/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/mcp/OrchestratorMcpService.ts line 2367OutdatedResolvedby ryoppippi(GitHub profile, opens in a new tab)@@ -2266,5 +2348,20 @@22662348 });22672349 const isRetryOfAcceptedDelegation = yield* threadManagement.hasReceipt(commandId);2350+ const acceptedTaskId = derive.delegatedTaskNode({ commandId });2351+ const acceptedTask = isRetryOfAcceptedDelegation2352+ ? (yield* loadTaskParent(scope.thread.threadId, acceptedTaskId)).subagents.find(2353+ (task) => task.id === acceptedTaskId,2354+ )2355+ : undefined;2356+ const committedThread = acceptedTask?.childThreadId2357+ ? yield* threadManagement2358+ .getThreadShell(acceptedTask.childThreadId)2359+ .pipe(Effect.mapError(threadManagementFailure))2360+ : null;22682361 const target = yield* resolveTargetRechecking({22692362 parent,2270- target: input.target,2363+ target:2364+ committedThread === null2365+ ? input.target2366+ : {2367+ providerInstanceId:
- apps/server/src/mcp/OrchestratorMcpService.test.ts line 2339Resolvedby ryoppippi(GitHub profile, opens in a new tab)@@ -2182,3 +2184,4 @@21822184 }),21832185 );218421862187+ it.effect("uses a valid fallback only for implicit delegated targets", () =>apps/server/src/mcp/OrchestratorMcpService.ts lines 2367 to 2370OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -2268,3 +2351,20 @@2351+ const acceptedTask = isRetryOfAcceptedDelegation2352+ ? (yield* loadTaskParent(scope.thread.threadId, acceptedTaskId)).subagents.find(2353+ (task) => task.id === acceptedTaskId,2354+ )2355+ : undefined;2356+ const committedThread = acceptedTask?.childThreadId2357+ ? yield* threadManagement2358+ .getThreadShell(acceptedTask.childThreadId)2359+ .pipe(Effect.mapError(threadManagementFailure))2360+ : null;22682361 const target = yield* resolveTargetRechecking({22692362 parent,2270- target: input.target,2363+ target:2364+ committedThread === null2365+ ? input.target2366+ : {2367+ providerInstanceId:2368+ acceptedTask?.providerInstanceId ?? committedThread.modelSelection.instanceId,2369+ model: acceptedTask?.model ?? committedThread.modelSelection.model,2370+ options: committedThread.modelSelection.options ?? [],@@ -34,3 +34,4 @@3434 {"id": "two-children-same-model", "area": "orchestration", "kind": "bad", "pattern": "named-model rule read as a cap", "experience": "Asked for two Sol xhigh subagents, an Astra parent started one and refused the second, citing 'One child per named model' (#24967).", "rule": "Before delegate_task ... One child per named model. (intended: every named model gets a child; read as a cap of one child per model)", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"orchestrator_capabilities": {"parentThreadId": "33333333-3333-4333-8333-333333333333", "inheritedProviderInstanceId": "claudeAgent", "inheritedModel": "claude-sonnet-5-5", "inheritedOptions": [{"id": "effort", "value": "high"}], "runtimeMode": "full-access", "interactionMode": "default", "features": {"appOwnedSubagents": true, "asyncPolling": true, "cancellation": true, "batchThreadCreation": true, "threadManagement": true, "incrementalThreadRead": true, "scheduledTasks": true}, "providers": [{"providerInstanceId": "clau3535 {"id": "worker-counts-per-model", "area": "orchestration", "kind": "bad", "pattern": "named-model rule read as a cap", "experience": "Asked for 20 Sol workers and 20 Luna workers, the agent started one worker per model (#25359).", "rule": "Before delegate_task ... One child per named model. (intended: every named model gets a child; read as a cap of one child per model)", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"orchestrator_capabilities": {"parentThreadId": "33333333-3333-4333-8333-333333333333", "inheritedProviderInstanceId": "claudeAgent", "inheritedModel": "claude-sonnet-5-5", "inheritedOptions": [{"id": "effort", "value": "high"}], "runtimeMode": "full-access", "interactionMode": "default", "features": {"appOwnedSubagents": true, "asyncPolling": true, "cancellation": true, "batchThreadCreation": true, "threadManagement": true, "incrementalThreadRead": true, "scheduledTasks": true}, "providers": [{"providerInstanceId": "claudeAgent", "driverKind": "claudeAgent"3636 {"id": "linked-thread-chip-reads-there", "area": "orchestration", "kind": "guard", "pattern": "thread chip from a linked machine read on this one", "experience": "A thread chip from a linked machine names its environmentId; an agent that reads it without passing that id reads this machine, where the thread does not exist.", "rule": "The thread chip names its environmentId; t3_thread_read takes it.", "privacy": "commit-safe", "setup": {"role": "top", "linkedEnvironments": true, "mocks": {"t3_environment_links": {"environmentId": "environment-laptop", "links": [{"environmentId": "environment-vps", "label": "Hetzner VPS", "status": "reachable", "access": "auto-accept-edits", "expiresAt": "2026-12-01T00:00:00.000Z", "lastError": null}], "notListed": "Not listed: not linked yet. Call t3_environment_link with a hint from the user's words."}, "t3_thread_read": {"thread": {"threadId": "thread-deploy-api", "title": "Deploy the API", "status": "idle"}, "items": [{"position": 1, "createdBy": "use37+{"id":"delegate-task-uses-configured-fallback-implicitly","area":"orchestration","kind":"guard","pattern":"implicit delegation relies on configured fallback","source":{"url":"https://github.com/pingdotgg/t3code/issues/28203","origin":"Problem statement: an exhausted inherited model should use the configured fallback for an implicit child target."},"experience":"An agent inherits an exhausted provider model and must let T3 use the configured fallback for its child.","rule":"Omit provider, driver and model when delegating implicitly; T3 applies the configured fallback when it is available.","privacy":"commit-safe","setup":{"role":"top","mocks":{"orchestrator_capabilities":{"parentThreadId":"33333333-3333-4333-8333-333333333333","inheritedProviderInstanceId":"codex","inheritedModel":"gpt-6.1-sol","inheritedOptions":[{"id":"reasoningEffort","value":"high"}],"fallbackModelSelection":{"providerInstanceId":"claudeAgent","model":"claude-opus-5-5"},"fallbackAppliesToInherited":true,"runtimeMode
- apps/server/src/mcp/OrchestratorMcpService.ts lines 2465 to 2479Resolvedby ryoppippi(GitHub profile, opens in a new tab)@@ -2268,3 +2362,20 @@2362+ acceptedTask?.modelSelection ??2363+ (acceptedTask && committedChild2364+ ? delegatedTaskRun(2365+ {2366+ ...committedChild,2367+ runs: committedChild.runs.toSorted((a, b) => a.ordinal - b.ordinal),2368+ },2369+ acceptedTask,2370+ )?.modelSelection2371+ : undefined);22682372 const target = yield* resolveTargetRechecking({22692373 parent,2270- target: input.target,2374+ target:2375+ committedSelection === undefined2376+ ? input.target2377+ : {2378+ providerInstanceId: committedSelection.instanceId,2379+ model: committedSelection.model,2380+ options: committedSelection.options ?? [],2381+ },
- @@ -1,4 +1,4 @@11 {22 "claudeSystemAppendBytes": 5129,33 "codexAdditionalContextBytes": 6859,4- "mcpToolListJsonBytes": 461094+ "mcpToolListJsonBytes": 46268
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed