Repository navigation
fix(server,web,mobile): agent-launched chats keep their launcher as parent - #179
Merged
Merged
Conversation
…arent Chats an agent launched sometimes showed top-level on the Agents board: a remote delegate_task or peer-link t3_thread_launch reached the other machine with no calling thread, a chat a delegate_task helper launched pointed at a parent that is never a card, and a detached child kept its task with the launcher. - A peer-forwarded t3_thread_launch always names its caller in delegatedFrom, and the receiving side nests the chat under it. - The board lists a chat launched by a subagent under the subagent's owner, on web, desktop and mobile. - A task follows its worker's parent: it moves with a reparent and goes with a detach, and restart reconciles tasks that drifted earlier. - Naming the calling chat as parent of a chat on another machine resolves to the caller's environment instead of failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
jayleaton
marked this pull request as ready for review
October 31, 2026 07:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Chats an agent launches sometimes land top-level on the Agents board instead of inside the launching chat's card, on every machine. An audit of real data on the Mac, desktop-pc and dev-box found these causes:
delegate_taskwithoutprofileId(rows D1, V1, V2). Over a stored peer link, the other machine sees only the link session, never the calling thread, so the chat was created with no parent.t3_thread_launchsent over a peer link had the same gap.delegate_taskhelper (a subagent). Their parent is the helper, which is never a card, so the board showed them top-level.parentThreadId(S1–S5). Already rejected since fix(mcp-gateway): chat creation rejects a parentThreadId that isn't a chat #175, which merged after those rows. One related gap remained: a chat naming itself as the parent of a chat on another machine was refused, because the parent was looked up on the target environment.Explicit
parentThreadId: null(S7–S9) stays as a supported opt-out. The tool text does not suggest it, so it is unchanged.Change
PeerForwardingstamps the calling thread asdelegatedFromon every forwardedt3_thread_launch. The receivingt3_thread_launchhandler nests a link-session launch under that thread (parentThreadId+parentEnvironmentId).selectAgentSidebarThreads(packages/client-runtime, shared by the web, desktop and mobile boards) lists a chat whose parent is a subagent under that subagent's nearest non-subagent owner.ThreadTaskServicereacts tothread.metadata-updated: a reparented child's task moves to the new parent, and a detached child's task is removed (the old owner's delta reads it as a departure).ThreadTaskStoregainsremove, and its cursor also counts departures, so cursors never repeat.mcp-gatewayt3_create_thread: aparentThreadIdequal to the calling chat resolves to the caller's environment.Scope and approval
Maintainer-requested bug fix (JJ via Captain). One problem: agent-launched chats losing their parent link.
Verification
Each new assertion failed on the base commit (fix reverted, test kept) and passes with the fix:
client-runtimeagents.test.ts› nests a chat a subagent launched in the card of the subagent's ownerdoug-chat,deeper-chatwere top-level cardsserverRemoteDelegation.test.ts› a task delegated to the box… (parent assertion)parentThreadId: undefinedserverPeerForwarding.test.ts› launches in a linked environment… (parent assertion)serverThreadTaskService.test.ts› a task follows its worker's parent…expected 'captain' to equal 'stranger'mcp-gatewaytools.test.ts› parents chats a T3 chat creates on any environmentclient-runtime,mcp-gatewayandapps/server.apps/servertypecheck ran locally because the Davit box ran out of memory. The tests ran in Davit.Merge Danger
Door: two-way for the parenting changes. A task removed on detach is not restored by a revert; the worker can be reassigned with
t3_task_assign.Blast Radius: consumers. Affected:
t3_task_readfor owners whose children were moved or detached.Model and harness: Claude Opus 5.5 in Claude Code (T3 agent Doug).
🤖 Generated with Claude Code