Skip to content

fix(dashboard): a failing slots flush no longer 500s a committed create - #30730

Merged
bolichen97 merged 1 commit into
mainfrom
fix/8745-committed-create-answers-200
Nov 6, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/8745-committed-create-answers-200

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A slot create that has already committed answers 200, not 500, when the slots broadcast that follows it fails, whichever side of the coalescing window that broadcast lands on.

The create finishes, the session exists, and then the owed slots broadcast runs. If that broadcast fails on the window's leading edge (an idle dashboard, one deliberate create with a folder or title), the caller gets a plain-text 500. Inside the 0.2 s window the same failure is only logged and the caller gets 200. A plain local New Chat already answers 200 and logs, because its broadcast runs after the response.

Why it matters

A 500 tells the caller the create failed when it did not. The dashboard sends no slot name, so a retry mints another session each time. Which answer the caller gets is decided by a timer, so no client can be written against it.

Not a goal

  • Repairing the slots projection: a non-serializable value in slot state still breaks GET /api/chat/slots and the WebSocket snapshot, which still raise with the offender note.
  • Validating slot values when they are written.
  • The create's own response: it serializes the new slot again, and if the bad value is on that slot the response still cannot be rendered.

What changed (motivation → approach → change)

A committed create could be told it failed. The slots broadcast is coalesced: the first push after a quiet spell broadcasts at once, later ones within the window wait for a timer. A failing broadcast on the timer was logged by the event loop, but one sent at once raised into whoever pushed, here the create handler at the end of its suspend_slots_push block, after its writes were done.

The suspend_slots_push exit flush logs a failing broadcast (traceback and offender note included) instead of raising it. That block is where a create, a resume, a fork, a member thread, a channel binding and the boot restore publish once their change is made, so each of them gets the same answer on either edge, and the flush cannot hide the body's own exception. A resume and an import end with one more push after they have committed; it now goes through the same block, so neither answers 500 after it landed. This takes the catch-and-log-at-the-flush option #8745 sets out, with both timing branches converging, and so reverses the "separate, declined question" note TestDurableWriteOrdering carried.

A direct push_slots_update() still raises, so a caller that audits and retries a failed publication (source-link unlink's broadcast_failed row and its final re-publish) keeps that signal. The [slots-flush] unwinding note goes: the flush no longer raises over the body's exception.

The dashboard spec records the rule, and comments that described a raising flush in the create and resume handlers are corrected.

Backwards compatibility

Compatible: a suspend block whose exit flush raised a broadcast failure on the leading edge logs it instead, as the trailing edge always did; nothing that succeeds today is refused.
Removes nothing: the broadcast failure is still reported, with its traceback and offender note, in the log rather than to the caller; the dropped [slots-flush] note annotated a raise the exit no longer makes.

Tests

  • TestDurableWriteOrdering (both tests, renamed) asserts a leading-edge exit-flush failure answers 200 and is logged, and that the folder filing or pinned title was already on disk when the slots frame went out.
  • test_leading_edge_serialization_failure_names_the_offender asserts a direct push_slots_update() still raises the annotated TypeError, the raise source-link unlink's audit reads.
  • test_flush_failure_during_unwind_leaves_the_body_exception_unmasked asserts a body's own exception reaches the caller as raised while the broadcast failure goes to the log with its offender note.
  • test_flush_failure_on_a_clean_exit_is_logged_with_its_offender asserts a failing exit flush after a clean body is logged, not raised.
  • test_a_failing_slots_broadcast_does_not_500_a_committed_resume asserts a resume answers 200 when every broadcast fails on a leading edge, including its final push.
  • test_a_failing_exit_flush_does_not_fail_materialisation asserts materialisation completes when its exit broadcast fails; test_flush_failure_at_construction_does_not_leak_the_reservation still pins the rollback when the exit lets a BaseException through.

Proof: PROVEN test/test_chat_slot_create_folder.py::TestDurableWriteOrdering::test_the_folder_write_lands_before_a_failing_exit_broadcast, test/test_chat_slot_create_folder.py::TestDurableWriteOrdering::test_the_pinned_title_write_lands_before_a_failing_exit_broadcast, test/test_resume_publishes_hydrated_slot.py::test_a_failing_slots_broadcast_does_not_500_a_committed_resume (head b7e8b7dd7f5d)

Manual verification

N/A — unit coverage sufficient: the failure needs a non-serializable value in slot state, which the tests inject, and the HTTP tests drive the real create handler.

Screenshots / video

N/A — no frontend change.

Related Issues

Closes #8745

Sibling sweep

Swept: git grep -nF "suspend_slots_push()" -- src
Sibling: src/kiro_crew/dashboard/state_parts/slots_push.py -- changed here
Sibling: src/kiro_crew/dashboard/chat_api/slot_create.py -- changed here
Sibling: src/kiro_crew/dashboard/chat_api/resume.py -- changed here
Sibling: src/kiro_crew/dashboard/session_transfer_install.py -- changed here
Sibling: src/kiro_crew/dashboard/chat_fork.py -- not affected -- its block's exit flush is the shared one that now logs
Sibling: src/kiro_crew/dashboard/handlers/members_thread.py -- not affected -- its block's exit flush is the shared one that now logs
Sibling: src/kiro_crew/dashboard/session_control_parts/session_create.py -- not affected -- its block's exit flush is the shared one that now logs
Sibling: src/kiro_crew/dashboard/server_runtime/session_restore.py -- not affected -- its block's exit flush is the shared one that now logs
Sibling: src/kiro_crew/slack/code_channels/binding.py -- not affected -- its block's exit flush is the shared one that now logs

Pattern harvest

Not generalizable: the suspend block's exit is the one flush that publishes for a caller whose change is already made, and it is fixed there for every block; direct pushes keep raising for the callers that audit the failure.

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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 5, 2026 19:49
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 272432bed997f63059c5abeb38bb6a665aa35c5d 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 Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 272432bed997f63059c5abeb38bb6a665aa35c5d — 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

The fix is at the right level: the suspend block's exit flush, which every block shares. Its siblings are noted below but do not block.

Notes

  • Item 3 — symptom-level: the cause is that push_slots_update() raises into whatever caller hits the leading edge after its change is committed. I counted 216 direct .push_slots_update() calls across 76 files under src/kiro_crew/dashboard (for example chat_folders_routes.py 6, chat_tags.py 8, turn_stop.py 14). Many of them still 500 a committed mutation, and this PR wraps only two of them. Subtraction: none in scope here. If the general fix is made later, it replaces the with suspend_slots_push(): push_slots_update() wrappers rather than adding more of them.

What this change ships

Inventory (6 items) — 5 justified

Intent: a slot create that has already committed should not be reported to its caller as failed. This is a FIX (#8745).

  1. A committed slot create answers 200, not 500, when the leading-edge broadcast fails — justified
  2. Every suspend_slots_push block's exit (fork, member thread, channel binding, boot restore, session create) now logs a failed broadcast instead of raising it — justified
  3. A committed resume's or import's final push now goes through a suspend block, so a failed broadcast answers 200 — symptom-level, 2 of 216 direct pushes wrapped
  4. A body's own exception is no longer replaced by the flush's exception, and the [slots-flush] note is removed — justified
  5. The reversed "separate, declined question" pin is named in the description and tied to Failure semantics: a slots-broadcast exception 500s an already-committed slot create #8745 — justified
  6. The spec now records the log-at-exit rule and that a direct push still raises — justified

[FIRST-PRINCIPLES-REVIEWED] 272432b

Description read

[DESCRIPTION-READ] 5d19c2a7991bbbb5deee57c7f2b86551a0995fcfad795635da1452a901425e09

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 Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

The take-away check found no reader that breaks: no in-tree code catches a raise from the exit flush, and source-link unlink's broadcast_failed audit still gets its raise from a direct push.

Notes

  • A broadcast that fails at the block's exit is now only logged, and nothing sends that frame again. The timed (trailing) flush does retry once, so the two cases still behave differently for clients waiting on the frame.

[DESIGN-REVIEWED] 272432b

Description read

[DESCRIPTION-READ] 43aa74d8b91453b6f4c71e6632ca4d30358f6f0b67712f518b9ace25d3ce02bd

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 Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 272432b

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

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

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 272432b

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

@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 Nov 5, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) November 5, 2026 20:13
@bolichen97
bolichen97 force-pushed the fix/8745-committed-create-answers-200 branch from 9b97e2b to 40c5201 Compare November 5, 2026 23:47
@bolichen97

bolichen97 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97]
resolution: narrowed -- the catch moved from push_slots_update to the suspend_slots_push exit flush

  • span=5015c96b55ca source-link unlink lost its broadcast_failed audit and final re-publish

fixed in 40c5201: push_slots_update is back to raising a leading-edge broadcast failure, so source-link unlink's _publish sees the raise again and records broadcast_failed and keeps publication_needed for the final re-publish.
The log-not-raise rule now lives only in the suspend_slots_push exit flush, which source-link unlink never runs through; a committed resume and import route their final push through that block.
Pinned by test_leading_edge_serialization_failure_names_the_offender (a direct push raises) and test_a_failing_slots_broadcast_does_not_500_a_committed_resume; the dashboard spec line says which path logs and which raises.

@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 Nov 5, 2026
@bolichen97
bolichen97 force-pushed the fix/8745-committed-create-answers-200 branch from 40c5201 to 02b7b20 Compare November 6, 2026 02:36
@bolichen97

bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/learn-cron-dashboard.md (same file) and its docs/system-specs/modules/ directory since this head went green (b764e20 -> 7ecc6c9); CI re-running.

[operator: bolichen97]

@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 Nov 6, 2026
@bolichen97
bolichen97 force-pushed the fix/8745-committed-create-answers-200 branch from 02b7b20 to 5a93d8a Compare November 6, 2026 05:59
@bolichen97

bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/learn-cron-dashboard.md (same file) and its docs/system-specs/modules/ directory since this head went green (7ecc6c9 -> 2f20f5b); the new base also carries #30984, which fixes the server lazy-import count pin that failed Backend Tests shard 6 on main. The commit itself is unchanged (range-diff =). CI re-running.

[operator: bolichen97]

@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 Nov 6, 2026
A slot create that had already committed answered 500 when the slots
broadcast after it failed on the coalescing window's leading edge,
while inside the window the same failure was only logged and the
create answered 200. The caller's answer was decided by a timer.

suspend_slots_push now logs a failing exit flush instead of raising
it, so every block's caller is answered as when the trailing timer
carries the failure, and the flush cannot hide the body's own
exception. A committed resume or import publishes its final push
through such a block, so neither turns into a 500 after it landed.
A direct push_slots_update() still raises, so callers that audit and
retry a failed publication keep that signal.

Closes #8745
@bolichen97
bolichen97 force-pushed the fix/8745-committed-create-answers-200 branch from 5a93d8a to 272432b Compare November 6, 2026 09:14
@bolichen97

bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/dashboard/chat_api/resume.py, src/kiro_crew/dashboard/state_parts/slots_push.py and docs/system-specs/modules/learn-cron-dashboard.md (same files) since this head went green (2f20f5b -> 4d208a0). The commit itself is unchanged (range-diff =). The GPT 6.1 and Opus 5.5 lanes on the previous head stopped on a CI rate limit before posting a verdict; this push re-runs them. CI re-running.

[operator: bolichen97]

@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 Nov 6, 2026

@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.

Approved by Crew Captain for the on-call: checks green, PR Readiness passed, review lanes clean on this head.

@bolichen97
bolichen97 merged commit 31aa5b1 into main Nov 6, 2026
98 checks passed
@bolichen97
bolichen97 deleted the fix/8745-committed-create-answers-200 branch November 6, 2026 10:11
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 6, 2026
buluoray added a commit that referenced this pull request Nov 8, 2026
…te (#30730)

A slot create that had already committed answered 500 when the slots
broadcast after it failed on the coalescing window's leading edge,
while inside the window the same failure was only logged and the
create answered 200. The caller's answer was decided by a timer.

suspend_slots_push now logs a failing exit flush instead of raising
it, so every block's caller is answered as when the trailing timer
carries the failure, and the flush cannot hide the body's own
exception. A committed resume or import publishes its final push
through such a block, so neither turns into a 500 after it landed.
A direct push_slots_update() still raises, so callers that audit and
retry a failed publication keep that signal.

Closes #8745

(cherry picked from commit 31aa5b1)
Original author: Bolin Chen
buluoray added a commit that referenced this pull request Nov 8, 2026
…te (#30730)

A slot create that had already committed answered 500 when the slots
broadcast after it failed on the coalescing window's leading edge,
while inside the window the same failure was only logged and the
create answered 200. The caller's answer was decided by a timer.

suspend_slots_push now logs a failing exit flush instead of raising
it, so every block's caller is answered as when the trailing timer
carries the failure, and the flush cannot hide the body's own
exception. A committed resume or import publishes its final push
through such a block, so neither turns into a 500 after it landed.
A direct push_slots_update() still raises, so callers that audit and
retry a failed publication keep that signal.

Closes #8745

(cherry picked from commit 31aa5b1)
Original author: Bolin Chen
buluoray added a commit that referenced this pull request Nov 8, 2026
…te (#30730)

A slot create that had already committed answered 500 when the slots
broadcast after it failed on the coalescing window's leading edge,
while inside the window the same failure was only logged and the
create answered 200. The caller's answer was decided by a timer.

suspend_slots_push now logs a failing exit flush instead of raising
it, so every block's caller is answered as when the trailing timer
carries the failure, and the flush cannot hide the body's own
exception. A committed resume or import publishes its final push
through such a block, so neither turns into a 500 after it landed.
A direct push_slots_update() still raises, so callers that audit and
retry a failed publication keep that signal.

Closes #8745

(cherry picked from commit 31aa5b1)
Original author: Bolin Chen
buluoray added a commit that referenced this pull request Nov 8, 2026
…te (#30730)

A slot create that had already committed answered 500 when the slots
broadcast after it failed on the coalescing window's leading edge,
while inside the window the same failure was only logged and the
create answered 200. The caller's answer was decided by a timer.

suspend_slots_push now logs a failing exit flush instead of raising
it, so every block's caller is answered as when the trailing timer
carries the failure, and the flush cannot hide the body's own
exception. A committed resume or import publishes its final push
through such a block, so neither turns into a 500 after it landed.
A direct push_slots_update() still raises, so callers that audit and
retry a failed publication keep that signal.

Closes #8745

(cherry picked from commit 31aa5b1)
Original author: Bolin Chen
buluoray added a commit that referenced this pull request Nov 8, 2026
…te (#30730)

A slot create that had already committed answered 500 when the slots
broadcast after it failed on the coalescing window's leading edge,
while inside the window the same failure was only logged and the
create answered 200. The caller's answer was decided by a timer.

suspend_slots_push now logs a failing exit flush instead of raising
it, so every block's caller is answered as when the trailing timer
carries the failure, and the flush cannot hide the body's own
exception. A committed resume or import publishes its final push
through such a block, so neither turns into a 500 after it landed.
A direct push_slots_update() still raises, so callers that audit and
retry a failed publication keep that signal.

Closes #8745

(cherry picked from commit 31aa5b1)
Original author: Bolin Chen
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.

Failure semantics: a slots-broadcast exception 500s an already-committed slot create

2 participants