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
1 change: 1 addition & 0 deletions apps/server/src/mcp/OrchestratorMcpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2603,6 +2603,7 @@ const make = Effect.gen(function* () {
parentNodeId: parentRun.rootNodeId,
task: taskPrompt(input),
...(input.title === undefined ? {} : { title: input.title }),
...(input.group === undefined ? {} : { group: input.group }),
modelSelection: target.modelSelection,
runtimeMode,
interactionMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ describe("orchestrator MCP toolkit", () => {
providerInstanceId: codexInstanceId,
model: codexModel,
},
group: "Backend",
mode: "async",
clientRequestId: "delegate-codex-replay-1",
});
Expand Down Expand Up @@ -510,10 +511,12 @@ describe("orchestrator MCP toolkit", () => {
expect(followupTasks.every((task) => task.result === null)).toBe(true);
// Each subagent keeps the milestone that was active when it started.
const parentNow = yield* orchestrator.getThreadProjection(parentThreadId);
expect(
parentNow.subagents.find((task) => task.id === delegated.taskId)?.milestoneId,
).toBe("m1");
expect(parentNow.subagents.find((task) => task.id === delegated.taskId)).toMatchObject({
milestoneId: "m1",
group: "Backend",
});
expect(followupTasks.map((task) => task.milestoneId)).toEqual(["m2", "m2"]);
expect(followupTasks.map((task) => task.group)).toEqual(["Backend", "Backend"]);
expect(
parentNow.turnItems
.filter((item) => item.type === "milestone")
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/orchestration-v2/Orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8562,6 +8562,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
nativeTaskRef: null,
prompt: command.task,
title: command.title ?? null,
...(command.group === undefined ? {} : { group: command.group }),
model: command.modelSelection.model,
...(command.completionWake === undefined ? {} : { completionWake: command.completionWake }),
status: "running",
Expand Down Expand Up @@ -8980,6 +8981,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
nativeTaskRef: null,
prompt: command.task,
title: command.title ?? null,
...(command.group === undefined ? {} : { group: command.group }),
model: command.modelSelection.model,
...(command.completionWake === undefined ? {} : { completionWake: command.completionWake }),
status: "running",
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/orchestration-v2/RemoteDelegatedTask.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ it.layer(layerTest)("a delegated task in a linked environment", (it) => {
parentRunId: parent.runId,
parentNodeId: parent.rootNodeId,
task: "Run the suite there.",
group: "Backend",
driver: ProviderDriverKind.make("remote"),
modelSelection,
remoteChild,
Expand All @@ -218,6 +219,7 @@ it.layer(layerTest)("a delegated task in a linked environment", (it) => {
assert.equal(task?.childThreadId, null);
assert.deepEqual(task?.remoteChild, remoteChild);
assert.equal(task?.status, "running");
assert.equal(task?.group, "Backend");
const item = projection.turnItems.find((candidate) => candidate.type === "subagent");
assert.deepEqual(item?.type === "subagent" ? item.remoteChild : undefined, remoteChild);
// No thread was created here for the child.
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/peer/RemoteDelegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ const make = Effect.gen(function* () {
parentNodeId,
task,
...(input.title === undefined ? {} : { title: input.title }),
...(input.group === undefined ? {} : { group: input.group }),
// The driver runs there; this side only labels the task with it.
driver: ProviderDriverKind.make("remote"),
modelSelection: launched.modelSelection,
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/provider/agentContextBudget.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"claudeSystemAppendBytes": 5756,
"codexAdditionalContextBytes": 7486,
"mcpToolListJsonBytes": 48930
"claudeSystemAppendBytes": 5826,
"codexAdditionalContextBytes": 7556,
"mcpToolListJsonBytes": 49005
}
14 changes: 14 additions & 0 deletions apps/web/src/components/ChatView.logic.browser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,17 @@ it("refocuses the composer on window return from a clicked area after a bare key
expect(document.activeElement).toBe(conversation);
expect(shouldRefocusComposerOnWindowFocus(document.activeElement)).toBe(false);
});

it("keeps focus in a zoomed-in milestone on window return so Esc still zooms out", () => {
const panel = document.createElement("div");
panel.tabIndex = -1;
panel.dataset.milestoneZoom = "";
panel.innerHTML = "<button>Open agent</button>";
document.body.append(panel);
using _panel = { [Symbol.dispose]: () => panel.remove() };

panel.focus();
expect(shouldRefocusComposerOnWindowFocus(document.activeElement)).toBe(false);
panel.querySelector("button")!.focus();
expect(shouldRefocusComposerOnWindowFocus(document.activeElement)).toBe(false);
});
2 changes: 1 addition & 1 deletion apps/web/src/components/ChatView.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ export function shouldRefocusComposerOnWindowFocus(
}
return (
activeElement.closest(
'[data-workspace-keyboard-focus], [data-sidebar-row]:focus-visible, [role="dialog"], [role="alertdialog"], [role="application"], [role="menu"], [role="listbox"], [data-slot$="-popup"], [data-terminal-owner]',
'[data-workspace-keyboard-focus], [data-milestone-zoom], [data-sidebar-row]:focus-visible, [role="dialog"], [role="alertdialog"], [role="application"], [role="menu"], [role="listbox"], [data-slot$="-popup"], [data-terminal-owner]',
) === null
);
}
Expand Down
39 changes: 22 additions & 17 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ import {
import { useDraftHeroLayoutTransition } from "./chat/useDraftHeroLayoutTransition";
import { useLocalDispatchState } from "./chat/useLocalDispatchState";
import { ThreadMilestonesView } from "./chat/ThreadMilestonesView";
import type { CoordinatorAsk } from "./chat/MilestoneBoard";
import {
formatMilestoneCommentPrefix,
pendingAskCard,
Expand Down Expand Up @@ -2937,11 +2938,20 @@ export default function ChatView(props: ChatViewProps) {
chatReveal !== null && chatReveal.threadKey === activeThreadKey ? chatReveal : null;
const milestonesShortcutLabel = shortcutLabelForCommand(keybindings, "milestones.toggle");
const milestoneTurnItems = serverVisibleTurnItems.map(({ item }) => item);
// A secret or link card waits on you in the timeline; Milestones shows the same card.
// A secret or link card waits on you in the timeline; Milestones and the plan show it too.
const milestoneAskCard =
showMilestones && activeThreadShell?.hasPendingUserInput === true
? pendingAskCard(serverVisibleTurnItems)
: null;
activeThreadShell?.hasPendingUserInput === true ? pendingAskCard(serverVisibleTurnItems) : null;
const coordinatorAsk: CoordinatorAsk | null =
activePendingApproval !== null
? { kind: "approval" }
: milestoneAskCard !== null
? { kind: "card", item: milestoneAskCard }
: activePendingUserInput !== null || activeThreadShell?.hasPendingUserInput === true
? {
kind: "input",
question: activePendingUserInput?.questions[0]?.question ?? null,
}
: null;
// A comment goes through the composer, so it queues or steers like any message you send.
const commentOnMilestoneStable = useStableCallback((milestone: OrchestrationV2Milestone) => {
const composer = composerRef.current;
Expand Down Expand Up @@ -3738,19 +3748,7 @@ export default function ChatView(props: ChatViewProps) {
threadRef={activeThreadRef}
projection={serverProjection}
turnItems={milestoneTurnItems}
coordinatorAsk={
activePendingApproval !== null
? { kind: "approval" }
: milestoneAskCard !== null
? { kind: "card", item: milestoneAskCard }
: activePendingUserInput !== null ||
activeThreadShell?.hasPendingUserInput === true
? {
kind: "input",
question: activePendingUserInput?.questions[0]?.question ?? null,
}
: null
}
coordinatorAsk={coordinatorAsk}
bottomInset={composerReservedHeight}
onOpenThread={openSubagentStable}
onComment={canOperateThread ? commentOnMilestoneStable : null}
Expand Down Expand Up @@ -4224,6 +4222,13 @@ export default function ChatView(props: ChatViewProps) {
/>

<ThreadDetailsPanel
plan={
isServerThread &&
serverProjection !== null &&
serverProjection.milestones.length > 0
? { projection: serverProjection, coordinatorAsk }
: null
}
anchor={threadPanelPopoverAnchorRef}
handle={threadPanelPopoverHandle}
forceNewWorktree={multipleModelSelections !== null}
Expand Down
Loading