Repository navigation
fix(server): subagents and forks no longer copy their source's fork, guest-link and history state - #914
Merged
Conversation
… as that fork delegate_task from any forked conversation failed with "Failed to load orchestration projection". makeSubagentChildThread copies the parent thread, so the subagent inherited Scient's conversationFork. dispatchMessage then ran the fork-only consumed-transfer read (added in #882) against the subagent, which exists only as a pending event in that command, and the read failed. The same copy made fork, import, rollback, usage-limit and analytics readers treat every subagent of a fork as a fork. Claude's and Codex's native subagents share the builder. A derived thread now starts without the origin's own history: Scient's fork, import and fork-lineage state, the rollback receipt as a whole, usage-limit recovery and unsettledAt. It also resets what T3's own fork already resets (delegatedFrom, opens, activeOrderKey, lastSnoozeWakeAt), offered to T3 separately. A field table in the regression test classifies every thread field, so an upstream merge that adds one fails typecheck until it is decided. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… link ConversationForkService built the fork from a copy of the source thread and kept its guestShare. Guest links are looked up by share id (LIMIT 1), so an invite to the source could open the fork, including what was written there after the fork. The fork also kept the source's remote delegation, opens, last snooze wake and auto-settle opt-out, which T3's own fork resets. Found by Codex review of #914. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Forks made before the previous commit still carry their source's guestShare in their events, so the invite lookup (LIMIT 1) could resolve to the fork, and after the source closed its link the fork was the only match. A share made for a thread is always created after the thread, so the lookup and guest authorization now accept a share only on a thread created before it. Also keeps only T3's open #30334 line (drop delegatedFrom) inside T3's subagent builder; the opens, list-position and snooze-wake resets move into SCIENT_DERIVED_THREAD_RESETS, since T3 shows no visible effect from them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent, not timestamps The previous commit judged ownership by comparing the share's and thread's creation times. Codex showed a clock moving backwards defeats that both ways. A thread is always created without a share of its own, so a share already in its thread.created event was copied. The lookup and authorization now ask exactly that (one indexed read; thread.created events are never pruned). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yaacovcorcos
enabled auto-merge
November 14, 2026 12:52
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
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. |
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
Since beta 0.6.29-beta.20261114.1,
delegate_taskfrom any forked conversation fails with "Failed to load orchestration projection for thread thread:delegated-task:…". So do Codex reviews started from a fork.The cause:
makeSubagentChildThread(T3's builder, also used by Claude's and Codex's native subagents) copies the whole parent thread, including Scient's ownconversationFork.dispatchMessagethen runs the fork-only consumed-transfer read added in #882 against the subagent. At that point the subagent exists only as a pendingthread.createdevent in the same command, so the read fails.The copy did more than fail delegation. About 20 Scient readers treat
conversationForkas "this thread is a fork", including analytics, the read-through-fork history read, attachment budgets and handoff policy. Each of them misjudged every subagent of a fork.Traced from the installed beta's server trace and reproduced from a forked conversation.
Change
scientDerivedThread.tsdefinesSCIENT_DERIVED_THREAD_RESETS, the facts about a thread's own history that a thread derived from it must not copy:rollbackCompletedRequestIdwould make analytics count an inheritedrollbackRequestIdas pending);unsettledAt, which Scient's fork paths already reset.derived-thread-fieldsseam inmakeSubagentChildThreadspreads it after the copy.delegatedFrom, word for word as T3's open fix(server): subagent threads no longer show the remote parent their parent was delegated from pingdotgg/t3code#30334 does, so it gives way to T3's at the next alignment once #30334 lands.SCIENT_DERIVED_THREAD_RESETSalso resets what T3's own fork resets:opens,activeOrderKey,lastSnoozeWakeAt. No T3 PR for those three: they have no effect a T3 user can see, because subagents are never listed.ConversationForkService, the web Fork dialog's path) also copied the source thread and kept itsguestShare. Guest links resolve by share id (findGuestShareThreadId,LIMIT 1), so an invite to the source could open the fork, including anything written there after forking. The fork now clearsguestShare, plus what T3's own fork resets:delegatedFrom,opens,lastSnoozeWakeAt,autoSettleDisabledAt. This only affects users who turned on beta guest sharing.thread.createdevent was copied. Thecopied-guest-shareseams inProjectionStore.findGuestShareThreadIdandGuestShareService.authorizerefuse such a share, for invites and for sessions already redeemed. This replaces a timestamp rule from an intermediate commit that Codex showed a backward clock could defeat.linkOriginandbranchPullRequest.workspaceAuthorityRevisionis restamped by the store onthread.created.Verification
scient-fork/DelegatedTaskFromFork.test.ts:OrchestrationV2AppThreadfield as inherited, reset or set, typed asRecord<keyof OrchestrationV2AppThread, …>, so a new field fails typecheck until it is classified.ConversationForkService.test.tsnow gives the source a guest share and asserts the fork has none. Its negative control fails on the original builder with the source's share id.scient/guest/ownGuestShare.test.ts: an older fork created with its source's share in its creation event. The invite resolves to the source; once the source closes its link, it resolves to nothing. On main's lookup it fails, resolving to the fork.ProjectionStoreThreadNotFoundErrorat theOrchestrator.tsconsumed-transfer read).delegated_task.request: 34 files, 1,755 tests;pnpm run typecheck(0 errors),vp fmt --checkandvp linton the changed files,knip:check, seam check,git diff --check.scient-fork/plus the fork integration suites) passed except 6 cases intestkit/ProviderSwitch.integration.test.ts, which fail the same way locally on the unmodified source (token-usage expectations). That is local only and unrelated; CI ran that file green on the first head.ConversationImportStaging.test.ts(a cancelled-upload quota case). That is a known main problem since effect 4.1.3 and not touched here.vp lint --report-unused-disable-directives: 0 errors;vp fmt --checkon the changed files,knip:check, seam check,git diff --check;Documentation impact
Updated:
UPSTREAM.md: new "Subagent thread fields" and "Copied guest links" sections.docs/internals/upstream-alignment-protocol.md: when upstream narrows a shared read or copies a record carrying Scient fields.Platforms
Server orchestration logic with no platform branches, so it behaves the same on macOS, Windows and Linux. Tests ran locally on macOS only; hosted CI covers Linux. Not tested on a real Windows or Linux machine; nothing here depends on the OS.
Model: Claude Opus 5.5 in Claude Code inside Scient.
🤖 Generated with Claude Code