Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
eea048e
feat: a project can have a lead chat
badcuban Nov 16, 2026
c5a9917
fix(web): drop the lead chat's keybinding command
badcuban Nov 16, 2026
fd22ec8
feat: the lead chat passes work to threads, and the card starts some …
badcuban Nov 16, 2026
2dd3060
feat(web): a Threads panel groups a project's threads by what needs you
badcuban Nov 16, 2026
cb3fe3a
fix(web): the Threads tab opens on a phone too, and its badge keeps i…
badcuban Nov 16, 2026
1337ea0
fix: passed work keeps the lead's access when handed on, and known pu…
badcuban Nov 17, 2026
fd1a2df
Merge remote-tracking branch 'origin/main' into feat/lead-chat-2-pass
badcuban Nov 17, 2026
009a921
Merge branch 'feat/lead-chat-2-pass' into feat/lead-chat-3-panel-stacked
badcuban Nov 17, 2026
c30e6b8
fix: a lead chat's pass is checked against its ceiling again right be…
badcuban Nov 17, 2026
5fc5d1f
Merge branch 'feat/lead-chat-2-pass' into feat/lead-chat-3-panel-stacked
badcuban Nov 17, 2026
fdb3039
fix: a lead chat's pass that never ran is marked not sent and stays o…
badcuban Nov 17, 2026
8502866
fix: a pass stopped while prepared, or moved to another computer, sta…
badcuban Nov 17, 2026
4ff5e65
Merge branch 'feat/lead-chat-2-pass' into feat/lead-chat-3-panel-stacked
badcuban Nov 17, 2026
facda57
Merge remote-tracking branch 'origin/main' into feat/lead-chat-2-pass
badcuban Nov 17, 2026
0f5007d
fix: an agent's message still queued when its thread moves arrives as…
badcuban Nov 17, 2026
48194cf
Merge branch 'feat/lead-chat-2-pass' into feat/lead-chat-3-panel-stacked
badcuban Nov 17, 2026
f64279e
fix: history handed to an agent never calls another agent's message t…
badcuban Nov 17, 2026
f526932
Merge remote-tracking branch 'origin/main' into feat/lead-chat-2-pass
badcuban Nov 17, 2026
e12c1a4
Merge branch 'feat/lead-chat-2-pass' into feat/lead-chat-3-panel-stacked
badcuban Nov 17, 2026
5fb5471
Merge main into feat/lead-chat-3-panel-stacked
badcuban Nov 17, 2026
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
14 changes: 13 additions & 1 deletion apps/server/src/guide/topics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,17 @@ A project's lead chat is a thread set up to coordinate the project; see the lead
{
id: "lead-chat",
title: "Lead chat",
keywords: ["lead chat", "lead", "coordinator", "project lead", "orchestrator", "drop work"],
keywords: [
"lead chat",
"lead",
"coordinator",
"project lead",
"orchestrator",
"drop work",
"threads panel",
"project threads",
"board",
],
body: `Each project can have one lead chat: a thread you drop work into (a bug, a stack trace, a list of tasks). Its agent answers small questions itself and starts threads for new work. Those threads show under the lead in the sidebar and report back to it, and it tells you what finished and what needs you.

Any thread can be the lead. Use "Make this the lead chat" in a thread's menu (right-click its row, or click the title above the chat), or the command palette. The project's menu in the project picker has Open lead chat, or New lead chat, which starts a thread in the project folder and makes it the lead. "Go to lead chat" in the command palette opens it.
Expand All @@ -120,6 +130,8 @@ Only one thread leads a project; making another the lead replaces it. "Stop usin

The lead's row sits at the top of the sidebar with a flag, says Lead where the project name goes, and never wraps up on its own. The chat shows a Lead chat label beside the title.

The Threads tab in the right sidebar shows the project's threads on every computer you can see, grouped as Needs you, Ready for review, Working, Landing, Idle and Done. Open it from the sidebar's list of panels or its + menu, on any thread of the project; it opens by itself the first time a thread becomes the lead on this device. A thread you wrapped up goes under Done (for 7 days, closed until you open it) unless its pull request is still open, which keeps it under Ready for review or Landing. Ready for review says what the pull request waits on, as the Pull requests page does. Click a row to open the thread, or right-click it for the thread's menu. The top line counts what needs you and what's working, with a Lead chat link when you're on another thread.

The lead's agent is told its role at the start of every turn. It may start 10 threads and send 20 messages to them per message you send, instead of 5 and 10. It needs {place:threads.agentThreads} to be on, and an agent that can't use the thread tools says so. General chats, a thread another thread still owns, and threads from another computer or an outside agent can't be the lead.`,
},
{
Expand Down
98 changes: 98 additions & 0 deletions apps/web/src/components/ChatView.panels.browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ import {
waitForLayout,
waitForElement,
waitForServerConfigToApply,
addThreadToSnapshot,
markThreadDoneInTest,
setSidebarThreadWork,
mountChatView,
openProjectMenu,
registerChatViewSuiteHooks,
Expand Down Expand Up @@ -207,6 +210,101 @@ describe("ChatView (full app): right panel and header actions", () => {
tile.click();
}

it("groups the project's threads in the Threads tab and opens one from its row", async () => {
const approvalId = "thread-board-approval" as ThreadId;
const workingId = "thread-board-working" as ThreadId;
const wrappedId = "thread-board-wrapped" as ThreadId;
const titles: Record<string, string> = {
[approvalId]: "Needs an approval",
[workingId]: "Busy fixing",
[wrappedId]: "Finished last night",
};
const base = createSnapshotForTargetUser({
targetMessageId: "msg-user-board" as MessageId,
targetText: "board",
});
const snapshot = [approvalId, workingId, wrappedId].reduce(
(current, threadId) => addThreadToSnapshot(current, threadId),
base,
);
const mounted = await mountChatView({
viewport: WIDE_FOOTER_VIEWPORT,
snapshot: {
...snapshot,
threads: snapshot.threads.map((thread) =>
titles[thread.id] ? { ...thread, title: titles[thread.id]! } : thread,
),
},
});

try {
setSidebarThreadWork(LOCAL_ENVIRONMENT_ID, approvalId, "needs-you");
setSidebarThreadWork(LOCAL_ENVIRONMENT_ID, workingId, "working");
markThreadDoneInTest(`${LOCAL_ENVIRONMENT_ID}:${wrappedId}`, NOW_ISO);

const railToggle = await waitForElement(
() =>
document.querySelector('button[aria-label="Toggle panel"]') as HTMLButtonElement | null,
"Unable to find the rail toggle.",
);
railToggle.click();
await openRightPanelSurfaceFromLauncher("threads");

const rowsIn = (group: string) =>
[
...document.querySelectorAll(
`[data-project-board-group='${group}'] [data-testid^='project-board-row-']`,
),
].map((row) => row.getAttribute("data-testid")!.replace("project-board-row-", ""));
await vi.waitFor(
() => {
expect(mounted.router.state.location.search).toMatchObject({ threads: "1" });
expect(
[...document.querySelectorAll("[data-project-board-group]")].map((group) =>
group.getAttribute("data-project-board-group"),
),
).toEqual(["needsYou", "working", "idle", "done"]);
expect(rowsIn("needsYou")).toEqual([approvalId]);
expect(rowsIn("working")).toEqual([workingId]);
expect(rowsIn("idle")).toEqual([THREAD_ID]);
// Done starts closed, like the sidebar's Wrapped shelf.
expect(rowsIn("done")).toEqual([]);
expect(document.querySelector("[data-testid='project-board-counts']")?.textContent).toBe(
"1 needs you · 1 working",
);
},
{ timeout: 8_000, interval: 16 },
);

(document.querySelector("[data-testid='project-board-toggle-done']") as HTMLElement).click();
await vi.waitFor(() => expect(rowsIn("done")).toEqual([wrappedId]), {
timeout: 8_000,
interval: 16,
});

(
document.querySelector(`[data-testid='project-board-row-${approvalId}']`) as HTMLElement
).click();
await vi.waitFor(
() => {
expect(mounted.router.state.location.pathname).toBe(
`/${LOCAL_ENVIRONMENT_ID}/${approvalId}`,
);
// The board comes along, so the next row is one click away.
expect(mounted.router.state.location.search).toMatchObject({ threads: "1" });
expect(
document
.querySelector(`[data-testid='project-board-row-${approvalId}']`)
?.getAttribute("data-active"),
).toBe("true");
},
{ timeout: 8_000, interval: 16 },
);
} finally {
await mounted.cleanup();
}
});

it("builds a tab strip from the launcher and switches between its tabs", async () => {
const mounted = await mountChatView({
viewport: WIDE_FOOTER_VIEWPORT,
Expand Down
49 changes: 49 additions & 0 deletions apps/web/src/components/ChatView.sidebar.browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,55 @@ describe("ChatView (full app): sidebar", () => {
}
});

it("opens the Threads tab the first time a thread becomes the lead on this device, as the sheet on a narrow window", async () => {
const capabilities = { repositoryIdentity: true, projectLead: true };
const mounted = await mountChatView({
// Below the inline panel's breakpoint, so the panel is the sheet.
viewport: DEFAULT_VIEWPORT,
snapshot: createSnapshotForTargetUser({
targetMessageId: "msg-user-first-lead" as MessageId,
targetText: "first lead",
}),
configureFixture: (nextFixture) => {
nextFixture.serverConfig = {
...nextFixture.serverConfig,
environment: { ...nextFixture.serverConfig.environment, capabilities },
};
nextFixture.welcome = {
...nextFixture.welcome,
environment: { ...nextFixture.welcome.environment, capabilities },
};
},
});

try {
const row = await waitForElement(
() => document.querySelector<HTMLElement>(`[data-testid="thread-row-${THREAD_ID}"]`),
"The thread's sidebar row should be on screen.",
);
const rect = row.getBoundingClientRect();
row.dispatchEvent(
new MouseEvent("contextmenu", {
bubbles: true,
cancelable: true,
clientX: rect.left + 20,
clientY: rect.top + 8,
}),
);
await page.getByRole("button", { name: "Make this the lead chat", exact: true }).click();

await vi.waitFor(
() => {
expect(mounted.router.state.location.search).toMatchObject({ threads: "1" });
expect(document.querySelector("[data-project-board='true']")).not.toBeNull();
},
{ timeout: 8_000, interval: 16 },
);
} finally {
await mounted.cleanup();
}
});

it("narrows the live list to rooms from the View button and marks it while it does", async () => {
const mounted = await mountChatView({
viewport: DEFAULT_VIEWPORT,
Expand Down
44 changes: 2 additions & 42 deletions apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { useComposerDraftStore, type DraftId } from "../composerDraftStore";
import { preserveRightPanelSearchParamsForDraftNavigation } from "../diffRouteSearch";
import { useHandleNewThread } from "../hooks/useHandleNewThread";
import { type InboxEntry, useInboxThreads } from "../hooks/useInboxThreads";
import { useOpenThreadPullRequest } from "../hooks/useOpenThreadPullRequest";
import { useThreadMenu } from "../hooks/useThreadMenu";
import { useTouchHoldMenu } from "../hooks/useTouchHoldMenu";
import { useIsMobile } from "../hooks/useMediaQuery";
Expand Down Expand Up @@ -1619,48 +1620,7 @@ export default function Sidebar() {
],
);

/**
* The pull request badge. A plain click opens the thread's Pull request tab,
* which is where the app can actually show it; a modifier or the middle
* button is the browser's "open it somewhere else" gesture, and the host is
* that somewhere else.
*/
const openPrLink = useCallback(
(
event: React.MouseEvent<HTMLElement>,
pullRequest: Pick<ThreadPullRequest, "number" | "url">,
threadRef: ScopedThreadRef,
) => {
event.preventDefault();
event.stopPropagation();

if (!(event.metaKey || event.ctrlKey || event.button === 1)) {
closeSheet();
void navigate({
to: "/$environmentId/$threadId",
params: buildThreadRouteParams(threadRef),
search: { pullRequest: "1", pullRequestNumber: pullRequest.number },
});
return;
}

const api = readLocalApi();
if (!api) {
toastManager.add({ type: "error", title: "Can't open links here" });
return;
}

void api.shell.openExternal(pullRequest.url).catch((error) => {
toastManager.add(
failureNotice({
title: "Couldn't open the pull request",
error,
}),
);
});
},
[closeSheet, navigate],
);
const openPrLink = useOpenThreadPullRequest(closeSheet);

const attemptArchiveThread = useCallback(
async (threadRef: ScopedThreadRef) => {
Expand Down
Loading
Loading