Skip to content

Commit d3c0444

Browse files
committed
fix(ui): dock the chat background-tasks rail to the bottom of narrow panes
The tasks rail (from #104010) only rendered as a right-docked 230-280px column and vanished with its toggles below a 1120px viewport, so narrow split-view panes got a crushed thread and compact windows lost access to background tasks entirely — the same bug class #104033 fixed for the workspace rail and detail panel. The rail now follows the pane's measured width: it presents as a full-width bottom strip (sections side by side like the workspace rail's bottom dock) when the pane is too narrow for a side column, and the workspace rail keeps first claim on the side slot when only one column fits. Side-docked rails, not bottom strips, now count against the width available to the chat + detail split. Closes #104091
1 parent bb26753 commit d3c0444

8 files changed

Lines changed: 147 additions & 65 deletions

File tree

‎docs/web/control-ui.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ The terminal is also available as a full-screen, terminal-only document at `/?vi
297297
- When a session's checkout sits on a non-default branch of a GitHub repository, the chat view pins pull request chips above the composer: PR number, repo, branch, diff counts, a CI pill, and draft/merged/closed state, each linking to the PR. The row shows at most two chips — live (open/draft) PRs first — and a "Show more" button reveals collapsed merged/closed history. The CI pill opens a small CI monitoring popover with passed/failed/running/skipped check counts and a link to the PR's checks page. Detection runs server-side through `controlUi.sessionPullRequests`, which reuses the Gateway's `GH_TOKEN`/`GITHUB_TOKEN` when set. When the GitHub API rate limit is hit, chips keep the last known status and show a warning that the status may be out of date; dismissing a chip hides it for that session in the current browser profile.
298298
- The session workspace rail in each Chat pane lists session files, project files, and artifacts. It docks to the pane's right edge by default; drag its header (or use the dock button) to move it to the bottom, and the choice is stored in the current browser profile. A collapsed rail takes no space at all: reopen it with ⇧⌘B, the files toggle in the split-pane header, or the floating files button in single-pane chat (both carry a changed-file count badge). The separate file, tool, and Canvas detail panel is unaffected.
299299
- The background tasks rail in each Chat pane lists the current agent's background tasks and subagents (`tasks.list` scoped by agent, kept live by `task` events): running work with a stop control, a collapsible finished section, and a View transcript link that opens the task's child session in the pane. Open it with the activity toggle in the split-pane header or the floating activity button in single-pane chat (both carry a running-count badge once loaded). The Tasks page remains the full cross-agent ledger.
300-
- The workspace rail and detail panel adapt to each pane's own width rather than the window: in a narrow pane or compact window the workspace rail always presents as a bottom strip (side-dock controls hide until the pane widens), and the detail panel stacks below the thread with a horizontal resize handle instead of sharing the row with it. Phone-sized viewports still open the detail panel full-screen.
300+
- The workspace rail, background tasks rail, and detail panel adapt to each pane's own width rather than the window: in a narrow pane or compact window both rails present as bottom strips (side-dock controls hide until the pane widens; the workspace rail keeps first claim on the side slot when only one column fits), and the detail panel stacks below the thread with a horizontal resize handle instead of sharing the row with it. Phone-sized viewports still open the detail panel full-screen.
301301
- The chat header model and thinking pickers patch the active session immediately through `sessions.patch`; they are persistent session overrides, not one-turn-only send options.
302302
- **Split view:** open it from the bottom-right page action, then split the active pane right or down for as many panes as fit. Each pane has its own session, transcript, composer, and tool stream.
303303
- Drag a session from the sidebar into chat to open it in a pane. An animated drop preview glides between zones and labels the outcome — "Split" over the exact half a new pane will occupy, "Open here" over a whole pane — and drops also work from single-pane mode.

‎ui/src/pages/chat/chat-pane.ts‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ import {
8282
renderBackgroundTasksToggle,
8383
type BackgroundTasksProps,
8484
} from "./components/chat-background-tasks.ts";
85-
import { configureToolTitleFetcher } from "./tool-titles.ts";
8685
import { renderChatControls } from "./components/chat-controls.ts";
8786
import {
8887
chatPullRequestId,
@@ -115,6 +114,7 @@ import {
115114
} from "./run-lifecycle.ts";
116115
import { scheduleChatScroll } from "./scroll.ts";
117116
import { clearChatMessagesFromCache } from "./session-message-cache.ts";
117+
import { configureToolTitleFetcher } from "./tool-titles.ts";
118118

119119
type ChatPageContext = ApplicationContext;
120120
type PaneSessionChangeOptions = { replace?: boolean };
@@ -1234,18 +1234,24 @@ class ChatPane extends OpenClawLightDomElement {
12341234
const sessionWorkspace = createSessionWorkspaceProps(state, {
12351235
narrowLayout: this.paneWidth < WORKSPACE_RAIL_SIDE_MIN_PANE_WIDTH,
12361236
});
1237+
const railSideDocked =
1238+
!sessionWorkspace.collapsed &&
1239+
!sessionWorkspace.narrowLayout &&
1240+
sessionWorkspace.dock !== "bottom";
1241+
// The workspace rail claims the side slot first; the tasks rail needs
1242+
// room for both columns before it may side-dock next to it.
12371243
const backgroundTasks = createBackgroundTasksProps(state, {
1244+
narrowLayout:
1245+
this.paneWidth <
1246+
WORKSPACE_RAIL_SIDE_MIN_PANE_WIDTH + (railSideDocked ? WORKSPACE_RAIL_MAX_WIDTH : 0),
12381247
onOpenSession: (sessionKey) => {
12391248
this.onPaneSessionChange?.(this.paneId, sessionKey);
12401249
},
12411250
});
1242-
const railSideDocked =
1243-
!sessionWorkspace.collapsed &&
1244-
!sessionWorkspace.narrowLayout &&
1245-
sessionWorkspace.dock !== "bottom";
1246-
// Every open side rail (workspace and/or background tasks) narrows the
1247-
// room left for the chat + detail split.
1248-
const sideRailCount = (railSideDocked ? 1 : 0) + (backgroundTasks.collapsed ? 0 : 1);
1251+
const tasksSideDocked = !backgroundTasks.collapsed && !backgroundTasks.narrowLayout;
1252+
// Every side-docked rail narrows the room left for the chat + detail
1253+
// split; bottom strips do not.
1254+
const sideRailCount = (railSideDocked ? 1 : 0) + (tasksSideDocked ? 1 : 0);
12491255
const detailSplitWidth = this.paneWidth - sideRailCount * WORKSPACE_RAIL_MAX_WIDTH;
12501256
const props: ChatProps = {
12511257
paneId: this.paneId,

‎ui/src/pages/chat/chat-responsive.browser.test.ts‎

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,17 +1408,23 @@ describeBrowserLayout.concurrent("chat responsive browser layout", () => {
14081408
}
14091409
});
14101410

1411-
it("releases the hidden tasks-rail grid track on narrow viewports", async () => {
1412-
const page = await openBrowserPage(1000, 700);
1411+
it("docks the tasks rail as a full-width bottom strip in a narrow pane", async () => {
1412+
const page = await openBrowserPage(1200, 700);
14131413
try {
1414-
// Below 1120px the background-tasks rail is display:none; its tasks-open
1415-
// grid templates must collapse so no empty column strip stays reserved.
1414+
// chat-pane sets --tasks-dock-bottom instead of --tasks-open when the
1415+
// pane is too narrow for a side column; the strip spans the pane and
1416+
// sits below the thread, composing with a bottom-docked workspace rail.
14161417
await page.setContent(
14171418
`<!doctype html><html><head><style>${readUiCss()}</style></head><body>
1418-
<div style="width: 980px; height: 600px; display: flex;">
1419-
<div class="chat-workbench chat-workbench--tasks-open">
1420-
<aside class="chat-workspace-rail">workspace</aside>
1421-
<aside class="chat-tasks-rail">tasks</aside>
1419+
<div style="width: 640px; height: 640px; display: flex;">
1420+
<div class="chat-workbench chat-workbench--dock-bottom chat-workbench--tasks-dock-bottom">
1421+
<aside class="chat-workspace-rail">workspace strip</aside>
1422+
<aside class="chat-tasks-rail">
1423+
<div class="chat-tasks-rail__scroll">
1424+
<section class="chat-tasks-rail__section">Running</section>
1425+
<section class="chat-tasks-rail__section">Finished</section>
1426+
</div>
1427+
</aside>
14221428
<div class="chat-workbench__main">thread</div>
14231429
</div>
14241430
</div>
@@ -1429,25 +1435,37 @@ describeBrowserLayout.concurrent("chat responsive browser layout", () => {
14291435
const rectFor = (selector: string) => {
14301436
const node = document.querySelector<HTMLElement>(selector);
14311437
const rect = node?.getBoundingClientRect();
1432-
return rect ? { left: rect.left, right: rect.right, width: rect.width } : null;
1438+
return rect
1439+
? {
1440+
left: rect.left,
1441+
right: rect.right,
1442+
top: rect.top,
1443+
bottom: rect.bottom,
1444+
width: rect.width,
1445+
height: rect.height,
1446+
}
1447+
: null;
14331448
};
14341449
return {
14351450
workbench: rectFor(".chat-workbench"),
1436-
rail: rectFor(".chat-workspace-rail"),
1437-
tasksVisible:
1438-
getComputedStyle(document.querySelector<HTMLElement>(".chat-tasks-rail")!).display !==
1439-
"none",
1451+
main: rectFor(".chat-workbench__main"),
1452+
workspace: rectFor(".chat-workspace-rail"),
1453+
tasks: rectFor(".chat-tasks-rail"),
14401454
};
14411455
});
14421456

1443-
expect(layout.tasksVisible).toBe(false);
1444-
expect(layout.workbench).not.toBeNull();
1445-
expect(layout.rail).not.toBeNull();
1446-
// The workspace rail sits flush at the workbench edge — no empty strip
1447-
// reserved for the hidden tasks rail.
1448-
expect(
1449-
Math.abs((layout.rail?.right ?? 0) - (layout.workbench?.right ?? 0)),
1450-
).toBeLessThanOrEqual(1);
1457+
const workbench = layout.workbench;
1458+
const tasks = layout.tasks;
1459+
const workspace = layout.workspace;
1460+
expect(workbench).not.toBeNull();
1461+
expect(tasks).not.toBeNull();
1462+
expect(workspace).not.toBeNull();
1463+
// Full pane width, below both the thread and the workspace strip.
1464+
expect(Math.abs((tasks?.width ?? 0) - (workbench?.width ?? 0))).toBeLessThanOrEqual(1);
1465+
expect(tasks?.top ?? 0).toBeGreaterThanOrEqual((workspace?.bottom ?? 0) - 1);
1466+
expect(tasks?.top ?? 0).toBeGreaterThanOrEqual((layout.main?.bottom ?? 0) - 1);
1467+
expect(tasks?.height ?? 0).toBeGreaterThanOrEqual(160);
1468+
expect(tasks?.height ?? 0).toBeLessThanOrEqual(237);
14511469
} finally {
14521470
await closeBrowserPage(page);
14531471
}

‎ui/src/pages/chat/chat-view.test.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,37 @@ describe("chat composer workbench", () => {
13691369
expect(container.querySelector(".chat-workspace-rail__grip")).toBeNull();
13701370
});
13711371

1372+
it("moves the background-tasks rail to a bottom strip on narrow panes", () => {
1373+
const backgroundTasks = {
1374+
agentId: "main",
1375+
collapsed: false,
1376+
narrowLayout: false,
1377+
connected: true,
1378+
canCancel: false,
1379+
loading: false,
1380+
error: null,
1381+
tasks: [],
1382+
cancellingTaskIds: new Set<string>(),
1383+
finishedCollapsed: false,
1384+
onToggleCollapsed: () => undefined,
1385+
onToggleFinished: () => undefined,
1386+
onRefresh: () => undefined,
1387+
onCancel: () => undefined,
1388+
onOpenSession: () => undefined,
1389+
};
1390+
1391+
const wide = renderChatView({ backgroundTasks });
1392+
const wideWorkbench = wide.querySelector(".chat-workbench");
1393+
expect(wideWorkbench?.classList.contains("chat-workbench--tasks-open")).toBe(true);
1394+
expect(wideWorkbench?.classList.contains("chat-workbench--tasks-dock-bottom")).toBe(false);
1395+
1396+
const narrow = renderChatView({ backgroundTasks: { ...backgroundTasks, narrowLayout: true } });
1397+
const narrowWorkbench = narrow.querySelector(".chat-workbench");
1398+
expect(narrowWorkbench?.classList.contains("chat-workbench--tasks-open")).toBe(false);
1399+
expect(narrowWorkbench?.classList.contains("chat-workbench--tasks-dock-bottom")).toBe(true);
1400+
expect(narrow.querySelector(".chat-tasks-rail")).not.toBeNull();
1401+
});
1402+
13721403
it("keeps the secondary New session and Export controls suppressed in the composer", () => {
13731404
const container = renderChatView({
13741405
messages: [{ role: "assistant", content: "ready" }],

‎ui/src/pages/chat/chat-view.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ export function renderChat(props: ChatProps) {
189189
props.sessionWorkspace &&
190190
(props.sessionWorkspace.dock === "bottom" || props.sessionWorkspace.narrowLayout),
191191
);
192+
const tasksOpen = props.backgroundTasks?.collapsed === false;
193+
const tasksDockBottom = tasksOpen && props.backgroundTasks?.narrowLayout === true;
192194
const canCompose = props.canSend;
193195
let chatSection: HTMLElement | null = null;
194196

@@ -371,10 +373,10 @@ export function renderChat(props: ChatProps) {
371373
<div
372374
class="chat-workbench ${props.sessionWorkspace?.collapsed
373375
? "chat-workbench--workspace-collapsed"
374-
: ""} ${workspaceDockBottom ? "chat-workbench--dock-bottom" : ""} ${props.backgroundTasks
375-
?.collapsed === false
376+
: ""} ${workspaceDockBottom ? "chat-workbench--dock-bottom" : ""} ${tasksOpen &&
377+
!tasksDockBottom
376378
? "chat-workbench--tasks-open"
377-
: ""}"
379+
: ""} ${tasksDockBottom ? "chat-workbench--tasks-dock-bottom" : ""}"
378380
>
379381
${renderSessionWorkspaceRail(props.sessionWorkspace)}
380382
${renderBackgroundTasksRail(props.backgroundTasks)}

‎ui/src/pages/chat/components/chat-background-tasks.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ describe("background tasks rail rendering", () => {
205205
html`${renderBackgroundTasksRail({
206206
agentId: "main",
207207
collapsed: false,
208+
narrowLayout: false,
208209
connected: true,
209210
canCancel: true,
210211
loading: false,
@@ -247,6 +248,7 @@ describe("background tasks rail rendering", () => {
247248
html`${renderBackgroundTasksRail({
248249
agentId: "main",
249250
collapsed: false,
251+
narrowLayout: false,
250252
connected: true,
251253
canCancel: false,
252254
loading: false,

‎ui/src/pages/chat/components/chat-background-tasks.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ import { paneSessionAgentId } from "./chat-session-workspace.ts";
2828
export type BackgroundTasksProps = {
2929
agentId: string;
3030
collapsed: boolean;
31+
/** Pane too narrow for a side rail: presentation moves to a bottom strip
32+
* (mirrors the workspace rail's narrow mode). */
33+
narrowLayout: boolean;
3134
connected: boolean;
3235
canCancel: boolean;
3336
loading: boolean;
@@ -261,7 +264,7 @@ export function toggleBackgroundTasks(host: BackgroundTasksHost) {
261264

262265
export function createBackgroundTasksProps(
263266
host: BackgroundTasksHost,
264-
opts: { onOpenSession: (sessionKey: string) => void },
267+
opts: { narrowLayout?: boolean; onOpenSession: (sessionKey: string) => void },
265268
): BackgroundTasksProps {
266269
const state = getBackgroundTasksState(host);
267270
if (!host.connected) {
@@ -281,6 +284,7 @@ export function createBackgroundTasksProps(
281284
return {
282285
agentId: state.agentId,
283286
collapsed: state.collapsed,
287+
narrowLayout: opts.narrowLayout === true,
284288
connected: host.connected,
285289
// tasks.cancel needs operator.write; read-only operators get no button.
286290
canCancel: host.connected && hasOperatorWriteAccess(host.hello?.auth ?? null),
@@ -463,7 +467,9 @@ export function renderBackgroundTasksRail(
463467
@click=${backgroundTasks.onToggleCollapsed}
464468
>
465469
<span class="nav-collapse-toggle__icon" aria-hidden="true"
466-
>${icons.panelRightClose}</span
470+
>${backgroundTasks.narrowLayout
471+
? icons.panelBottomClose
472+
: icons.panelRightClose}</span
467473
>
468474
</button>
469475
</openclaw-tooltip>

‎ui/src/styles/chat/sidebar.css‎

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,9 @@
7676
-webkit-backdrop-filter: blur(10px);
7777
}
7878

79-
/* The workspace rail adapts to the pane width (side column on wide panes,
80-
bottom strip on narrow ones — chat-pane measures and flips the dock), so
81-
its toggles stay available at every width. The background-tasks rail is
82-
side-dock only, so its toggles still hide on narrow viewports until it
83-
grows a narrow presentation. */
84-
@media (max-width: 1120px) {
85-
.chat-tasks-open,
86-
.chat-pane__actions .chat-tasks-toggle {
87-
display: none;
88-
}
89-
}
79+
/* Both rails adapt to the pane width (side column on wide panes, bottom strip
80+
on narrow ones — chat-pane measures and flips the presentation), so their
81+
toggles stay available at every width. */
9082

9183
/* Positioning context for the badge; the floating variant already gets one
9284
from its own position: absolute, so scope this to the pane-header variant. */
@@ -1687,27 +1679,52 @@
16871679
min-height: 160px;
16881680
}
16891681

1690-
/* The background-tasks rail has no narrow presentation yet; hide it with its
1691-
toggles on narrow viewports (the workspace rail adapts instead). The hidden
1692-
rail must also release its reserved grid track, so the tasks-open templates
1693-
collapse back to the workspace-only shapes here. */
1694-
@media (max-width: 1120px) {
1695-
.chat-tasks-rail {
1696-
display: none;
1697-
}
1682+
/* Narrow pane: the tasks rail mirrors the workspace rail's bottom strip.
1683+
chat-view only sets --tasks-open for the side column, so the column
1684+
templates never fire here; these rules add the strip row instead. */
1685+
.chat-workbench--tasks-dock-bottom {
1686+
grid-template-rows: minmax(0, 1fr) minmax(160px, 236px);
1687+
}
16981688

1699-
.chat-workbench--tasks-open.chat-workbench--workspace-collapsed,
1700-
.chat-workbench--tasks-open.chat-workbench--dock-bottom {
1701-
grid-template-columns: minmax(0, 1fr);
1702-
}
1689+
/* Both strips open: workspace row 2, tasks row 3. */
1690+
.chat-workbench--tasks-dock-bottom.chat-workbench--dock-bottom {
1691+
grid-template-rows: minmax(0, 1fr) minmax(160px, 236px) minmax(160px, 236px);
1692+
}
17031693

1704-
/* Mirrors the three-column selector's specificity so the two-column shape
1705-
wins while the tasks rail is hidden. */
1706-
.chat-workbench--tasks-open:not(.chat-workbench--workspace-collapsed):not(
1707-
.chat-workbench--dock-bottom
1708-
) {
1709-
grid-template-columns: minmax(0, 1fr) minmax(230px, 280px);
1710-
}
1694+
/* A collapsed workspace rail renders nothing, so its strip row must not stay
1695+
reserved under the tasks strip. */
1696+
.chat-workbench--tasks-dock-bottom.chat-workbench--dock-bottom.chat-workbench--workspace-collapsed {
1697+
grid-template-rows: minmax(0, 1fr) minmax(160px, 236px);
1698+
}
1699+
1700+
/* -2 is the second-from-last grid line, so the strip always lands in the last
1701+
row whether or not the workspace strip sits above it. */
1702+
.chat-workbench--tasks-dock-bottom .chat-tasks-rail {
1703+
grid-column: 1 / -1;
1704+
grid-row: -2;
1705+
border-left: none;
1706+
border-top: 1px solid var(--border);
1707+
}
1708+
1709+
/* Bottom strip is short and wide: sections sit side by side as their own
1710+
scroll columns, matching the workspace rail's bottom dock. */
1711+
.chat-workbench--tasks-dock-bottom .chat-tasks-rail__scroll {
1712+
flex-direction: row;
1713+
overflow-x: auto;
1714+
overflow-y: hidden;
1715+
}
1716+
1717+
.chat-workbench--tasks-dock-bottom .chat-tasks-rail__scroll > .chat-tasks-rail__section {
1718+
flex: 1 0 260px;
1719+
min-width: 0;
1720+
overflow-y: auto;
1721+
}
1722+
1723+
.chat-workbench--tasks-dock-bottom
1724+
.chat-tasks-rail__scroll
1725+
> .chat-tasks-rail__section
1726+
+ .chat-tasks-rail__section {
1727+
border-left: 1px solid color-mix(in srgb, var(--border) 42%, transparent);
17111728
}
17121729

17131730
/* Mobile: Full-screen modal */

0 commit comments

Comments
 (0)