Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): background subagents keep T3 tools after the parent turn ends #19751

Mergedmaria-rcksmerged 7 commits intomain fromrefs/pull/19751/headmerged by maria-rcks View on GitHub

Showing 10 changed files with 157 additions and 4 deletions (loading 7).

x
0 of 10 viewed, 10 left
43 additions and 0 deletionsapps/server/src/mcp/McpToolAccess.test.tsModified
View file
@@ -23,6 +23,17 @@
const planThreadId = ThreadId.make("thread:plan");
const fullAccessThreadId = ThreadId.make("thread:full-access");
const endedThreadId = ThreadId.make("thread:ended");
+const backgroundThreadId = ThreadId.make("thread:background");
+const oldProviderThreadId = ThreadId.make("thread:old-provider-background");
+const archivedThreadId = ThreadId.make("thread:archived-background");
+const unknownOwnerThreadId = ThreadId.make("thread:unknown-background-owner");
+​
+const backgroundShell = (threadId: ThreadId, providerInstanceId: ProviderInstanceId) => ({
+ ...liveThreadShell(threadId, { activeRunId: null }),
+ pendingBackgroundTasks: [
+ { taskId: "task:background", kind: "subagent" as const, providerInstanceId },
+ ],
+});
​
const shells = new Map([
[supervisedThreadId, liveThreadShell(supervisedThreadId, { runtimeMode: "approval-required" })],
@@ -32,6 +43,22 @@
],
[fullAccessThreadId, liveThreadShell(fullAccessThreadId)],
[endedThreadId, liveThreadShell(endedThreadId, { activeRunId: null })],
+ [backgroundThreadId, backgroundShell(backgroundThreadId, ProviderInstanceId.make("codex"))],
+ [oldProviderThreadId, backgroundShell(oldProviderThreadId, ProviderInstanceId.make("claude"))],
+ [
+ archivedThreadId,
+ {
+ ...backgroundShell(archivedThreadId, ProviderInstanceId.make("codex")),
+ archivedAt: liveThreadShell(archivedThreadId).updatedAt,