Skip to content

fix(dashboard): keep the warm brief card when the user leaves after the opener - #24512

Merged
chenmingwei23 merged 1 commit into
mainfrom
crew/pr-greener/fix-warm-brief-keep-on-leave
Oct 27, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
crew/pr-greener/fix-warm-brief-keep-on-leave

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Leaving a crewmate thread after the "Welcome back" opener no longer throws away the progress card; it still arrives once, while the user is away or after they come back.

The warm brief posts two messages: a fixed opener, then a progress card from one background model call. If the user hides the browser tab or opens another chat while that call runs, even for two seconds, the card is never posted. Coming back posts nothing either, because the claim row is already written. The thread is left with the opener alone, so the crewmate looks like it stopped mid-sentence.

Why it matters

Every owner who glances away during the up-to-60-second model call loses the brief they came back for. Switching tabs is the normal way people use the dashboard, so this hits most real returns.

Not a goal

What changed (motivation → approach → change)

Moment Before After
Leave before the opener Brief dropped Brief dropped (same)
Leave after the opener Card dropped forever Card still posts
Leave 2 s and return Card dropped Exactly one card
User types, resets or closes Card dropped Card dropped (same)

Root cause: in src/kiro_crew/dashboard/warm_task_brief.py, handle_focus_frame called cancel_warm_task_brief whenever the last owner view left the thread, and _still_current required the thread to be on screen before publishing. Either one dropped a card that was already half-delivered.

The fix records, per thread, that the opener is out (_warm_task_brief_opened in dashboard/state_parts/dashboard_state.py). After that point leaving no longer cancels, and the publication re-check (_settled, _still_current, _wait_for_idle_turn) skips the on-screen test. Every other guard stays: a typed row, reset or close still cancels or abandons the brief, a new user turn still makes the result stale, and a running turn still defers publication. A return while the brief is in flight starts nothing new (already_preparing / short_away), so there is no duplicate.

This follows the accepted RFC docs/request-for-change/rfc-delayed-task-brief.md; it gains a 2026-10-26 leave amendment, and the owning spec docs/system-specs/modules/session.md and the docs/feature-map/README.md row say the same.

Backwards compatibility

Compatible: the only behaviour change is that a card which used to be dropped is now posted; no field, route or message kind changes.

Removes nothing: the diff only stops discarding a result; no path, row, key or reader is taken away.

Tests

test/test_warm_task_brief.py:

  • test_leaving_after_the_opener_still_publishes_the_card (tab hidden, other chat): the card posts after the owner leaves mid-call.
  • test_quick_leave_and_return_during_the_model_call_posts_one_card: a quick away-and-back keeps the same task, posts exactly one card, and a later return adds nothing.
  • test_typing_after_leaving_past_the_opener_still_drops_the_card: a typed row still cancels.
  • test_cancel_during_model_suppresses_result_without_cancelling_acquisition now registers its task so it tests a real cancel, not a leave.

Proof: PROVEN test/test_warm_task_brief.py::test_leaving_after_the_opener_still_publishes_the_card[tab_hidden], test/test_warm_task_brief.py::test_leaving_after_the_opener_still_publishes_the_card[other_chat], test/test_warm_task_brief.py::test_quick_leave_and_return_during_the_model_call_posts_one_card (head b4a1c41)

Determinism: the four tests passed 20 repeated runs, and the whole file (91 tests) passed in three shuffled orders. No sleeps or wall-clock waits; each test blocks the model on an asyncio.Event.

Manual verification

N/A — unit coverage sufficient: the change is server-side control flow, and the tests drive the real handle_focus_frame and note_foreground path that ws.py calls.

Related Issues

Closes #24502

Sibling sweep

Swept: git grep -nE "cancel_warm_task_brief|_is_foreground" -- src/
Sibling: src/kiro_crew/dashboard/chat_handlers.py -- not affected -- a real user send, which must still cancel
Sibling: src/kiro_crew/dashboard/chat_api/slot_lifecycle.py -- not affected -- reset and close, which must still cancel
Sibling: src/kiro_crew/dashboard/handlers/members_thread_turns.py -- not affected -- a typed crewmate turn, which must still cancel

Pattern harvest

Not generalizable: the defect is one feature's choice to treat "off screen" as "cancelled" after part of its output was already posted.

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 26, 2026 17:56
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 68528235f457119a67ceea4d4110fcbd4b779b33 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the per-thread "opener posted" set is scoped to the brief's lifetime and cleared in finally. It only relaxes the on-screen check after the opener is out, and the typed-row, reset, close, staleness and running-turn guards are unchanged.

Notes

  • The require_foreground keyword now runs through three helpers (_settled → _wait_for_idle_turn → _still_current), but the only post-opener caller always passes False. It would be simpler for those helpers to read _warm_task_brief_opened directly instead of passing a flag down.

[DESIGN-REVIEWED] 6852823

Description read

[DESCRIPTION-READ] 3acc2b55dd43727c55c6d7165936910be88efbb1a28a37fd71e8e01e0479de09

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 68528235f457119a67ceea4d4110fcbd4b779b33 — 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

This fixes a reported defect (#24502) in the code that causes it, and it keeps the cancel and stale-result guards. The one open question is a recorded leave rule that this diff reverses itself.

Notes

  • Item 5 — rides along: before this diff, the accepted RFC's §3.4 table said "User sends, leaves, … Stale result is discarded", and the deleted test test_leave_and_return_during_the_model_call_posts_no_result pinned that rule. The diff rewrites that same RFC to reverse it. The reason it gives is an owner report, not symmetry, so it is not a BLOCK. Whether this counts as a product-shape change is a judgement call, which makes it a maintainer's decision rather than this lane's.

What this change ships

Inventory (5 items) — 4 justified

Intent: once a returning owner has seen the "Welcome back" opener, the progress card still arrives even if they leave the thread. FIX.

  1. Hiding the tab or opening another chat after the opener no longer cancels the brief — justified
  2. The card now posts while the owner is away from the thread — justified
  3. While the owner is away, a running turn still delays the card; it no longer drops it — justified
  4. A quick leave and return during the model call gives exactly one card — justified
  5. The RFC, session spec and feature-map row now say leaving after the opener does not drop the card — rides along (reverses a leave rule the accepted RFC recorded)

[FIRST-PRINCIPLES-REVIEWED] 6852823

Description read

[DESCRIPTION-READ] b3d2b329e83a561fc29cede6850ecad1635ab2bcc65e5997f845116c52433834

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

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6852823

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

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 6852823

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

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

@iamwhatever
iamwhatever force-pushed the crew/pr-greener/fix-warm-brief-keep-on-leave branch 2 times, most recently from 74bc868 to b4a1c41 Compare October 26, 2026 18:30
@iamwhatever

iamwhatever commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: no

  • span=5ada12bd6b4f docs/system-specs/modules/session.md: spec still says leaving drops the result

fixed in b4a1c41: docs/system-specs/modules/session.md now says leaving drops the brief only before its opener; after the opener the result still posts as ordinary history.
A sweep of docs/ and src/kiro_crew/docs found no other spec line that ties leaving to dropping a posted brief's result.

@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 26, 2026
@iamwhatever
iamwhatever force-pushed the crew/pr-greener/fix-warm-brief-keep-on-leave branch from b4a1c41 to 6852823 Compare October 26, 2026 20:44
@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 26, 2026
@iamwhatever iamwhatever self-assigned this Oct 26, 2026
@chenmingwei23
chenmingwei23 merged commit 2529a15 into main Oct 27, 2026
108 checks passed
@chenmingwei23
chenmingwei23 deleted the crew/pr-greener/fix-warm-brief-keep-on-leave branch October 27, 2026 06:04
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 27, 2026
iamwhatever pushed a commit that referenced this pull request Oct 28, 2026
Bring the delayed-task-brief RFC and its directory index into agreement
with the document's amendments and with what shipped on main.

The warm task brief shipped in #20422 and its amendments shipped in
#21750, #22828, #22839, #23847, #24512 and #24307, but the RFC still
read `accepted` ("nothing built yet") with implementation-prs [] and a
2026-10-14 audit stamp.

The front matter now records status implemented, those seven PRs, and
last-audited 2026-10-28 at 7cbf872; the section 1 status and
"Audited on" lines match it; and the snapshot's third field is renamed
"Suggested actions" to match the section 3.5 output it feeds.

The README index row no longer describes the superseded preparing-status
design or says implementation waits for the RFC. It reads implemented,
names the shipped PRs, and summarises the shipped trigger, the
free-form brief card and the leave-after-opener rule. The audit
paragraph gains a dated re-audit sentence for the row.

Closes #20887
iamwhatever pushed a commit that referenced this pull request Oct 29, 2026
Bring the delayed-task-brief RFC and its directory index into agreement
with the document's amendments and with what shipped on main.

The warm task brief shipped in #20422 and its amendments shipped in
#21750, #22828, #22839, #23847, #24512 and #24307, but the RFC still
read `accepted` ("nothing built yet") with implementation-prs [] and a
2026-10-14 audit stamp.

The 2026-10-28 writer amendment (section 3.8, #25433) is design only:
main has no wake turn and no `dashboard.warm_brief_wake` setting. So
the front matter now records status partial, those seven PRs, and
last-audited 2026-10-29 at 4d36177; the section 1 status line
names what shipped and that section 3.8 is not built; the "Audited on"
line matches; and the snapshot's third field is renamed "Suggested
actions" to match the section 3.5 output it feeds.

The README index row no longer describes the superseded preparing-status
design or says implementation waits for the RFC. It reads partial,
names the shipped PRs, summarises the shipped trigger, the free-form
brief card and the leave-after-opener rule, and names the unbuilt
writer amendment. The audit paragraph gains a dated re-audit sentence
for the row.

Closes #20887
iamwhatever pushed a commit that referenced this pull request Nov 2, 2026
…21712)

Bring the delayed-task-brief RFC and its directory index into agreement
with the document's amendments and with what shipped on main.

The warm task brief shipped in #20422 and its amendments shipped in
#21750, #22828, #22839, #23847, #24512, #24307, #25881 (Crew Mode
scope), #26500 (fixed progress orb) and #26652 (first part of the
2026-10-31 redesign), yet the front matter and README row still
read `accepted` ("nothing built yet") with implementation-prs [] and a
2026-10-14 audit stamp.

Not built on main: the 2026-10-28 writer amendment (section 3.8; main
has no wake turn and no `dashboard.warm_brief_wake` setting), the
2026-11-01 trigger amendment (#26938 is open), and the live checks,
links and copied option buttons of section 3.9.3. So the front matter
now records status partial, those ten PRs, and last-audited 2026-11-01
at fed53fc; the section 1 status line names what shipped and what
is not built; the "Audited on" line matches; and the snapshot's third
field is renamed "Suggested actions" to match the section 3.5 output it
feeds.

The README index row no longer describes the superseded preparing-status
design or says implementation waits for the RFC. It reads partial,
names the shipped PRs, summarises the shipped trigger, the one-message
brief with its fixed card and quiet return, and names the unbuilt
parts. The audit paragraph gains a dated re-audit sentence for the row.

Closes #20887
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.

Warm welcome: leaving the thread after the opener drops the progress card

2 participants