Skip to content

feat(dashboard): keep or discard a staged dashboard page from the tab - #19922

Merged
iamwhatever merged 1 commit into
mainfrom
feat/dashboard-preview-keep-button
Oct 14, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/dashboard-preview-keep-button

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A person looking at a crewmate's staged dashboard page can keep it or drop it with one click, and then sees the live page right away.

A crewmate stages a page with dashboard_preview and sends a link. The link opens the Dashboard tab on the staged page, but there is no button to keep it. The only way is to say yes in chat and wait for the crewmate to call dashboard_apply.

After the page is applied, the tab keeps saying "This preview has closed. It was applied or it expired." The URL still asks for the preview (?dashboard=preview), so the tab never shows the live page.

Why it matters

Every person who opens a preview link hits both. They have nothing to press, and after a yes in chat they are left on a closed notice instead of the page they just chose.

Not a goal

What changed (motivation → approach → change)

Premise: the maintainer asked for this exact shape: open the preview, press Keep, done, and after Keep the tab refreshes to the live page. The chat "yes" path stays for the crewmate.

The buttons sit in the host chrome above the sandboxed frame, so the staged page can never press them.

Both buttons act only on the page on screen. The preview read returns the staged page's staged_ms; the host sends back the stamp of the document the frame has loaded and that sent its ready beacon (both buttons stay disabled until then), and the store refuses preview_changed inside the instance lock if another page was staged since. Keep runs the same apply_preview writer as dashboard_apply; Discard runs discard_shown_preview.

The routes POST /api/members/{slug}/dashboard/preview/apply and .../preview/discard carry the lock route's gates in its order: an internal-secret caller is refused human_only (one helper the three routes share), then the member checks, then the owner gate; CSRF is the shared middleware. Locked answers 423 dashboard_locked, nothing staged 404 no_preview; Discard reads back and only answers ok when nothing is left to install.

The hand-over: when the staged page is gone for any reason (Keep, Discard, the agent's apply, expiry), the host drops the cached live read, leaves preview mode at once (removing dashboard=preview on /members) and mounts the live page under one note. The frame reports "nothing staged" only after its own read settles and draws nothing for it while a host listens, so no closed screen flashes; a later preview link reopens the staged page in both hosts.

Copy: the hint says Keep replaces the current page and the crewmate can restore it; "Discard can't be undone." sits under the buttons. A refused or failed request, the lock refusal included, is an ErrorNotice in the tab's own words. A Keep refused because a newer page was staged redraws it and says so through the shared StatusNotice (warn): nothing was written and the next step is the ordinary Keep. After Keep the note adds the undo line; any other hand-over says "Preview ended. This is the live page now." The dashboard_preview reply and the dashboard skill tell the crewmate the person may press Keep or Discard, so it re-reads [DASHBOARD] before dashboard_apply.

Composed packages: a preview read without dashboard= serves only the staged template page and Keep only installs a staged template, so a bound package never reaches Keep; a test pins that.

Where it lives: routes in src/kiro_crew/dashboard/handlers/member_dashboard.py (registered in src/kiro_crew/dashboard/server_runtime/mcp_routes.py); staged_ms checks, discard_shown_preview and the refusals in src/kiro_crew/dashboard_templates/instance.py; the agent's text in src/kiro_crew/mcp_panel.py and src/kiro_crew/builtin_skills/dashboard/SKILL.md; client calls in website/src/api/client/agents.ts; the drawn-page stamp in CrewDynamicDashboard.tsx; buttons, note and hand-over in website/src/pages/chat/DashboardPreviewActions.tsx, used by CrewDashboardTab.tsx and DashboardPreviewPanel.tsx; the re-open signal in website/src/utils/dashboardPreview.ts from website/src/hooks/usePanelDocumentActions.ts; strings in website/src/i18n/locales/*.json (en-XA regenerated); docs/system-specs/modules/dashboard-instances.md and docs/feature-map/README.md.

Backwards compatibility

Compatible: two new routes and a new optional staged_ms on the preview read; apply_preview's new keyword defaults to the old behaviour, so dashboard_apply is unchanged.

Removes nothing: the "closed" notice still renders where no host listens for it; the preview read, the agent routes and the lock route answer as before.

Tests

  • test/test_dashboard_preview_keep.py: Keep installs the staged page and broadcasts the change; refuses a page staged after the one shown, a locked layout, nothing staged, a bad staged_ms; Discard drops the shown page, keeps one staged since (409), needs a valid staged_ms, is idempotent, and does not claim success when the page stays staged; an internal-secret caller and a non-owner are refused for both routes; the real owner gate admits only the owner; a bound composed package never reaches Keep; the deferred binder registers both routes.
  • website/src/test/CrewDashboardTab.keep.test.tsx (real router, URL read back): Keep → route called with the staged page → URL has no dashboard=preview → the live read ran → the kept page is mounted → no "closed" state; Keep and Discard do nothing until the frame has loaded the page and it beaconed; Keep names the mounted page, not a newer read still being minted; the agent-apply path hands over the same way, with no undo line; a later link shows the newly staged page; the server's lock refusal is an error; a failed Keep stays on the preview; Discard; no buttons on the live page.
  • DashboardPreviewActions.test.tsx: Keep and Discard are alone on their row; a click before the page is drawn does nothing; a failed Discard is an error; a 500 on Keep is an ErrorNotice, never the status notice; a newer staged page refuses Keep, says so in a warn StatusNotice (role=status, data-tone=warn, no alert) and redraws the preview.
  • DashboardPreviewPanel.test.tsx: buttons sit outside the frame and post nothing until pressed; Keep hands over to the live page; a session preview has no Keep; an expired preview hands over; a re-opened link returns to the staged page.
  • MembersPage.test.tsx: an agent-applied preview drops dashboard=preview and shows the live page with the note.
  • CrewDynamicDashboard.test.tsx: the frame draws nothing for "nothing staged" when the host listens.
  • test_dashboard_server_composition_contract.py: route table and boot order pins updated for the two routes.

Determinism: test_dashboard_preview_keep.py passed 3× under xdist and once in a shuffled order (seed 7, -n0); the three frontend files passed 3× with --sequence.shuffle. The "staged again" cases pin instance._now_ms instead of sleeping.

Manual verification

Ran a Playwright capture against the real MembersPage and the real DashboardPreviewPanel (gateway-free, every /api/ call answered by fixtures): Keep and Discard enabled only after the page loaded and beaconed, and sent its staged_ms; after Keep the URL dropped dashboard=preview, the live page was re-read and the note says "Kept"; after Discard the old live page is back under "Discarded"; a failed Keep or Discard stays on the preview with the error under the buttons; a newer staged page redraws the frame; a page the agent applied, and one that expired, hand over under "Preview ended"; a locked layout refuses Keep in the badge words. No closed screen in any scene.

Screenshots / video

Before Keep (dark): the staged page with Keep and Discard above the frame.

before keep, dark

After Keep (light): the live page, the URL without dashboard=preview, and the note with the undo line.

after keep, light

After Discard (dark): the old live page is back under "Discarded. The live page didn't change."

after discard, dark

A newer page was staged after the look (light): Keep is refused, the frame redraws to the newer page, and a warn StatusNotice says Keep now keeps it.

newer page staged, light

A failed Keep and a failed Discard (dark): the error sits under the buttons and the preview stays.

keep failed, dark

discard failed, dark

The preview expired while open (dark): the old live page stays, under "Preview ended. This is the live page now."

preview expired, dark

The layout is locked (dark): Keep is refused with the tab's own lock words, and the preview stays.

locked refusal, dark

More: the agent applied it, the chat side panel, the other theme

The crewmate applied the page while it was open (light): the tab hands over under "Preview ended".

agent applied, light

The chat side panel (dark), before and after Keep.

side panel before keep, dark

side panel after keep, dark

before keep, light

after keep, dark

Related Issues

Closes #19900

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • 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

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 13, 2026 20:09
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 13, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-preview-keep-button branch from 8ecd055 to cadef9a Compare October 13, 2026 20:23
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of a99996a34594b65b03f4f766c0cf35dab6efacd7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] a99996a

Description read

[DESCRIPTION-READ] 8d1959fd21b2a6af745d67b07474cc7855d896f5c55cd3bbe4e3910d22f0f87f

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 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of a99996a34594b65b03f4f766c0cf35dab6efacd7 — 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The person-facing Keep button reverses a recorded "no Apply control here" decision, and the only support offered is a maintainer request nobody can check.

Not justified as shipped

  • Item 1 — inherited: the only support is "Premise: the maintainer asked for this exact shape". There is no linked issue, but the change deletes the feat(chat): open a staged dashboard preview in the side panel #18837 pin "applies nothing and offers no Apply control" ("Keeping the page is the person's answer in the chat"). It also goes against rfc-crewmate-dynamic-dashboard (status partial): "A person who wants another page says so in chat". The chat path stays the default, so this is not a (c) trigger. The staged_ms match does answer the RFC's "Apply takes no argument" concern.
    Clears when: a linked issue or comment records the maintainer's request, or /ai-review override first-principles a99996a34594b65b03f4f766c0cf35dab6efacd7: <decision>.

What this change ships

Inventory (8 items) — 7 justified

Intent: let a person keep or drop a crewmate's staged dashboard page from the tab, then see the live page. ADDITION, plus a FIX for the stuck "preview closed" notice.

  1. A Keep button above the staged page, in the Dashboard tab and the side panel — inherited
  2. A Discard button beside it — justified
  3. When the staged page is gone, the tab leaves preview mode and shows the live page with a note — justified
  4. Keep or Discard of a page that was replaced since it was shown is refused, and the newer page is drawn — justified
  5. Both buttons stay disabled until the frame has drawn the page — justified
  6. Opening a preview link again sends a panel that already handed over back to the staged page — justified
  7. The dashboard_preview reply and the dashboard skill tell the agent to re-read before applying — justified
  8. Two new person-only routes, which refuse agent callers through a check shared with the lock route — justified

[FIRST-PRINCIPLES-REVIEWED] a99996a

Description read

[DESCRIPTION-READ] b793d49b18d55751b6ef11ab4de303ff7bd14823d60f980725ba62dfb94069e3

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 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

UX-level review of a99996a34594b65b03f4f766c0cf35dab6efacd7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

Keep and Discard look dead until the page has loaded, and "Preview ended" doesn't say whether the draft was kept. Both left the blind reader unsure what had happened.

Watch

  • Disabled buttons with no reason. disabled={busy || stagedMs <= 0} dims both buttons until the frame beacons, and nothing says why. In shot-01 and shot-10 the reader said of Keep: "it may be switched off right now… no. It looks disabled." This is the primary control, and every preview open shows this state first. Fix: show "Loading preview…" beside the buttons while stagedMs is 0.
  • outcome_closed is ambiguous. "Preview ended. This is the live page now." appears over the old page in shot-07 and over the draft in shot-09. The reader said: "I don't know… whether my draft was kept or thrown away." "Live page now" sounds like something was applied. This hits every agent apply or expiry. Fix: "This preview is no longer staged. Below is your current dashboard."
  • Lock refusal is a dead end. It reuses dashboard_locked_badge ("Layout locked — unlock on Profile") with no link, and Keep stays enabled (shot-08). The reader said: "I don't know where Profile is." CrewDashboardTab already has onOpenProfileTab, so add an "Open Profile" action to that notice.

Suggestions

  • hint_actions: at four sentences in muted text-xs, the hint buries the consequence, and "{{name}} can restore it" is unclear about what "it" means. Replace it with: "Not live yet. Keep replaces your current dashboard ({{name}} can restore the old one). Discard deletes this draft."

[UX-REVIEWED] a99996a

Description read

[DESCRIPTION-READ] 9101958de819835a647d79d17501ad3b969a83d45c4238149022cc1916578481

That sha256 names everything this verdict read: the PR description, plus the 16 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 added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] a99996a

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable a99996a34594b65b03f4f766c0cf35dab6efacd7: <one-sentence reason>

@iamwhatever
iamwhatever force-pushed the feat/dashboard-preview-keep-button branch from cadef9a to beec013 Compare October 13, 2026 21:39
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention 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 readiness: checking Automated validation is still running labels Oct 13, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-preview-keep-button branch from beec013 to 5bc96a9 Compare October 13, 2026 23:30
@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 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] a99996a

False positive or not applicable? A repository writer can comment:
/ai-review override gpt a99996a34594b65b03f4f766c0cf35dab6efacd7: <one-sentence reason>

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 13, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-preview-keep-button branch from 5bc96a9 to 70ab632 Compare October 13, 2026 23:50
@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 14, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-preview-keep-button branch from 70ab632 to 19062b1 Compare October 14, 2026 00:39
@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 14, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-preview-keep-button branch from be758ef to 827790d Compare October 14, 2026 04:14
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 14, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=9ee7cf952f89 · disposition: rebutted

  • The lock refusal has no next step

Not a defect: the refusal reuses the tab's own lock words by the maintainer's ruling, nothing is written and the preview stays staged. Scope is frozen after round 6 (only defects get code); a Profile link from the preview is polish for a follow-up.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=32ba8c05f1c7 · disposition: rebutted

  • outcome_closed reads the same for opposite results

Deliberate: First Principles asked to cut the version comparison that told the two apart, and the maintainer ruled that cut wins over this ask. The note is true in both cases, and the frame below shows which page is live.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=06436cdfb7af · disposition: deferred

  • Keep and Discard are disabled with no reason given

The gate is the data-loss fix (no click before the shown page has drawn and beaconed ready); it lasts one page load. Scope is frozen after round 6, so a loading label is left for a follow-up.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=b9f3f14ac808 · disposition: deferred

  • hint_actions: ambiguous "it"

Wording polish; scope is frozen after round 6 (only defects get code). Left for a follow-up copy pass.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=903fbb8cd89d · disposition: deferred

  • Merge discard_note into one line

Wording polish; scope is frozen after round 6 (only defects get code). Left for a follow-up copy pass.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 14, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-preview-keep-button branch from 827790d to a99996a Compare October 14, 2026 06:27
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 14, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=a35ee02efb90 · disposition: needs-a-decision

  • Premise: a person-facing Keep button

Unchanged by this rebase (a99996a only resolves conflicts with main). The description's premise is the maintainer's request for this shape; the agent's chat path stays the default. Recording that decision, by a linked comment or an override, is for a maintainer.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=e940114429e2 · disposition: deferred

  • Keep and Discard are disabled with no reason given

The gate is the data-loss fix (no click before the shown page has drawn and beaconed ready) and lasts one page load. Scope is frozen after round 6, so a loading label is left for a follow-up.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=0989cc78d9c1 · disposition: rebutted

  • outcome_closed reads the same for opposite results

Deliberate: First Principles asked to cut the version comparison that told the two apart, and that cut was kept over this ask. The note is true in both cases, and the frame below shows which page is live.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=5e0cfbd8576d · disposition: rebutted

  • The lock refusal has no next step

Not a defect: the refusal reuses the tab's own lock words, nothing is written and the preview stays staged. Scope is frozen after round 6 (only defects get code); a Profile link from the preview is polish for a follow-up.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

span=93c2969bbb6d · disposition: deferred

  • hint_actions: shorter wording

Wording polish; scope is frozen after round 6 (only defects get code). Left for a follow-up copy pass.

@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 14, 2026
@iamwhatever
iamwhatever merged commit 2f4f997 into main Oct 14, 2026
104 checks passed
@iamwhatever
iamwhatever deleted the feat/dashboard-preview-keep-button branch October 14, 2026 07:14
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep or discard a staged dashboard page from the Dashboard tab

2 participants