Repository navigation
perf(dashboard): return new chat before full slot broadcast - #13499
Conversation
|
Intent: Return an ordinary local New Chat before serializing the full slot list, while preserving synchronous publication for paths whose durability or failure contract depends on it. |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS
Not justified as shipped
What this change shipsInventory (8 items) — 7 justifiedIntent: make New Chat's response return before the O(N) full slot-list broadcast (measured 17.6→9.7 ms median at 55 sessions, issue #13498) — a FIX of a measured cost.
[FIRST-PRINCIPLES-REVIEWED] dba3087 |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify in a two-window session that rapid plain creates show no flicker in the non-creating window during the 10 ms handoff. [DESIGN-REVIEWED] dba3087 |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
4042fc9 to
f139558
Compare
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
|
self-added: yes
|
|
f139558 to
6993504
Compare
|
chore (non-blocking): retrigger incomplete Opus review Opus 5 Review on |
Defer the coalesced full-sidebar snapshot by 10 ms only after a successful ordinary local chat creation. Keep metadata-bearing, app-owned, mode-specific, remote, and error paths synchronous.
6993504 to
dba3087
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed as part of a full sweep of open PRs targeting main (2026-09-26 06:40Z).
Verified on the current head: readiness: passed label present; the sole required status check (PR Readiness, per ruleset 20088190) is green; no pending, failing or cancelled required check; mergeable; no live CHANGES_REQUESTED; and no unresolved blocking change request in any review thread (every remaining review-lane comment on this head is PASS or advisory-only, and any earlier finding is either answered by the author or pinned to a superseded head).
Approving on that basis and enabling GitHub native auto-merge. No admin override, no bypass of branch protection — this still waits for every required check and for code-owner review.
Problem / Motivation
Creating an empty dashboard chat waits for the gateway to serialize and broadcast every open slot before returning the new slot. The requesting tab already inserts the POST response into local state, so this O(N) work delays first paint without helping that tab.
Why it matters
The delay grows with the number of open sessions. At 55 starting sessions, the original two-stage profile measured a 34.8 ms median handler time and 741 ms of handler CPU across 20 creates. The single-pass projection change from #12711 reduced the median to 17.6 ms. Moving the ordinary create broadcast after the response reduced it to 9.7 ms and 101 ms of handler CPU across 20 creates.
What changed (motivation → approach → change)
src/kiro_crew/dashboard/, ordinary local New ChatDashboardState.suspend_slots_push()yields an operation-only callback with a state-owned 10 ms delay. Existing callers ignore it and remain synchronous. A successful handoff cancels an armed trailing timer before the delay starts. The callback repeats that cancellation before publishing and starts the normal coalescing window. It transfers publication debt to any active suspension, while an overlap forces synchronous publication at depth zero. Failures log the slot name and retry once.api_chat_slot_create()defers only a new local persistent-memory create whose body uses the known create keys and carries no folder, title, artifact, or mode metadata. New request keys fail closed to synchronous publication. The owning dashboard system specification records this ordering exception and the synchronous compatibility paths.Backwards compatibility
Compatible: request and response shapes are unchanged, and all metadata-bearing, remote, app-owned, mode-specific, ephemeral, and error paths keep synchronous publication.
Tests
test/test_chat_slot_create_folder.pyproves that the ordinary response precedes exactly one complete slot-list snapshot. The existing folder, pinned-title, ownership, and durable-write tests continue to pin synchronous ordering where it is required.Focused validation covers 28 create-ordering tests and 91 broadcast-state tests. The green-age overlap suite adds 147 member-context tests.
Manual verification
The isolated aiohttp handler profile used 55 starting sessions, one owner WebSocket, and 20 measured creates. Median latency fell from 34.8 ms at baseline to 17.6 ms after the single-pass projection change and 9.7 ms after the deferred ordinary-create broadcast.
Related Issues
Fixes #13498
Pattern harvest
Rule candidate: review-prompt
Pattern: A create endpoint should not synchronously serialize an O(N) collection after its response already contains the created entity, unless that serialization is part of the endpoint's durability or failure contract.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)