GeezerVison is showing github.com — fix(server): a first message into a linked thread prepares its worktr… · pingdotgg/t3code@a8ae922
File treeExpand file treeCollapse file tree Open diff view settings apps/server/src/orchestration-v2
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/ThreadLaunchService.test.ts +36Lines changed: 36 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3087,6 +3087,42 @@ it.live( | 3087 | 3087 | ); | 3088 | 3088 | assert.isFalse(yield* fileSystem.exists(ran)); | 3089 | 3089 |
| | 3090 | + // A first message sent into an empty thread the link started names no link; the | | 3091 | + // thread's own link still decides. | | 3092 | + const emptyThreadId = ThreadId.make("thread:limited-empty"); | | 3093 | + yield* threads.dispatch({ | | 3094 | + type: "thread.create", | | 3095 | + commandId: CommandId.make("launch:limited-empty:create"), | | 3096 | + threadId: emptyThreadId, | | 3097 | + projectId, | | 3098 | + title: "Linked", | | 3099 | + modelSelection, | | 3100 | + runtimeMode: "full-access", | | 3101 | + interactionMode: "default", | | 3102 | + branch: null, | | 3103 | + worktreePath: null, | | 3104 | + createdBy: "agent", | | 3105 | + creationSource: "mcp", | | 3106 | + linkOrigin: { | | 3107 | + sessionId: "mcp-session:linked", | | 3108 | + label: "Linked laptop", | | 3109 | + access: "auto-accept-edits", | | 3110 | + }, | | 3111 | + }); | | 3112 | + yield* launches.launch({ | | 3113 | + ...launchInput({ | | 3114 | + command: "launch:limited-empty", | | 3115 | + thread: emptyThreadId, | | 3116 | + message: "Start", | | 3117 | + workspace: { type: "worktree", baseRef: "main", branch: "feature/limited-empty" }, | | 3118 | + }), | | 3119 | + reuseExistingThread: true, | | 3120 | + }); | | 3121 | + const reused = yield* preparationSettled(emptyThreadId); | | 3122 | + assert.equal(reused.runs[0]?.status, "failed"); | | 3123 | + assert.isNull(reused.thread.worktreePath); | | 3124 | + assert.isFalse(yield* fileSystem.exists(ran)); | | 3125 | + | 3090 | 3126 | const full = yield* launch("full", "full-access"); | 3091 | 3127 | assert.equal(full.runs[0]?.status, "starting"); | 3092 | 3128 | assert.equal(yield* fileSystem.readFileString(ran), "create\n"); | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/ThreadLaunchService.ts +10-1Lines changed: 10 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1611,8 +1611,17 @@ const make = Effect.gen(function* () { | 1611 | 1611 | branch: workspaceStrategy.branch, | 1612 | 1612 | } | 1613 | 1613 | : workspaceStrategy; | | 1614 | + // The thread's link decides, as it does when preparation is retried: a request | | 1615 | + // that reuses a thread names none. | | 1616 | + const { linkOrigin: _requestLinkOrigin, ...preparation } = input; | 1614 | 1617 | yield* schedulePreparation( | 1615 | | - { ...input, workspaceStrategy: preparationStrategy }, | | 1618 | + { | | 1619 | + ...preparation, | | 1620 | + workspaceStrategy: preparationStrategy, | | 1621 | + ...(committedThread.linkOrigin === undefined | | 1622 | + ? {} | | 1623 | + : { linkOrigin: committedThread.linkOrigin }), | | 1624 | + }, | 1616 | 1625 | threadId, | 1617 | 1626 | runId, | 1618 | 1627 | ); | |
Collapse file Copy file name to clipboardExpand all lines: docs/internals/05_remote.md +3-2Lines changed: 3 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -33,8 +33,9 @@ side lists and revokes it in Sharing & access like any other session, and owns i | 33 | 33 | shared access rules ([`mcp/linkOrigin.ts`](../../apps/server/src/mcp/linkOrigin.ts)). Below full | 34 | 34 | access, linked work can mutate only threads with the same origin, cannot touch projects, settings, | 35 | 35 | scheduled tasks, or further links, and skips project setup scripts and worktree layout commands | 36 | | - (a project that declares a layout gives such a thread no worktree). Full-access links are not | 37 | | - fenced because their agents already run as the receiving OS user. | | 36 | + (in a project that declares a layout, a worktree launch or handoff for such a thread fails; | | 37 | + restoring a missing folder brings back plain checkouts). Full-access links are not fenced because | | 38 | + their agents already run as the receiving OS user. | 38 | 39 | - **Namespace idempotency keys.** All callers on the linking side share one session on the receiving | 39 | 40 | side, so idempotency keys must be hashed with the caller's namespace before forwarding. | 40 | 41 | - **Clients read linked threads as standard thread streams.** | |
|