Skip to content

Commit e5cae71

Browse files
authored
fix(ui): replace startup hourglasses with capacity-aware rings (#133470)
* fix(ui): replace startup hourglasses with capacity-aware rings Show one activity ring from accepted startup through execution. Pause only for exact command-lane or Swarm capacity waits, resume on admission, and preserve terminal and hidden-run ownership. Fixes #133464. * test: align capacity fixture with placement admission contract * test: use current chat registration cleanup contract * test: expect active startup in agent RPC session events * fix(agents): project command startup at its lifecycle owner Declare visible embedded and ACP command activity independently of chat RPC registration. Preserve internal-run suppression and capacity-only metadata semantics. Add producer-to-Gateway coverage for startup, capacity waiting, admission, and cleanup; addresses the registry-only projection review finding. * docs: replace obsolete sidebar hourglass guidance
1 parent b7ebff6 commit e5cae71

43 files changed

Lines changed: 869 additions & 180 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/web/control-ui.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ and [Linux](/platforms/linux) desktop apps, the
263263

264264
## Sidebar navigation
265265

266-
The sidebar organizes everything around the agent. The identity row at the top is the active agent; below it, the **Pages** section starts with **Home** — the agent's rolling main session, badged with its unread or running state — followed by the pinned destinations (**Automations** and **Plugins** by default). The customize control on the Pages header opens a menu with every other destination, including **Usage** and plugin-provided tabs, plus **Edit pinned items**; right-clicking the navigation area opens the pin editor directly. The session list below splits into zones: **Other** for the agent's ungrouped chat sessions (the main session stays behind Home; sessions it spawned appear here as top-level threads, and named threads show without a type prefix), **Groups** for group and room conversations, and **Coding** for sessions bound to a managed worktree or exec node (rows show a `repo ⎇ branch` line plus the node host), ACP-backed harness sessions, and the Codex/Claude CLI catalogs. The **Other** heading is omitted when it is the only section. Coding starts collapsed on first run and remembers your choice; its collapsed header keeps the true count and shows a running indicator while contained sessions work. Custom groups (the session `category`) and **Pinned** rows sit above Other, and assigning a session to a custom group always wins over the automatic zone classification. The global **Sessions** toolbar holds the filter and sort control (Created, Last updated, or Owners when the loaded session roster contains multiple owners), **Group by** — **Custom groups** (the default zone layout above), **Project** to bucket sessions by their repo or workspace checkout (sessions without one keep their zones), **Person** to bucket by owner when the loaded roster has several, or **None** for a single flat list with no zone headers — a persisted **Status** filter for Active, Archived, or All, and the **+** that opens the New session page. The Owners sort mode orders owner groups by name and keeps Created order within each group. On multi-user gateways the same menu adds an **Owners** filter: **All owners**, one specific person or agent, or **Involving me** — sessions you own plus sessions you have prompted, evaluated by the Gateway against the full participant history (see [Multi-user mode](/concepts/multi-user#finding-sessions-by-owner)). Archived rows stay inline, dimmed with an archive glyph; they do not contribute unread or attention state and stay outside lineage promotion. Opening a session moves the selection highlight without reordering rows. Parent sessions with recent child runs show a disclosure and child count; expand it to inspect nested child sessions, live or terminal status, and runtime without leaving the sidebar. Selecting a child opens its chat and automatically reveals its ancestor path. Child rows stay outside root grouping, pinning, dragging, multi-select, and pagination; collapsed zones do not consume the visible page budget. Sessions with new activity since they were last read show an unread dot, and opening one marks it read. Admitted work that has not started shows **Queued** with an hourglass until execution starts. This state does not by itself mean every concurrency slot is occupied. A session holding composer text you typed but never sent shows a pencil badge until the draft is sent or cleared; the active session hides it because its composer is already in view. An agent can also publish a short expiring status line and optionally request attention with a curated amber icon; that declaration clears when you open the session, send the next message, clear it explicitly, or its TTL expires. Cloud-worker lifecycle states use a globe badge; local and reclaimed sessions omit a placement badge because local execution is the default. Each root session row has a context menu (kebab button or right-click) with Pin/Unpin, Mark as unread/read, Rename, Assign to me and Assign to… on multi-user gateways ([session ownership](/concepts/multi-user#assigning-an-owner)), Set icon, Fork, Copy session ID, Move to group (including New group and Remove from group), Archive or Unarchive, and Delete; touch layouts keep the direct pin and menu controls visible. The chat header composes the same single-session management actions with its pane-specific **Panels**, **Layout**, **View**, and **Continue in terminal** actions. Cmd/Ctrl-click opens a session in a new browser tab. Alt/Option-click toggles root rows into a multi-select and Shift-click extends it across the visible order; opening the menu on a selected row then offers batch actions (Mark N as unread/read, Move N to group, Archive N, Delete N) that apply to every selected session, with a single confirmation for batch delete. Drag a root session onto **Pinned** to pin it, or onto a custom group to move it. Custom group headers can be collapsed, expanded, or dragged to reorder them; group names, order, and New Session defaults live in the gateway (`sessions.groups.*`), so they follow you across browsers, while collapsed state stays in the browser profile. Each custom group header has a **+** that opens the normal New Session page and assigns the created session to that group. **New session defaults** in the group menu sets its working directory and Local or Worktree preference; the page prefills those values but leaves them editable. Leaving the directory empty uses the selected agent's workspace. The menu also has Rename group, New group, and Delete group; renaming or deleting a group updates every member session server-side, including archived ones, and deleting a group keeps its sessions and moves them back to Other.
266+
The sidebar organizes everything around the agent. The identity row at the top is the active agent; below it, the **Pages** section starts with **Home** — the agent's rolling main session, badged with its unread or running state — followed by the pinned destinations (**Automations** and **Plugins** by default). The customize control on the Pages header opens a menu with every other destination, including **Usage** and plugin-provided tabs, plus **Edit pinned items**; right-clicking the navigation area opens the pin editor directly. The session list below splits into zones: **Other** for the agent's ungrouped chat sessions (the main session stays behind Home; sessions it spawned appear here as top-level threads, and named threads show without a type prefix), **Groups** for group and room conversations, and **Coding** for sessions bound to a managed worktree or exec node (rows show a `repo ⎇ branch` line plus the node host), ACP-backed harness sessions, and the Codex/Claude CLI catalogs. The **Other** heading is omitted when it is the only section. Coding starts collapsed on first run and remembers your choice; its collapsed header keeps the true count and shows a running indicator while contained sessions work. Custom groups (the session `category`) and **Pinned** rows sit above Other, and assigning a session to a custom group always wins over the automatic zone classification. The global **Sessions** toolbar holds the filter and sort control (Created, Last updated, or Owners when the loaded session roster contains multiple owners), **Group by** — **Custom groups** (the default zone layout above), **Project** to bucket sessions by their repo or workspace checkout (sessions without one keep their zones), **Person** to bucket by owner when the loaded roster has several, or **None** for a single flat list with no zone headers — a persisted **Status** filter for Active, Archived, or All, and the **+** that opens the New session page. The Owners sort mode orders owner groups by name and keeps Created order within each group. On multi-user gateways the same menu adds an **Owners** filter: **All owners**, one specific person or agent, or **Involving me** — sessions you own plus sessions you have prompted, evaluated by the Gateway against the full participant history (see [Multi-user mode](/concepts/multi-user#finding-sessions-by-owner)). Archived rows stay inline, dimmed with an archive glyph; they do not contribute unread or attention state and stay outside lineage promotion. Opening a session moves the selection highlight without reordering rows. Parent sessions with recent child runs show a disclosure and child count; expand it to inspect nested child sessions, live or terminal status, and runtime without leaving the sidebar. Selecting a child opens its chat and automatically reveals its ancestor path. Child rows stay outside root grouping, pinning, dragging, multi-select, and pagination; collapsed zones do not consume the visible page budget. Sessions with new activity since they were last read show an unread dot, and opening one marks it read. Accepted work immediately shows an activity ring. It spins during startup and execution, pauses with **Queued** only during a scheduler-confirmed concurrency-slot wait, and resumes when a slot is granted. With reduced motion enabled, the ring stays still. A session holding composer text you typed but never sent shows a pencil badge until the draft is sent or cleared; the active session hides it because its composer is already in view. An agent can also publish a short expiring status line and optionally request attention with a curated amber icon; that declaration clears when you open the session, send the next message, clear it explicitly, or its TTL expires. Cloud-worker lifecycle states use a globe badge; local and reclaimed sessions omit a placement badge because local execution is the default. Each root session row has a context menu (kebab button or right-click) with Pin/Unpin, Mark as unread/read, Rename, Assign to me and Assign to… on multi-user gateways ([session ownership](/concepts/multi-user#assigning-an-owner)), Set icon, Fork, Copy session ID, Move to group (including New group and Remove from group), Archive or Unarchive, and Delete; touch layouts keep the direct pin and menu controls visible. The chat header composes the same single-session management actions with its pane-specific **Panels**, **Layout**, **View**, and **Continue in terminal** actions. Cmd/Ctrl-click opens a session in a new browser tab. Alt/Option-click toggles root rows into a multi-select and Shift-click extends it across the visible order; opening the menu on a selected row then offers batch actions (Mark N as unread/read, Move N to group, Archive N, Delete N) that apply to every selected session, with a single confirmation for batch delete. Drag a root session onto **Pinned** to pin it, or onto a custom group to move it. Custom group headers can be collapsed, expanded, or dragged to reorder them; group names, order, and New Session defaults live in the gateway (`sessions.groups.*`), so they follow you across browsers, while collapsed state stays in the browser profile. Each custom group header has a **+** that opens the normal New Session page and assigns the created session to that group. **New session defaults** in the group menu sets its working directory and Local or Worktree preference; the page prefills those values but leaves them editable. Leaving the directory empty uses the selected agent's workspace. The menu also has Rename group, New group, and Delete group; renaming or deleting a group updates every member session server-side, including archived ones, and deleting a group keeps its sessions and moves them back to Other.
267267

268268
Session previews are hidden by default for compact, single-line rows. Enable **Show message preview** in the **Sessions** filter menu to restore routine status text and message previews. The browser remembers your choice. Errors and requests for attention remain visible with previews off.
269269

‎src/agents/agent-command.live-model-switch.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,6 +1978,10 @@ describe("agentCommand – LiveSessionModelSwitchError retry", () => {
19781978
sessionKey: "agent:main:main",
19791979
});
19801980

1981+
expect(state.registerAgentRunContextMock).toHaveBeenCalledWith(
1982+
"session-1",
1983+
expect.objectContaining({ projectSessionActive: true }),
1984+
);
19811985
const deliveryParams = requireRecord(
19821986
mockCallArg(state.deliverAgentCommandResultMock),
19831987
"ACP delivery params",
@@ -5319,6 +5323,7 @@ describe("agentCommand – LiveSessionModelSwitchError retry", () => {
53195323
sessionKey: "agent:main:main",
53205324
sessionId: "session-1",
53215325
isControlUiVisible: false,
5326+
projectSessionActive: false,
53225327
}),
53235328
);
53245329
});

‎src/agents/command/acp-execution.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export async function runAcpAgentCommand(params: {
7272
sessionId: params.sessionId,
7373
agentId: params.sessionAgentId,
7474
lifecycleGeneration: params.lifecycleGeneration,
75+
projectSessionActive: !params.suppressVisibleSessionEffects,
7576
...(params.suppressVisibleSessionEffects ? { isControlUiVisible: false } : {}),
7677
});
7778
attemptExecutionRuntime.emitAcpLifecycleStart({
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { expect, it, vi } from "vitest";
2+
import { resolveVisibleActiveSessionRunState } from "../../gateway/server-methods/session-active-runs.js";
3+
import { registerAgentRunCapacityWait } from "../../infra/agent-run-capacity-wait.js";
4+
import {
5+
clearAgentRunContext,
6+
getAgentRunLifecycleGeneration,
7+
} from "../../infra/agent-run-registry.js";
8+
import { prepareEmbeddedSessionState } from "./session-preparation.js";
9+
10+
vi.mock("../embedded-agent-runner/runs.js", () => ({
11+
resolveEmbeddedAgentRunProgressState: () => undefined,
12+
}));
13+
vi.mock("../subagents/registry/subagent-registry-read.js", () => ({
14+
getLatestLiveSubagentRunByChildSessionKey: () => undefined,
15+
isSubagentRunQueued: () => false,
16+
}));
17+
vi.mock("../../sessions/session-state-events.js", () => ({
18+
recordSessionHumanDirectMessage: vi.fn(),
19+
}));
20+
vi.mock("../../skills/discovery/agent-filter.js", () => ({
21+
resolveEffectiveAgentSkillFilter: () => undefined,
22+
}));
23+
vi.mock("./attempt-execution.shared.js", () => ({ persistAgentSession: vi.fn() }));
24+
vi.mock("./run-context.js", () => ({ resolveAgentRunContext: () => ({}) }));
25+
vi.mock("./runtime-loaders.js", () => ({
26+
loadSkillsRuntime: async () => ({
27+
getRemoteSkillEligibility: () => ({}),
28+
resolveReusableWorkspaceSkillSnapshot: () => ({ snapshot: undefined, shouldRefresh: false }),
29+
}),
30+
loadExecDefaultsRuntime: async () => ({
31+
resolveNodeExecEligibility: () => ({ canExec: false }),
32+
}),
33+
}));
34+
35+
it.each([false, true])(
36+
"projects command startup and capacity waits without a chat controller (internal=%s)",
37+
async (internal) => {
38+
const runId = "command-activity";
39+
const sessionKey = "agent:main:command-activity";
40+
const sessionId = "command-activity-session";
41+
const lifecycleGeneration = getAgentRunLifecycleGeneration();
42+
const state = () =>
43+
resolveVisibleActiveSessionRunState({
44+
context: {},
45+
requestedKey: sessionKey,
46+
canonicalKey: sessionKey,
47+
sessionId,
48+
agentId: "main",
49+
});
50+
let releaseWait: (() => void) | undefined;
51+
try {
52+
await prepareEmbeddedSessionState({
53+
cfg: {},
54+
opts: { message: "hello" },
55+
sessionKey,
56+
sessionId,
57+
storePath: "/unused/command.sqlite",
58+
sessionAgentId: "main",
59+
lifecycleGeneration,
60+
runId,
61+
workspaceDir: "/workspace",
62+
executionSkillsDir: "/workspace/skills",
63+
watchSkills: false,
64+
isNewSession: false,
65+
isSubagentLaneTurn: false,
66+
suppressVisibleSessionEffects: internal,
67+
sessionStateActor: { actorType: "human" },
68+
});
69+
const active = internal ? { active: false, runIds: [] } : { active: true };
70+
expect(state()).toEqual(active);
71+
releaseWait = registerAgentRunCapacityWait(runId, lifecycleGeneration);
72+
expect(state()).toEqual(internal ? active : { active: true, status: "queued" });
73+
releaseWait?.();
74+
expect(state()).toEqual(active);
75+
} finally {
76+
releaseWait?.();
77+
clearAgentRunContext(runId);
78+
}
79+
expect(state()).toEqual({ active: false, runIds: [] });
80+
},
81+
);

‎src/agents/command/session-preparation.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export async function prepareEmbeddedSessionState(params: {
5050
lifecycleGeneration: params.lifecycleGeneration,
5151
verboseLevel: resolvedVerboseLevel,
5252
isControlUiVisible: !params.suppressVisibleSessionEffects,
53+
// Node and local command ingress may not have a separate chat activity owner.
54+
projectSessionActive: !params.suppressVisibleSessionEffects,
5355
});
5456
}
5557

0 commit comments

Comments
 (0)