From 8862450ec3dc80b31a1063b143ba683bc51571be Mon Sep 17 00:00:00 2001 From: 4ndreello <4ndreello@users.noreply.github.com> Date: Tue, 22 Sep 2026 16:07:38 -0300 Subject: [PATCH] fix(agents): Keep the agents pane closed at startup Leave screen space available when a run starts. Load the first snapshot for the status button, and refresh it when `/band` opens the pane. Co-Authored-By: Codex --- docs/mods.md | 5 +++-- plugin/hooks/register.tsx | 18 +++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/docs/mods.md b/docs/mods.md index a146755..6912f23 100644 --- a/docs/mods.md +++ b/docs/mods.md @@ -95,8 +95,9 @@ draws off the edge: Measured together in one 200 by 50 terminal: `bodyColumns` 89, `scroll.bodyRows` 44, `viewport` `{ columns: 110, rows: 50 }`. -The pane draws from session start, as soon as one refresh has a snapshot. It -does not wait for a turn. +The first snapshot loads during session start, so the button can show agent +status before the first turn. The pane stays closed until the button or `/band` +opens it. ### Capitalized tags, resolved from the event diff --git a/plugin/hooks/register.tsx b/plugin/hooks/register.tsx index 7f176d9..ec07da5 100644 --- a/plugin/hooks/register.tsx +++ b/plugin/hooks/register.tsx @@ -125,20 +125,15 @@ export const register: Register = (on) => { description: "toggle the codedeck agents pane", immediate: true, }); - // Only open when there is actually a run behind the pane. A session that - // loads this plugin by manual --plugin-dir or a global install has no - // CODEDECK_RUN_ID, and the dock there is permanently empty while eating - // most of the screen for the whole session. /band stays the escape hatch - // for anyone who wants the pane anyway. + // Only show the button when there is actually a run behind the pane. A + // session that loads this plugin by manual --plugin-dir or a global + // install has no CODEDECK_RUN_ID, and its dock stays empty. /band remains + // available for anyone who wants to open it anyway. const runId = await $.env.get("CODEDECK_RUN_ID"); state.hasRun = Boolean(runId); if (runId) { - // No width is requested: the engine sizes the dock itself and reports - // the usable content back as e.props.bodyColumns on every render. - await $.ui.open({ id: PANE_ID, side: "right" }); - paneOpen = true; - // Populate before the first turn, or the pane stays blank through the - // whole opening exchange, which is exactly when the run is dispatched. + // Prime the button label without taking screen space when the session + // starts. The panel opens only on an explicit button press or /band. void refresh($, state); } return next(e); @@ -152,6 +147,7 @@ export const register: Register = (on) => { // pane desyncing for the rest of the session. paneOpen = await toggleAgentsPane($, paneOpen); await $.ui.invalidate("ui.render"); + if (paneOpen) void refresh($, state); return { text: paneOpen ? "agents pane open" : "agents pane closed" }; });