Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/server/src/guide/topics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Linking is two-way, with a permission for each direction: "<A>'s agents can star

With a link allowed, an agent can start a thread on the other computer in that computer's copy of the project, read it and message it, and its reply comes back. A computer you only open from this app (Settings › Connections › Computers you use from here) is not a link: you see its threads here, but agents can't work across. This app's sign-in to it renews whenever they connect and ends after 90 days without one, or when that computer removes it. Fleet's All computers page and its own page then say the sign-in ended and offer to connect again with a new code; its threads stay on it.

To carry on a thread on a linked computer, for example before shutting this one down, click its title at the top of the chat or right-click it in the sidebar (or use the command palette), and pick Move to another computer. The thread goes with its messages and its code changes, including files not yet committed; staged changes arrive unstaged. It lands in a new worktree of that computer's copy of the project; the dialog offers to set the project up there when it's missing. When that computer's permission for this one is Ask first, its user allows the move there. The copy left here stays, read-only, with a link to the new one. With Claude, Codex or Pi, and the same kind of agent picked on the other computer, the agent keeps its full memory: its own session moves too (up to 50 MB) and picks up where it was. Otherwise, or if that session can't be resumed there, the agent gets a summary of the conversation; the dialog and the moved thread's timeline say which. Turns from before the move can't be undone there. A working thread can move too: Move when it's done starts the move once its turn and background work finish, and Stop and move now stops its agent first. While it waits, a notice above the message box says what for, with Cancel, and the thread takes no new messages. An agent can move its own thread with thread_move; it goes when that turn ends. To clear a computer before shutting it down, Move threads (on a computer's page in Fleet, or in the command palette) moves several at once, and quitting the desktop app while threads work offers to move them first, quitting once each has gone. When the other computer asks first, it takes each move's files right away and holds them until its user allows them (all the moves from one computer together, or one at a time), so this computer counts them as sent and can shut down; a move that isn't allowed unfreezes here the next time the two connect. What a thread had going comes along when the other computer runs a current Threadlines, and runs there by itself: a goal that was working carries on, the agent is told its check-backs and sets them again, your queued messages are sent in order, its pull requests come along with auto-fix and auto-merge off (a notice there says what was on, with Turn on), and its plans come along, the waiting one with Implement. Until you send the moved thread a message there, its agent can't use other threads, rooms or schedules, and the thread can move only back to the computer it came from. A General Chats thread moves with every file in its folder, up to 100 MB. The dialog says what comes along and what won't work there; the "Moved here" line on the other computer says what arrived and what didn't. If a move doesn't happen, the thread gets back here what the move stopped: its goal and its check-backs, and its queued messages go. A room moves with its agents: the dialog has a row per agent with the matching agent on the other computer picked (same kind and model, else that kind's default), or Leave out. An agent with no match, or left out, arrives as having left, and both ends say which; each agent that comes keeps its own memory or gets the whole conversation once. Move when it's done waits for the agents' hand-offs and replies to finish, and Stop and move now ends them as Stop does. A thread that started other threads moves with them: the dialog lists its threads here, ticked, and one you untick stays here as its own thread, as does one that can't move (the dialog says why). On the other computer the threads that came are still its threads, and its "Moved here" line names the ones that stayed. Threads its agent started on another computer stay there, and the moved thread can't reach them. Moved to the computer one of them is on, its "Moved here" line names that thread, which stays separate. Move when it's done waits for the threads it started to report back, and Stop and move now ends that wait as Stop does. A thread another thread started can move on its own (Move just this thread) or with its whole family. On its own it stays that thread's thread on the other computer, which can still send to it, read it and stop it; there, like any thread another computer's agent started, its agent never gets other threads, rooms or schedules. A thread another computer's agent started can move only back to that computer, where it is that thread's thread again. A thread with a message queued by a scheduled task, an assistant or a thread outside its family can't move yet; the dialog says what to finish first.`,
To carry on a thread on a linked computer, for example before shutting this one down, click its title at the top of the chat or right-click it in the sidebar (or use the command palette), and pick Move to another computer. The thread goes with its messages and its code changes, including files not yet committed; staged changes arrive unstaged. It lands in a new worktree of that computer's copy of the project; the dialog offers to set the project up there when it's missing. When that computer's permission for this one is Ask first, its user allows the move there. The copy left here stays, read-only, with a link to the new one. With Claude, Codex or Pi, and the same kind of agent picked on the other computer, the agent keeps its full memory: its own session moves too (up to 50 MB) and picks up where it was. Otherwise, or if that session can't be resumed there, the agent gets a summary of the conversation; the dialog and the moved thread's timeline say which. Turns from before the move can't be undone there. A working thread can move too: Move when it's done starts the move once its turn and background work finish, and Stop and move now stops its agent first. While it waits, a notice above the message box says what for, with Cancel, and the thread takes no new messages. An agent can move its own thread with thread_move; it goes when that turn ends. To clear a computer before shutting it down, Move threads (on a computer's page in Fleet, or in the command palette) moves several at once, and quitting the desktop app while threads work offers to move them first, quitting once each has gone. When the other computer asks first, it takes each move's files right away and holds them until its user allows them (all the moves from one computer together, or one at a time), so this computer counts them as sent and can shut down; a move that isn't allowed unfreezes here the next time the two connect. What a thread had going comes along when the other computer runs a current Threadlines, and runs there by itself: a goal that was working carries on, the agent is told its check-backs and sets them again, your queued messages are sent in order, its pull requests come along with auto-fix and auto-merge off (a notice there says what was on, with Turn on), and its plans come along, the waiting one with Implement. Until you send the moved thread a message there, its agent can't use other threads, rooms or schedules, and the thread can move only back to the computer it came from. If the link it came over can't confirm which computer sent it, it can't move at all until then. A General Chats thread moves with every file in its folder, up to 100 MB. The dialog says what comes along and what won't work there; the "Moved here" line on the other computer says what arrived and what didn't. If a move doesn't happen, the thread gets back here what the move stopped: its goal and its check-backs, and its queued messages go. A room moves with its agents: the dialog has a row per agent with the matching agent on the other computer picked (same kind and model, else that kind's default), or Leave out. An agent with no match, or left out, arrives as having left, and both ends say which; each agent that comes keeps its own memory or gets the whole conversation once. Move when it's done waits for the agents' hand-offs and replies to finish, and Stop and move now ends them as Stop does. A thread that started other threads moves with them: the dialog lists its threads here, ticked, and one you untick stays here as its own thread, as does one that can't move (the dialog says why). On the other computer the threads that came are still its threads, and its "Moved here" line names the ones that stayed. Threads its agent started on another computer stay there, and the moved thread can't reach them. Moved to the computer one of them is on, its "Moved here" line names that thread, which stays separate. Move when it's done waits for the threads it started to report back, and Stop and move now ends that wait as Stop does. A thread another thread started can move on its own (Move just this thread) or with its whole family. With its whole family, each thread moves with the agent the other computer suggests for it. On its own it stays that thread's thread on the other computer, which can still send to it, read it and stop it; there, like any thread another computer's agent started, its agent never gets other threads, rooms or schedules. A thread another computer's agent started can move only back to that computer, where it is that thread's thread again. A thread with a message queued by a scheduled task, an assistant or a thread outside its family can't move yet; the dialog says what to finish first.`,
},
{
id: "devices",
Expand Down
82 changes: 81 additions & 1 deletion apps/server/src/links/LinkMoves.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ import {
import { RelayDeviceRepository } from "../relay/RelayDeviceRepository.ts";
import * as GitVcsDriver from "../vcs/GitVcsDriver.ts";
import * as VcsProcess from "../vcs/VcsProcess.ts";
import { linkMoveCopyThreadId } from "../moves/linkMoveIds.ts";
import { ComputerLinkRepository } from "./ComputerLinkRepository.ts";
import { LinkMoveRepository, LinkMoveRepositoryLive } from "./LinkMoveRepository.ts";
import {
binaryPatchBytes,
Expand Down Expand Up @@ -176,6 +178,8 @@ interface CarryRecord {
readonly shell?: () => OrchestrationThreadShell | undefined;
/** The computer the link was made for, when its invite pinned it. */
readonly pinnedEnvironmentId?: string;
/** This computer's device on that computer (its own link there), when it has one. */
readonly deviceThere?: string;
/** The link's name for that computer here (its device row). */
readonly linkLabel?: string;
/** Threads already here, as their rows read. */
Expand All @@ -195,6 +199,14 @@ function testLayer(
Layer.provideMerge(LinkMoveRepositoryLive),
Layer.provideMerge(
Layer.mergeAll(
Layer.mock(ComputerLinkRepository)({
getByEnvironment: () =>
Effect.succeed(
carry.deviceThere === undefined
? Option.none()
: Option.some({ deviceId: carry.deviceThere } as never),
),
}),
Layer.mock(LinkRequests)({
authority: () =>
Effect.succeed(
Expand Down Expand Up @@ -2008,12 +2020,17 @@ describe("a thread moving across its link (Part 3f, (h))", () => {
repos: ReturnType<typeof makeRepos>,
dispatched: OrchestrationCommand[],
lineage: MoveExportInput["linkLineage"],
carry: Partial<CarryRecord> & { readonly sourceEnvironmentId?: EnvironmentId } = {},
carry: Partial<CarryRecord> & {
readonly sourceEnvironmentId?: EnvironmentId;
/** The thread it is on the computer it leaves. */
readonly sourceThreadId?: ThreadId;
} = {},
) =>
Effect.gen(function* () {
const packed = yield* pack(repos, null, undefined, {
linkLineage: lineage,
sourceEnvironmentId: carry.sourceEnvironmentId,
...(carry.sourceThreadId !== undefined ? { threadId: carry.sourceThreadId } : {}),
// What the move says it is called never names anything here.
sourceLabel: "Not Windows",
});
Expand Down Expand Up @@ -2048,6 +2065,7 @@ describe("a thread moving across its link (Part 3f, (h))", () => {
threadTitle: "Ship it",
});
assert.equal(imported.movedFrom.environmentId, WINDOWS);
assert.equal(imported.movedFrom.environmentPinned, true);
assert.isUndefined(imported.lineage);
assert.isUndefined(imported.adopt);
});
Expand All @@ -2063,6 +2081,8 @@ describe("a thread moving across its link (Part 3f, (h))", () => {
assert.equal(plain.status, "committed");
assert.isUndefined(plain.keptParent);
assert.isUndefined(importOf(first).remoteOrigin);
// Where it came from is only the move's word: its fence lets it go nowhere.
assert.isUndefined(importOf(first).movedFrom.environmentPinned);
assert.include(
importOf(first).arrival?.left ?? [],
"This computer can't confirm its link to Windows PC, so this is its own thread and 'Ship it' there can't reach it.",
Expand All @@ -2075,6 +2095,9 @@ describe("a thread moving across its link (Part 3f, (h))", () => {
assert.equal(lied.status, "committed");
assert.isUndefined(lied.keptParent);
assert.isUndefined(importOf(second).remoteOrigin);
// It came from the computer the link was made for, whatever the move says.
assert.equal(importOf(second).movedFrom.environmentId, WINDOWS);
assert.equal(importOf(second).movedFrom.environmentPinned, true);
});
});

Expand All @@ -2092,6 +2115,63 @@ describe("a thread moving across its link (Part 3f, (h))", () => {
});
});

it.live(
"comes home under its parent when its move here still waits for this computer's answer",
() => {
const LEFT = ThreadId.make("thread-left-here");
/** The parent's child here, frozen for its own move (alone) to `environmentId`. */
const leftHere = (environmentId: string, movedAway = false) => ({
threadId: LEFT,
projectId: ProjectId.make("project-b"),
deletedAt: null,
parentThreadId: PARENT_HERE,
attachedToParent: 1,
pendingMove: null,
move: {
transferId: "transfer-left",
target: { environmentId, label: "Windows PC" },
...(movedAway
? { movedAway: { threadId: "thread-a", movedAt: "2026-11-17T10:00:00.000Z" } }
: {}),
},
});
const back = { home: { parentThreadId: PARENT_HERE, fromThreadId: LEFT } };
// This computer's device on Windows PC, which named the copy that move made there.
const DEVICE_THERE = "device-mac-on-windows";
const copy = linkMoveCopyThreadId(DEVICE_THERE, "transfer-left");
const completes = {
parentThreadId: PARENT_HERE,
completesMoveOf: { threadId: LEFT, deviceId: DEVICE_THERE },
};
const cases = [
{ left: leftHere(WINDOWS), source: copy, adopt: completes },
// Another thread there, naming the child here: never under the parent.
{ left: leftHere(WINDOWS), source: ThreadId.make("thread-a"), adopt: undefined },
// No link of this computer's own there to name the copy by.
{ left: leftHere(WINDOWS), source: copy, deviceThere: null, adopt: undefined },
// Moving to another computer, or already heard to have landed: its own thread.
{ left: leftHere("environment-mac"), source: copy, adopt: undefined },
{ left: leftHere(WINDOWS, true), source: copy, adopt: undefined },
];
return Effect.forEach(cases, ({ left, source, adopt, ...rest }) => {
const repos = makeRepos();
const dispatched: OrchestrationCommand[] = [];
return moved(repos, dispatched, back, {
pinnedEnvironmentId: WINDOWS,
sourceThreadId: source,
...("deviceThere" in rest ? {} : { deviceThere: DEVICE_THERE }),
// The parent holds nothing there yet: this computer hasn't heard.
threadsHere: [parentHere(WINDOWS, "thread-other"), left],
}).pipe(
Effect.map((state) => {
assert.equal(state.status, "committed");
assert.deepEqual(importOf(dispatched).adopt, adopt);
}),
);
});
},
);

it.live("a home claim this computer's records don't back lands as its own thread", () => {
const cases = [
// The parent here never held that thread.
Expand Down
Loading
Loading