GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): subagents pick up their parent's renamed worktree branch by maria-rcks · Pull Request #20079 · pingdotgg/t3code

fix(server): subagents pick up their parent's renamed worktree branch #20079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
maria-rcks merged 5 commits into main from t3/subagent-branch-rename
Oct 16, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(server): subagents pick up their parent's renamed worktree branch #20079

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit Hold shift + click to select a range
29ebf72
fix(server): propagate worktree branch renames to subagents
maria-rcks Oct 15, 2026
215d501
fix(server): keep late and archived subagents on renamed branches
maria-rcks Oct 16, 2026
36dae30
fix(server): close shared branch rename races
maria-rcks Oct 16, 2026
5257ab5
fix(server): recheck native child branches against git
maria-rcks Oct 16, 2026
87e4f91
Merge remote-tracking branch 'origin/main' into t3/subagent-branch-re…
maria-rcks Oct 16, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

11 changes: 11 additions & 0 deletions 11 apps/server/src/orchestration-v2/Orchestrator.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2539,6 +2539,17 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
cause: `Thread ${command.threadId} worktree changed before the metadata update could be applied.`,
});
}
if (
command.type === "thread.metadata.update" &&
command.expectedBranch !== undefined &&
command.expectedBranch !== thread.branch
) {
return yield* new OrchestratorDispatchError({
commandId: command.commandId,
commandType: command.type,
cause: `Thread ${command.threadId} branch changed before the metadata update could be applied.`,
});
}
if (command.type === "thread.metadata.update" && command.expectedEmpty === true) {
const records = yield* projectionStore
.getThreadRecords(command.threadId, ["runs"])
Expand Down
88 changes: 84 additions & 4 deletions 88 apps/server/src/orchestration-v2/ThreadLaunchService.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1184,11 +1184,91 @@ it.effect("renames a temporary t3/<hash> branch off the provisioning critical pa
(yield* threads.getThreadProjection(launched.threadId)).thread.branch,
"t3/abcd1234",
);
const parent = yield* threads.getThreadProjection(launched.threadId);
const run = parent.runs[0]!;
assert.isNotNull(run.rootNodeId);
yield* threads.dispatch({
type: "delegated_task.request",
commandId: CommandId.make("command:launch:temp-branch:delegate"),
parentThreadId: launched.threadId,
parentRunId: run.id,
parentNodeId: run.rootNodeId!,
task: "Work in the parent's checkout",
modelSelection,
runtimeMode: "full-access",
interactionMode: "default",
createdBy: "agent",
creationSource: "mcp",
});
const delegated = yield* threads.getThreadProjection(launched.threadId);
const childThreadId = delegated.subagents[0]!.childThreadId!;
const child = yield* threads.getThreadProjection(childThreadId);
assert.equal(child.thread.branch, "t3/abcd1234");
assert.equal(child.thread.worktreePath, "/repo-worktrees/temp");
assert.equal(child.thread.lineage.parentThreadId, launched.threadId);

const otherThreadId = ThreadId.make("thread:launch:other-branch");
const otherPathThreadId = ThreadId.make("thread:launch:other-worktree");
for (const [threadId, branch, worktreePath] of [
[otherThreadId, "other-feature", "/repo-worktrees/temp"],
[otherPathThreadId, "t3/abcd1234", "/repo-worktrees/other"],
] as const) {
yield* threads.dispatch({
type: "thread.create",
commandId: CommandId.make(`command:create:${threadId}`),
threadId,
projectId,
title: "Unrelated thread",
modelSelection,
runtimeMode: "full-access",
interactionMode: "default",
branch,
worktreePath,
createdBy: "user",
creationSource: "web",
});
}
const unrelated = yield* threads.getThreadProjection(otherThreadId);
const otherPath = yield* threads.getThreadProjection(otherPathThreadId);
yield* Deferred.succeed(allowBranchName, undefined);
yield* waitUntil(() =>
threads
.getThreadProjection(launched.threadId)
.pipe(Effect.map((projection) => projection.thread.branch === "generated-branch")),
yield* threads.streamStoredEventsFrom({ threadId: childThreadId }).pipe(
Stream.filter(
(stored) =>
stored.event.type === "thread.metadata-updated" &&
stored.event.payload.branch === "generated-branch",
),
Stream.runHead,
);
assert.equal(
(yield* threads.getThreadProjection(launched.threadId)).thread.branch,
"generated-branch",
);
assert.equal(
(yield* threads.getThreadProjection(childThreadId)).thread.branch,
"generated-branch",
);
assert.deepEqual(
(yield* threads.getThreadProjection(otherThreadId)).thread,
unrelated.thread,
);
assert.deepEqual(
(yield* threads.getThreadProjection(otherPathThreadId)).thread,
otherPath.thread,
);
const staleUpdate = yield* threads
.dispatch({
type: "thread.metadata.update",
commandId: CommandId.make("command:launch:stale-branch-update"),
threadId: otherThreadId,
branch: "generated-branch",
expectedBranch: "t3/abcd1234",
expectedWorktreePath: "/repo-worktrees/temp",
})
.pipe(Effect.flip);
assert.equal(staleUpdate._tag, "OrchestratorDispatchError");
assert.deepEqual(
(yield* threads.getThreadProjection(otherThreadId)).thread,
unrelated.thread,
);
assert.deepEqual(harness.renameBranch.mock.calls[0]?.[0], {
cwd: "/repo-worktrees/temp",
Expand Down
49 changes: 43 additions & 6 deletions 49 apps/server/src/orchestration-v2/ThreadLaunchService.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,49 @@ const make = Effect.gen(function* () {
}),
),
Effect.flatMap((renamed) =>
threads.dispatch({
type: "thread.metadata.update",
commandId: CommandId.make(`${input.commandId}:branch-rename`),
threadId,
branch: renamed.branch,
worktreePath: worktreeCwd,
Effect.gen(function* () {
yield* threads.dispatch({
type: "thread.metadata.update",
commandId: CommandId.make(`${input.commandId}:branch-rename`),
threadId,
branch: renamed.branch,
worktreePath: worktreeCwd,
expectedBranch: oldBranch,
expectedWorktreePath: worktreeCwd,
});
// Updating the parent first makes later subagents inherit the new name.
// Re-read after each pass for children of subagents updated in that pass.
const visited = new Set([threadId]);
while (true) {
const snapshot = yield* threads.getShellSnapshot();
const sharing = snapshot.threads.filter(
(thread) =>
!visited.has(thread.id) &&
thread.worktreePath === worktreeCwd &&
thread.branch === oldBranch,
);
if (sharing.length === 0) break;
for (const thread of sharing) {
visited.add(thread.id);
yield* threads
.dispatch({
type: "thread.metadata.update",
commandId: CommandId.make(`${input.commandId}:branch-rename:${thread.id}`),
threadId: thread.id,
branch: renamed.branch,
expectedBranch: oldBranch,
expectedWorktreePath: worktreeCwd,
})
.pipe(
Effect.catchCause((cause) =>
Effect.logWarning("Shared thread worktree branch update failed", {
threadId: thread.id,
cause,
}),
),
);
}
}
}),
),
Effect.catchCause((cause) =>
Expand Down
1 change: 1 addition & 0 deletions 1 packages/contracts/src/orchestrationV2.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,7 @@ export const OrchestrationV2Command = Schema.Union([
branch: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
worktreePath: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
expectedWorktreePath: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
expectedBranch: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
/** Reject unless no message or run has landed on this thread. */
expectedEmpty: Schema.optional(Schema.Boolean),
limitRecovery: Schema.optional(Schema.NullOr(OrchestrationV2LimitRecoveryUpdate)),
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.