Skip to content

fix(dashboard): a second Dashboard card reply sends after the first one was sent - #34258

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/card-send-second-click
Nov 10, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/card-send-second-click

Conversation

@chenmingwei23

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: With "Send replies in one click" on, every Dashboard card click sends its reply, not only the first one.

After one card reply is sent, the next card click on the Bot's Dashboard only puts the reply in the chat box. It sends again only after the person clicks somewhere in the dashboard and waits about 5 seconds. Found while recording the end-to-end demo of #33203.

Why it matters

The preview dashboard_card_send exists so a card answers in one click. A person who answers two cards in a row gets one sent reply and one stuck in the chat box, with nothing saying why. That looks like the feature is broken.

Not a goal

  • Changing the send gates themselves (hasGesture, tiedToFrame, the 3 second hold, the gateway checks).
  • Changing how other agent-page frames (artifacts, chat widgets) handle focus.
  • Changing the preview's default (it stays off).

What changed (motivation -> approach -> change)

Symptom, cause, fix:

Step What happens
Symptom The second card click fills the chat box instead of sending.
Cause The sent reply starts a turn, the turn moves the Bot's data, and the page is minted again. CrewDynamicDashboard.tsx promote() swaps in the new document and removes the frame the person just clicked in. That frame held focus, so the dashboard window is left with no focus at all. The next click into the new frame then fires no window blur, so focusEntry in useFrameLinkBridge.ts never records it, tiedToFrame is false, and the send falls back to filling the chat box.
Fix Before promote() removes the visible frame, if that frame holds focus, it hands focus to the frame's holder with focusHostOf (now exported from useFrameLinkBridge.ts). The window keeps focus, so the next click into the new frame is seen coming from the dashboard and the send goes through.

The send gates are unchanged. A click outside the page in the last 5 seconds still blocks a send, and a fast second click on the same reply is still held back.

Backwards compatibility

Compatible: nothing new is required or refused; the only change is where focus sits when a focused Dashboard frame is replaced.

Removes nothing: no path, record, key or function is removed; focusHostOf is only exported.

Tests

New website/src/test/CrewDynamicDashboard.cardSendRepeat.test.tsx runs the real link-bridge bookkeeping (nothing about the tie is mocked):

  • sends again after the page is re-minted, without a click in the dashboard first: send one reply, re-mint and promote the page, click the new frame, expect a second send and no chat-box fill.
  • still holds back a fast second click on the same reply: two quick sends of the same reply give one send.

Proof: not provable -- frontend test (prove.py runs Python only)

Checked by hand instead: with the two production files reverted to origin/main, the first test fails (1 send, not 2) and the second passes; with the fix both pass. Five runs with --sequence.shuffle all pass. Related files also pass: CrewDynamicDashboard.test.tsx (62) and useFrameLinkBridge.test.tsx (28).

Manual verification

Run in an isolated pod built from this branch, with a real Bot whose Dashboard page has reply buttons and "Send replies in one click" on:

  • Before the fix (main): click Approve, the reply sends; click Hold right after, the reply lands in the chat box. A focus trace shows the old frame removed, the window left without focus, and no window blur on the next click.
  • With the fix: the same two clicks both send. The gateway's audit log shows two allowed card sends and the chat box stays empty. The trace shows the window regaining focus before the old frame is removed, and a window blur on the next click.
  • A narrated clip of the fixed run was recorded and reviewed.

Screenshots / video

Why no screenshot: the change moves focus between elements and draws nothing new; the page looks the same before and after.

Related Issues

Part of #22367
Refs #33203

Sibling sweep

Swept: git grep -nE "tiedToFrame(|useFrameLinkBridge(|stageUrl" -- website/src
Sibling: website/src/pages/members/CrewDynamicDashboard.tsx -- changed here
Sibling: website/src/components/WidgetFrame.tsx -- not affected -- no off-screen swap removes its focused frame, and a missed tie only shows the Open button
Sibling: website/src/components/ArtifactBody.tsx -- not affected -- no off-screen swap removes its focused frame, and a missed tie only shows the Open button

Pattern harvest

Not generalizable: the off-screen swap that removes a focused frame exists only in the Dashboard tab, and its one promotion path now hands focus back.

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

@chenmingwei23
chenmingwei23 force-pushed the fix/card-send-second-click branch from c284e1d to fe8e69d Compare November 10, 2026 01:26
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing to check. The diff only moves focus before the Dashboard frame is swapped, and adds or changes no visible control, string or state, so the missing blind read leaves no evidence gap.

[UX-REVIEWED] fe8e69d

Description read

[DESCRIPTION-READ] 538efbc04a84d9eac0e8429e3b95196fc1e5df23935b6e89906f7ce11474f219

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

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

The fix is aimed at the real cause, which is focus left on nothing after the swap. The send gates stay as they are, and the change draws nothing new on screen.

Notes

  • focusEntry now depends on the window keeping focus. Any other place that removes a focused frame would hit the same bug without telling anyone. The sibling sweep says no such place exists today. If one is added later, it should call focusHostOf too.

[DESIGN-REVIEWED] fe8e69d

Description read

[DESCRIPTION-READ] 7636262486e284a0d3c91b9c43e1214061787cd4b10616b411225d2ea7a2c82c

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 fe8e69dcb79715343a6e1321204c0824099b0181 — 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. A single focus handoff at the one point where a focused frame gets removed. It reuses the existing helper and changes no default.

What this change ships

Inventory (3 items) — 3 justified

Intent: with one-click card send on, a person can answer several Dashboard cards in a row and each reply sends. This is a FIX.

  1. A second card click after a sent reply now sends, where before it only filled the chat box — justified
  2. When a focused Dashboard frame is replaced, focus moves to the frame's holder instead of being dropped — justified
  3. focusHostOf is now exported from useFrameLinkBridge.ts and has one new caller, CrewDynamicDashboard.tsx promote() — justified

[FIRST-PRINCIPLES-REVIEWED] fe8e69d

Description read

[DESCRIPTION-READ] 1ba3cb201ce1be11686220d5432d8b79a8430da3dcb4f190e066b677436551e8

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

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] fe8e69d

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

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] fe8e69d

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

@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 Nov 10, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 10, 2026 02:44

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving. On this head, the review checked that the two-line focus handoff in promote() fixes the cause the body names: once the focused frame is removed, the next click into the new frame fires no window blur, so the tie never records. The review also checked that hasGesture, tiedToFrame, the 3 s hold and the gateway checks are unchanged, and that the change is not on main and not a duplicate. The new test passes on this head and fails with only CrewDynamicDashboard.tsx put back to the merge-base. It also passed five shuffled runs. The linked issue is T3, and a maintainer signed off the design.
Well done: the fix reuses focusHostOf instead of loosening any send gate, and the test runs the real tie bookkeeping instead of mocking it.
Optional:

  • A second click 3 to 5 s after the first can still fill the composer. The removed frame's own reported input still counts as foreign input to the new frame (useFrameLinkBridge.ts foreignInputAt). Dropping the old frame's frameInputs entry on promote, plus a test that posts an input message from the old frame, would close that gap.
  • The test comments at lines 10, 52 and 61 say jsdom, but the suite runs under happy-dom.
  • If you have the focus trace or clip from the manual check, attaching it would let others confirm the Chromium focus model the test stand-in assumes.

@KiroCrewCaptain
KiroCrewCaptain merged commit 68744dc into main Nov 10, 2026
99 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/card-send-second-click branch November 10, 2026 02:44
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 10, 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.

2 participants