Skip to content

fix(dashboard): hide Workflows from the + menu until the chat has a run - #21102

Closed
adlio wants to merge 1 commit into
mainfrom
fix/hide-empty-workflows-panel
Closed

adlio wants to merge 1 commit into
mainfrom
fix/hide-empty-workflows-panel

Conversation

@adlio

@adlio adlio commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The side panel's "+" menu offers Workflows only in a chat that has had a workflow run.

The Workflows panel has nothing to show until a chat runs a dynamic workflow, and most chats never do. The "+" menu offered it in every chat anyway, so picking it opened a panel that said "No workflow runs."

Why it matters

A menu entry that can only open an empty panel is a dead end. Most people who pick Workflows from the menu land on that empty state.

Trade-off

The Workflows empty state carries the hint "Ask me to use a dynamic workflow to …". Hiding the row until the first run hides that hint from the "+" menu too. That is the intended trade #21099 records: the menu lists Workflows once the chat has a run, and a menu row whose panel can only be empty costs more than the discovery it gives.

The gate and the Workflows panel both read /api/workflows/runs, so they see the same set of runs. Its 200-run cap evicts only the oldest finished runs, so a chat whose runs were all evicted loses the row only when its panel would also be empty.

Not a goal

  • Hiding or closing a Workflows tab that is already open. Its × closes it.
  • Changing the Workflows panel itself, its empty state, or the run cards' "Open in the Workflows panel" link.
  • Gating any other side-panel view, such as Subagents.

What changed (motivation → approach → change)

This PR keeps Workflows out of the "+" menu until the chat's first run, the same way Summary stays out while session summaries are off. Once a chat has a run in any state, the row appears and stays after the run ends. Tabs already open are left alone, and "Open in the Workflows panel" on a run card works as before.

useSlotHasWorkflowRuns (a new hook in website/src/hooks/) checks two sources: the run list from /api/workflows/runs, read through the command center's existing ['command-center', 'workflows'] entry, and the live run events in the store. The websocket already refreshes that entry when a run ends, and live events catch a run the moment it starts, so the hook needs no polling or re-read of its own.

When the hook can't tell, it shows the row: before the first read, or after a read fails. A background refetch keeps the last answer, so the row doesn't come and go on every chat switch or window focus.

Backwards compatibility

Compatible: no API, stored state or prop contract changes; newMenuSections() (now in SidePanelAddMenu.tsx) gains one option and its callers pass it. The command center's query freshness options move to website/src/utils/commandCenterSourceFreshness.ts so the gate spreads the same object instead of a copy, without loading the lazy command center chunk.

Reader: website/src/pages/chat/SidePanelAddMenu.tsx:newMenuSections -- chat -- the "+" menu and the empty-strip launcher both read menuSections; Workflows returns with the first run (sidePanelWorkflowsGate.test.tsx)
Reader: website/src/pages/chat/WorkflowRunCard.tsx:openActivityToTab('workflows') -- chat -- opens the tab through tabsCtl.openView, which does not read the menu (leaves an open Workflows tab alone in a chat with no runs)
Reader: website/src/pages/chat/WorkflowCompletionCard.tsx:openActivityToTab('workflows') -- chat -- same path as the run card
Reader: website/src/pages/members/MembersPage.tsx:SidePanel -- crew page -- same menu; MembersPage.sidePanel.test.tsx seeds a run before expecting Workflows
Reader: website/src/pages/chat/command-center/useCommandCenter.ts:sourceOptions -- command center -- spreads the same COMMAND_CENTER_SOURCE_FRESHNESS; values unchanged

Tests

The new sidePanelWorkflowsGate.test.tsx covers the row with and without runs, an unread list, a failed read, a background refetch, a live run the list hasn't caught up to, the command center's shared entry, the Workflows app's separate cache entry, an open tab in a chat with no runs, an already-open menu gaining the row when the first run starts, and another chat's live run not counting. The last two are ported from #21178 by @atomsbaza (credited in the commit). Two existing tests changed:

  • MembersPage.sidePanel.test.tsx gives the member's chat a run before expecting Workflows in the menu.
  • playwright/session-summary.spec.ts used the Workflows row to confirm the menu had opened. It now uses Subagents.

From website/, on the head rebased onto main 3d6764b:

  • npx vitest run on the gate, add-menu, ContextBreakdown, leading-tab and Members side-panel tests: 139 passed across 5 files; command center and workflow tests: 19 files passed.
  • Mutation check: counting every live run regardless of chat fails the ported "another chat's live run" test.

Earlier head:

  • npx vitest run on the side-panel, add-menu, Members, Summary, Command Center and workflow tests: 702 passed across 42 files.
  • The new gate test and sidePanelAddMenu.test.tsx, five runs with --sequence.shuffle and random seeds: 37/37 each time.
  • npx tsc -p tsconfig.app.json --noEmit: clean.
  • npx eslint on the changed files: clean.

Manual verification

Loaded this revision in an isolated pod and opened the "+" menu in a new chat: no Workflows row. Reloaded with /api/workflows/runs stubbed to return one finished run for that chat: the row is back.

The empty-strip launcher reads the same list, but a chat can't show it because Changes, Artifacts and Files are always in the strip.

Not run: the edited Playwright spec.

Screenshots / video

The "+" menu in a chat with no runs:

The + menu without a Workflows row

The same menu after the chat has a run (run list stubbed in the browser):

The + menu with the Workflows row

Related Issues

Closes #21099

Pattern harvest

Not generalizable: the dead end comes from one menu entry whose panel has data only after a rare event; the existing Summary gate already covers the general rule ("hide a row whose view can only be empty").

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@adlio
adlio requested review from a team and KiroCrewCaptain as code owners October 16, 2026 06:23
@adlio
adlio requested a review from bolichen97 October 16, 2026 06:23
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 87b2faaae34c2be7669b4bbbe09cd25b1007cd75 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. Both menu states are shown, the blind reader saw them as the same menu, and the Workflows row itself is unchanged.

Notes

  • useSlotHasWorkflowRuns counts an unread list as "has runs" (if (!slot || !isSuccess) return true). So on a cold load, a menu opened before /api/workflows/runs answers will show Workflows and then drop it while the menu is still open. Hold the gate until the first read finishes, the way the Summary gate already does.
  • Both screenshots show the menu without saying why Workflows appears. The reader said: "Nothing on screen tells me why it is there in one and missing in the other." The row still shows only a label, so a run card's "Open in the Workflows panel" link is the only place that connects the two.

[UX-REVIEWED] 87b2faa

Description read

[DESCRIPTION-READ] d8daccbbb3725ed2706bd18ea7258eea5c99a5286dcd490bc4293a376312b947

That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 87b2faaae34c2be7669b4bbbe09cd25b1007cd75 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the gate reuses an existing data source, is open when the run state is unknown, and the change can be reverted.

Notes

  • The hook relies on ['command-center', 'workflows'] keeping the { runs } shape and api.workflowRuns as its queryFn. If the command center ever changes that entry's queryFn or shape, the gate quietly reads something else. Exporting the query key next to COMMAND_CENTER_SOURCE_FRESHNESS would keep the two readers in step.

[DESIGN-REVIEWED] 87b2faa

Description read

[DESCRIPTION-READ] d42e264f786462f078ced597d6d174a0953f958697d1d6968abd2adfa4275fa9

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 87b2faaae34c2be7669b4bbbe09cd25b1007cd75 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. One aside: hiding Workflows changes what the "+" menu shows by default, and its only recorded basis is issue #21099.

Notes

  • Item 1 — inherited: "a menu row whose panel can only be empty costs more than the discovery it gives" is backed by issue Side panel + menu offers Workflows in chats with no workflow runs #21099 only. No RFC on the base list and no docs/decisions/ entry covers the Workflows row. I'm leaving it as a note because whether a conditional row-hide counts as product shape is a judgement call. The existing Summary gate's rule ("an empty view is worse than no view", newMenuSections doc) is the closest decision the repo already holds.

What this change ships

Inventory (6 items) — 6 justified

Intent: stop the "+" menu from leading every chat to an empty Workflows panel. FIX.

  1. Workflows is gone from the "+" menu and the empty-strip launcher until the chat has a run — justified
  2. The row appears the moment a live run starts, before the run list catches up — justified
  3. The row stays visible when the run list hasn't loaded yet or the read failed — justified
  4. The gate reuses the existing ['command-center','workflows'] cache entry and does no polling of its own — justified
  5. The command center's freshness options move to commandCenterSourceFreshness.ts, which now has 2 consumers — justified
  6. The Playwright summary spec checks for Subagents instead of Workflows to confirm the menu opened — justified

[FIRST-PRINCIPLES-REVIEWED] 87b2faa

Description read

[DESCRIPTION-READ] 89953bd2313f7b84ee863c339ce4777fc111513a9117edd390f44a73c96fdda0

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 87b2faaae34c2be7669b4bbbe09cd25b1007cd75 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 87b2faa

Verdict parsed from the review's SHA-scoped output markers for commit 87b2faaae34c2be7669b4bbbe09cd25b1007cd75.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 87b2faaae34c2be7669b4bbbe09cd25b1007cd75 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 87b2faaae34c2be7669b4bbbe09cd25b1007cd75 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 87b2faa

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 87b2faaae34c2be7669b4bbbe09cd25b1007cd75 false-positive: <reason, 20 to 500 characters>

@adlio

adlio commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: menu rows recompute when a live run_started event arrives

  • span=04f4370d89ce The row can appear while the menu is open — rebutted (disproportional)

The shift needs a chat's first-ever run to start while that chat's "+" menu is open; every later run leaves the row already present, so it happens at most once per chat.
The same re-render already exists on main for Summary: summaryEnabled comes from a query and can flip while the menu is open, and nothing freezes it.
Freezing menu contents while open adds open-state tracking to SidePanel for a one-time, self-correcting misclick; the frozen goal is only to stop offering an empty panel.

@adlio

adlio commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: menu-gate prefetch of /api/workflows/runs fails open

  • span=492e113e5b07 Render failures from the workflow-menu query — rebutted (not a defect)

The query is a background prefetch whose only job is to decide whether one "+" menu row is offered; on failure it returns true and the row stays, which is exactly main's behavior.
No error is shown by this gate, so errors-use-error-notice (how a SHOWN error is rendered) does not apply; the adjudication notes the same.
The Workflows view keeps its own query and its existing ErrorNotice, so a user who opens Workflows during an outage still sees the failure with its hand-off.
A panel-level ErrorNotice in Files/Changes for a Workflows prefetch would report a failure the user did not ask about, in a view that does not depend on it.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 16, 2026
@adlio
adlio force-pushed the fix/hide-empty-workflows-panel branch from dc69c9b to 0d24a0f Compare October 16, 2026 15:36
@adlio

adlio commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author
  • span=a54399a334ce No rendered evidence for a reshaped control set — fixed in 0d24a0f

The description now carries two user-attachments screenshots from an isolated pod on this revision: the "+" menu with no Workflows row in a chat with no runs, and with the row after the chat has a run.
The empty-strip launcher is not reachable in a chat: Changes, Artifacts and Files are PINNED_VIEWS (usePanelTabs.ts), so visibleTabs is never empty there and the launcher never renders. It reads the same menuItems, so it follows the menu.

@adlio

adlio commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: menu gate reads the workflow run list through react-query

  • span=81c967f533a6 The gate shares a cache key that already holds two data shapes — fixed in 0d24a0f

The gate now reads /api/workflows/runs under its own WORKFLOW_GATE_KEY = ['workflow-runs', 'slot-gate'] and invalidates it with exact: true, so the Workflows app's bare ['workflow-runs'] entry is never read or refetched by it.
sidePanelWorkflowsGate.test.tsx "ignores the Workflows app's own run-list cache" writes a run into the bare key after the gate settles and asserts the row stays hidden; it fails with the old shared key.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 16, 2026
@adlio

adlio commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: rereading state held the row open during the live-run re-read

  • span=8456645bc9d6 Item 3 — oversized — fixed in 9b729ad

Removed rereading/setRereading, the .finally and || rereading; the invalidate call stays. The re-read only fires while liveRunIds is non-empty, which already returns true.

@adlio
adlio force-pushed the fix/hide-empty-workflows-panel branch from 0d24a0f to 9b729ad Compare October 16, 2026 16:28
@adlio

adlio commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author
  • span=44fa9e34afd2 Item 1 — inherited: the empty state carries a hint — rebutted

Losing that hint from the menu is the decision #21099 records: the "+" menu lists Workflows once the chat has a run, and the maintainer who filed it asked for exactly that.
The hint still exists: a Workflows tab already open, or opened from a run card, renders the same empty state with the same text. It is the menu entry, not the hint, that is gated.

@adlio

adlio commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author
  • span=cd5657c74f82 Row shows then drops while the first read is in flight — rebutted (disproportional)

The read starts when the side panel mounts and answers in one round trip; the menu needs a separate click after that, so the window is the first few hundred milliseconds of a panel's life.
The fail-open default is deliberate and matches Summary on main: a slow or failed read must never hide a view whose runs exist. Reserving a slot for a row that is about to disappear would leave a blank row in every chat with no runs.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 16, 2026
@adlio

adlio commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author
  • span=98fc4fc7b0de Move useSlotHasWorkflowRuns into a sibling module — fixed in df51655

The hook now lives in website/src/pages/chat/useSlotHasWorkflowRuns.ts; SidePanel.tsx only imports it, leaving it 6 lines over its size on main.

@adlio

adlio commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: separate run-list cache key plus a one-shot re-read effect

  • span=19d4bc3a5720 Item 3 — duplicate of the command center workflows entry — fixed in df51655

The gate reads ['command-center', 'workflows'] with select to unwrap { runs }; WORKFLOW_GATE_KEY, the reread ref and its effect are gone. The websocket already invalidates that entry on terminal run events and the reconnect reconcile writes it.
sidePanelWorkflowsGate.test.tsx "reads the run list the command center already keeps" pins the shared entry and its shape; pointing the hook at another key fails it.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 16, 2026
@adlio
adlio force-pushed the fix/hide-empty-workflows-panel branch from 9b729ad to df51655 Compare October 16, 2026 17:17
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Oct 25, 2026
@bolichen97
bolichen97 force-pushed the fix/hide-empty-workflows-panel branch from 66db882 to f62cfbe Compare October 25, 2026 15:05
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 25, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes at f62cfbe. The rebase did not change the PR commit, but the Opus lane found a real problem that the earlier reviews missed.

useSlotHasWorkflowRuns.ts line 27 reads the query key ['command-center','workflows'] with retry set to false. useCommandCenter.ts line 162 reads the same key with the default retry policy. The two hooks share one cache entry, so the options of whichever observer mounts last apply to both. A short 503 or 429 can then show the command center runs source as failed with no retry.

Please either drop retry: false here, or read the cached value without subscribing, for example queryClient.getQueryData plus a cache subscription, so this hook does not change the command center query options. I will withdraw this if the shared options turn out not to apply in this React Query version.

@bolichen97
bolichen97 disabled auto-merge October 25, 2026 16:09
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 28, 2026
The two tests for an already-open menu gaining the row and another chat's
live run not counting are ported from #21178 by @atomsbaza.

Co-authored-by: atomsbaza <22558327+atomsbaza@users.noreply.github.com>
@iamwhatever
iamwhatever force-pushed the fix/hide-empty-workflows-panel branch from f62cfbe to 87b2faa Compare October 29, 2026 17:03
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 29, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

Hi @adlio, this head (87b2faa) now conflicts with current main in website/src/pages/chat/SidePanel.tsx. Could you rebase onto current main and resolve it? My change request about retry: false in useSlotHasWorkflowRuns overriding the command center's retry for the same query key still stands, so the rebased head is a good moment to address it too.

@bolichen97

Copy link
Copy Markdown
Contributor

[operator: bolichen97] Continuing this in #31427; thanks for the start.

bolichen97 added a commit that referenced this pull request Nov 6, 2026
A chat that never ran a dynamic workflow still listed Workflows in the
side panel's + menu, and picking it opened a panel that could only say
there were no runs. The row now waits for the chat's first run, listed
by the workflow-runs API or live in the chat's run rows, the way Summary
waits for session summaries. It fails open while the list is unread, and
an open Workflows tab and the run cards' panel link are unchanged.

Builds on #21102 by @adlio.
bolichen97 added a commit that referenced this pull request Nov 6, 2026
A chat that never ran a dynamic workflow still listed Workflows in the
side panel's + menu, and picking it opened a panel that could only say
there were no runs. The row now waits for the chat's first run, listed
by the workflow-runs API or live in the chat's run rows, the way Summary
waits for session summaries. It fails open while the list is unread, and
an open Workflows tab and the run cards' panel link are unchanged.

Builds on #21102 by @adlio.
bolichen97 added a commit that referenced this pull request Nov 7, 2026
A chat that never ran a dynamic workflow still listed Workflows in the
side panel's + menu, and picking it opened a panel that could only say
there were no runs. The row now waits for the chat's first run, listed
by the workflow-runs API or live in the chat's run rows, the way Summary
waits for session summaries. It fails open while the list is unread, and
an open Workflows tab and the run cards' panel link are unchanged.

Builds on #21102 by @adlio.
KiroCrewCaptain pushed a commit that referenced this pull request Nov 7, 2026
…#31427)

A chat that never ran a dynamic workflow still listed Workflows in the
side panel's + menu, and picking it opened a panel that could only say
there were no runs. The row now waits for the chat's first run, listed
by the workflow-runs API or live in the chat's run rows, the way Summary
waits for session summaries. It fails open while the list is unread, and
an open Workflows tab and the run cards' panel link are unchanged.

Builds on #21102 by @adlio.
buluoray pushed a commit that referenced this pull request Nov 8, 2026
…#31427)

A chat that never ran a dynamic workflow still listed Workflows in the
side panel's + menu, and picking it opened a panel that could only say
there were no runs. The row now waits for the chat's first run, listed
by the workflow-runs API or live in the chat's run rows, the way Summary
waits for session summaries. It fails open while the list is unread, and
an open Workflows tab and the run cards' panel link are unchanged.

Builds on #21102 by @adlio.

(cherry picked from commit 9929750)
@iamwhatever

Copy link
Copy Markdown
Contributor

Thank you for this work! As noted in the thread, it continued in #31427, which has now merged. Closing this one as superseded by #31427.

@iamwhatever iamwhatever closed this Nov 8, 2026
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 8, 2026
buluoray pushed a commit that referenced this pull request Nov 9, 2026
…#31427)

A chat that never ran a dynamic workflow still listed Workflows in the
side panel's + menu, and picking it opened a panel that could only say
there were no runs. The row now waits for the chat's first run, listed
by the workflow-runs API or live in the chat's run rows, the way Summary
waits for session summaries. It fails open while the list is unread, and
an open Workflows tab and the run cards' panel link are unchanged.

Builds on #21102 by @adlio.

(cherry picked from commit 9929750)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Side panel + menu offers Workflows in chats with no workflow runs

3 participants