Skip to content

fix(dashboard): refill the open Dashboard page instead of reloading it - #19878

Merged
iamwhatever merged 1 commit into
mainfrom
fix/dashboard-refresh-in-place
Oct 13, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/dashboard-refresh-in-place

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The Dashboard tab updates its numbers in place, without reloading the whole page each time its data refreshes.

The user's live report: every time the Dashboard tab's data refreshes, the whole page reloads, so the dashboard flickers. Charts, scroll position and animations reset on every read.

Why it matters

Every crewmate's Dashboard tab refreshes on each crewmate write, each fold advance and the 60 s fallback read. So a page someone is reading flashes blank and redraws several times a minute while work moves, which is exactly when they are watching it.

Not a goal

What changed (motivation → approach → change)

Symptom → cause. A refetch at the same instance version brings the same page with new values baked into rendered_html. The frame swapped good to that html, which changed the srcdoc. useSandboxDoc then minted a new URL, and the iframe loaded a whole new document. The composed page already has a refill listener for kirocrew-dashboard:data (in dashboard_frame._BOOTSTRAP_JS), but the host never posted to it.

Fix (website/src/pages/members/CrewDynamicDashboard.tsx). The document is now keyed on the page (instance version, template id, template version) and the theme, not on the values. On a same-page read, the host reads the values out of the new html's data island (DOMParser + getElementById + JSON.parse, no regex over HTML). It posts them to the frame's own contentWindow as the refill message the page already takes. Probation, readiness and height are unchanged.

Never stale. A page whose own script never redraws on a refill would keep its old numbers. So the frame asks the page itself. A small probe in src/kiro_crew/dashboard_frame.py (the composed document), after the bootstrap and before the page, notes whether the page listens for message or kirocrew-dashboard on window. The ready beacon now carries refill: true|false. The host refills only a document that said refill: true. Every other document (no beacon yet, false, or no readable island) gets a new document exactly as before. The band script registers through the prototype, so the host's own listener is not counted. When a refill-capable document beacons, the newest values are posted once more, so a read that landed while it loaded is not lost.

Why this signal. The beacon is the one message the page already sends, and only after its scripts ran cleanly. Reading listeners as they are registered tells the host what the page actually does; a template-id allowlist would miss operator pages that do redraw. A wrong NO costs a reload, never a stale page. All 12 builtins and the user's live operator page (conductor-panel) beacon refill: true in a jsdom run.

Security. The post goes only to frameRef's own contentWindow, with '*' because the sandboxed frame's origin is opaque. It carries only the read the gateway already composed into that page. No new HTML sink: DOMParser builds an inert document and only the island's text is read. The probe is not a trust boundary: a page that claims refills it does not handle only keeps its own numbers stale.

Backwards compatibility

Compatible: the beacon gains one field that older hosts ignore, and a document that does not report refill: true gets the same reload as today.

Removes nothing: no route, key, field or behaviour is removed; the reload path stays as the fallback.

Tests

  • website/src/test/CrewDynamicDashboardRefill.test.tsx (new). It was red on main before the fix: postMessage was called 0 times.
    • A same-version read keeps the same iframe, the same src and one mint, and posts {type: 'kirocrew-dashboard:data', read} with the new values.
    • A page that beacons refill: false still gets a new mint with the new values.
    • A refill claim from any other window is ignored.
    • islandRead round-trips HTML-escaped JSON and returns null on no island, broken JSON, or a non-object.
  • website/src/test/CrewDynamicDashboard.test.tsx: the "fresher VALUES for the same page version" pin now expects a refill post and no second mint.
  • test/test_dashboard_frame.py: the probe sits between the bootstrap and the page, the band does not count as the page's listener, and the beacon reports the flag.

Fails before the fix (main @ cf9ee6b):

× keeps the mounted document and posts the new values into it on a same-version refetch
AssertionError: expected "Mock" to be called with arguments: [ ObjectContaining{…}, '*' ]
Number of calls: 0
Tests  1 failed (1)

Manual verification

  • Composed each builtin template plus a page with no listener through dashboard_frame.compose, then ran each in jsdom with scripts on. All 12 builtins and the staged conductor-panel operator page beacon {"type":"kirocrew-dashboard:ready","refill":true}, with no init errors. The no-listener page beacons refill: false.
  • Not done: watching a real tab on the live gateway. Policy refuses minting a dashboard token for the agent.

Screenshots / video

Why no screenshot: Nothing on screen changes layout or styling; the change is that the frame stops reloading, which the tests above pin by mint count and iframe identity.

Related Issues

Closes #19870

Pattern harvest

Rule candidate: review-prompt
Pattern: a memo that builds a document or URL from data, keyed on the data rather than on the document's identity, so every data change remounts it.

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

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 13, 2026 18:45
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Not yet checked on a real gateway: a builtin Dashboard tab should keep its iframe, with no reload or flicker, while values change at the same page version.

[DESIGN-REVIEWED] c8a999c

Description read

[DESCRIPTION-READ] a7df2793792202a887146499f11770d9c2e8fcad262b9ec6148ff7a01b1bb4ab

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of c8a999c08e3a9c90b0ded33a805120fe387e58b0 — 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: PASS

No one has watched a real Dashboard tab on a live gateway yet. Confirm the conductor-panel page redraws in place without flickering before merge.

What this change ships

Inventory (7 items) — 7 justified

Intent: stop the Dashboard tab reloading (flickering) each time its data refreshes. This is a FIX for #19870, with a test that fails on base.

  1. A refresh that brings new numbers for the same page updates them in place instead of reloading the frame. — justified
  2. A page that does not listen for refills still gets a full reload, as it does today. — justified
  3. The page's ready beacon now reports whether the page can take a refill. — justified
  4. Every composed page now runs a probe that records whether the page listens for message or kirocrew-dashboard events. — justified
  5. The staleness band registers its listener so the probe ignores it, so it never makes a page look refill-capable. — justified
  6. A page that finishes loading is sent the newest values once, so a refresh that arrived during its load is not lost. — justified
  7. A theme change rebuilds the page from the newest values, not the values it first opened with. — justified

[FIRST-PRINCIPLES-REVIEWED] c8a999c

Description read

[DESCRIPTION-READ] ae409775615aeb953b71974911a69247dbde3d4cf366be36c3526390fb6d9d78

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Check one live Dashboard tab across several refreshes: the numbers should update with no blank flash, and the scroll position should stay put. The author did not test this on a real gateway.

[UX-REVIEWED] c8a999c

Description read

[DESCRIPTION-READ] ced13725c16746863e3ba19beea07a525633f39bb8a05ea20aac055a4b8e376b

That sha256 names everything this verdict read: the PR description, plus the 3 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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] c8a999c

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

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c8a999c

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

@iamwhatever
iamwhatever merged commit 3751ed3 into main Oct 13, 2026
100 of 101 checks passed
@iamwhatever
iamwhatever deleted the fix/dashboard-refresh-in-place branch October 13, 2026 19:38
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Oct 13, 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.

Dashboard tab reloads the whole page on every data refresh

2 participants