Repository navigation
fix: flag a chat embed whose poll keeps failing as stale - #19899
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that a cut-off reply shown as a finished [DESIGN-REVIEWED] 05ed432 Description read[DESCRIPTION-READ] f7ef1107712b84029a190dc644b808b4bde0de85289c7f9106f7e6d277a0fb41 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check that the back-off (up to 30 s between reads) stays inside the frozen Goal. Its only support is the "adds load" sentence under Why it matters. What this change shipsInventory (9 items) — 9 justifiedIntent: a chat embed whose session is gone should stop reading as live and offer a way to reconnect. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 05ed432 Description read[DESCRIPTION-READ] 58e6ee056920e542ebe1080d1b5f7d3a97d843be048e9db34b2520749719b2b5 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS Clicking Reconnect shows almost no feedback: the blind reader could not tell the in-flight state from the idle one, and was only guessing at what Reconnect does. Watch
Suggestions
[UX-REVIEWED] 05ed432 Description read[DESCRIPTION-READ] a6ef5190ba642538070965b86ff9ca073ad2e6afeb70f3d961c4259ab52d17b8 That sha256 names everything this verdict read: the PR description, plus the 8 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 |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: dispositions for the review round on Opus 5.5 (never-succeeded key) and Design (hidden tab returning) — fixed. Both are the same defect: the outage was UX — caret: fixed. While stalled, the tail UX — "Retry" reads as a resend: fixed. The button now reads "Reconnect" (new key UX suggestion — "session" → "chat": taken. "Lost connection to this chat. Showing its last update." UX — composer while disconnected: not taken here. What a send does when it fails, including keeping the draft, is a separate ChatEmbed item handled in its own PR. Disabling send on a stall would also block the one action that can succeed once the gateway is back before the next poll. Sensitive Change Review on |
93d70ef to
9607a2d
Compare
CrysisDeu
left a comment
There was a problem hiding this comment.
Reviewed head 9607a2d. Outage measured from first failure of the run, back-off to 30 s, no new timers (React Query owns the interval), no boundary leak, tests cover threshold/back-off/caret/Reconnect. CI green. Approving.
Please fix:
ChatEmbed.tsx:112-114: JSDoc onEMBED_STALL_MSsays "measured from its last success"; the code and your own PR body say first-failure. Stale comment contradicts the design it guards.ChatEmbed.tsx:456-462: Reconnect gives no pending state (void refetch());isFetchingis already in scope.disabled={isFetching}plusaria-busyis enough. UX lane raised this and it is unaddressed.- 401/403/404 collapse into "Lost connection" with a Reconnect that can never succeed, and the poll runs forever at 30 s against a gone session. You declared it a non-goal; I accept that for this PR, but
ScopedApiError.statusis right there, so please file the follow-up.
Posted by code-reviewer (Kiro Crew member) on behalf of @CrysisDeu. Full report on file.
|
This PR fixes the root cause of a ChatEmbed that shows "streaming" forever after its session is lost: the poll's error was ignored once a page was on screen. A shown page whose poll has failed for 10 s now gets |
9607a2d to
a83e921
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: fixed on a83e921.
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: rebutted on a83e921.
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: fixed on a83e921.
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: rebutted on a83e921.
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: corrective round published at a83e921. CrysisDeu’s requests: the outage JSDoc now says first failure; Reconnect is disabled and aria-busy during its read; the 401/403/404 recovery follow-up is #20216 and is linked in the description. No authentication policy or permission boundary changed. First Principles PASS punchline: the per-key failure-run record is needed to avoid flagging one dropped read after a hidden-tab gap or a never-succeeded key as a long outage, as the prior blocking round established. Back-off also bounds repeated failed reads: the 60-second fake-clock test makes fewer than 20 reads rather than the roughly 60 one-second reads. This is request-count evidence, not a measured gateway CPU claim; removing the record would restore the false-stall bug. Design, GPT and Opus on the previous head had no remaining findings. Every UX span has its own current-head disposition above. New-head lanes still need to run. This was not conflict-only: it preserves main’s Composer/optimism changes and fixes the requested reconnect feedback plus offline dot. Parent verified 14 targeted tests, typecheck, eslint, 53 flake-ratchet tests, four sequential reddening mutations, and real-component pending/failed/recovered captures at 720/360/320px. The broader five optimisticSend failures are a delegate-reported main-baseline match, not claimed clean locally. The push invalidated the old head’s review; GitHub now reports the prior approval DISMISSED. I did not dismiss any review, approve, merge, or enable auto-merge. Re-requesting CrysisDeu for the new head. |
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: current-head CI classification, a83e921. Frontend Tests (2) failed on exactly the five ChatEmbed.optimisticSend tests mentioned in the description. I have now independently reproduced all five in a fresh, clean detached worktree at the exact main base 30bb0b3: 7 passed, 5 failed. The test file is absent from this PR diff. Three cases still ask for Send message on a busy slot; the other two concern queued receipts and refused-send tails. This upgrades the earlier delegate-reported comparison to a parent-verified base failure. I am not modifying unrelated base tests here. GPT, Opus, Design, UX and First Principles all failed to read PR data under the shared installation API rate limit; none completed a new-head verdict. Readiness and Sensitive Change Review also failed API reads. Dependency License Gate reported dependency review unavailable, with no dependency files changed here. No rerun budget has been spent. Each infrastructure run will get at most one rerun, no sooner than 30 minutes after its failure. No code push will be made merely to restart these checks. |
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: the main failure has an existing owner and fix: @bolichen97, #20212 at 707462b (issues #20206 and #20211). I independently ran that exact tree: all 12 optimisticSend tests pass, with production code unchanged from main. On pristine main, the two idle-slot cases also pass when run alone. The three busy-slot cases look up Send message while ComposerSend correctly names the control Queue message. Those cases throw before consuming the queued q1/q2 one-shot mock responses; clearAllMocks does not clear those responses, so they contaminate the later queued-receipt and refused-send tests. The existing fix changes the helper and busy-slot calls only, keeping all row/card assertions. The verified merge order was #20102 at 07:58:04Z, then #19881 at 07:58:18Z. This is an independent cross-merge test mismatch, not a defect introduced by #19899. I made no edits to those tests or production behavior and opened no competing PR. This branch will need the main fix once it lands. |
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: current-head disposition.
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: current-head disposition.
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: current-head disposition.
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: current-head disposition.
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: current-head disposition.
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19899]: Design PASS question verified on 4aeb7b4. I temporarily wrapped the mounted real ChatEmbed in React.StrictMode and ran the stalled-poll file: all 14 tests passed, including the threshold, first-failure/hidden-tab, back-off, reconnect and optimistic-row cases. The test wrapper was restored afterward and git status is clean. Source explanation: for an error snapshot with the same dataUpdatedAt, embedOutageMs retains the existing since timestamp; repeated error renders do not restart that failure run. A successful status deliberately clears it. This check did not add production code or claim that every concurrent React scheduling case was exercised. The new First Principles round calls the caret display change justified, but that bot statement is not Ray authorization. The frozen non-goal mismatch remains with the owner; scope wording and projection remain untouched. The projection changes only the displayed row role, never backend work. |
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#it_e2b9fdd2]: Scope change authorized by the PR owner (Ray, 2026-10-14 15:11Z). The previous "Not a goal" line excluded the live caret on a
No code was pushed; the head stays 4aeb7b4. |
mbriones98
left a comment
There was a problem hiding this comment.
Checks green and PR Readiness passed at 4aeb7b4; non-feature change.
4aeb7b4 to
05ed432
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved after a maintainer read the review lanes on this head. The one open note (feedback while Reconnect is in flight) is follow-up polish, not a blocker.
Problem / Motivation
Goal: A chat embed that has lost its session stops claiming the agent is still running and tells the user the connection is lost, with a retry.
ChatEmbedonly reported a failed read when nothing was on screen yet (loadFailed = isError && shown == null). Once a page was shown, every later poll error was silent. After a gateway restart, a deleted session or lost access, the embed kept its last snapshot. If that snapshot saidrunning: true, the header's green dot and "streaming" stayed lit forever, the composer kept saying "Agent is working...", and the poll kept hitting the failing endpoint every second.Why it matters
Every app that mounts
ChatEmbedshows a session that looks alive while it is dead. The user waits on a reply that will never come, with no sign anything is wrong and no way to recover short of reloading the page. The 1-second poll against a dead endpoint also adds load on a gateway that is just coming back up.Not a goal
ChatMessageListor the main chat's live caret. Only ChatEmbed, while its poll is stalled, renders its laststreamingrow as a settled row so the stale reply loses its caret; this is display-only and does not stop or cancel the backend turn (scope change authorized by the owner, 2026-10-14).What changed (motivation → approach → change)
Symptom: a stale running snapshot reads as live forever. Root cause: the poll's error state is ignored whenever a page is shown, and the poll cadence ignores errors.
embedPollInterval(new, exported): healthy polls keep the 1 s running / 5 s idle cadence. A failing poll keeps that cadence until the outage reachesEMBED_STALL_MS(10 s) so the stall is noticed on time, then waits as long as the outage has lasted, capped atEMBED_STALL_POLL_MAX_MS(30 s).embedOutageMs(new, exported): the outage is timed from the FIRST failure of the current run of failed reads, per query key, and resets on success. Timing it from the last success would read one dropped request as a long outage for a key that never succeeded (dataUpdatedAtis 0) and for a tab returning from hidden (the poll pauses there). The cadence and the stall notice share this one measure.stalled: a page is shown, the poll is in error, it is not a failed widen, and the outage is at leastEMBED_STALL_MS. A single failed poll stays silent.runningis forced to false, so the header dot, "streaming", the working footer and the "Agent is working..." placeholder all drop. A tailstreamingrow is handed to the list as a settledassistantrow, so a half-written reply loses its live caret.ErrorNotice("Lost connection to this chat. Showing its last update.") with a Reconnect button renders above the composer. The first successful read clears it. No hand-off, because the composer draft is unsaved local state.appSdk.chatEmbed.connection_lostandappSdk.chatEmbed.reconnectin all 12 catalogs (+ regenerateden-XA).docs/app-kit/api-reference.mddocuments the poll cadence, the stall window and the back-off.website/capture/embed-stalled-poll.*+website/scripts/capture-embed-stalled-poll.mjs: the gateway-free capture used for the screenshots below.Backwards compatibility
Compatible: no prop, endpoint or payload changes; a healthy embed polls exactly as before.
Removes nothing: the change only adds a notice and a back-off on a failing poll; every existing notice, prop and cadence stays.
Tests
Published tree
4aeb7b42abd72c642c070a598c59b8620ca28151, rebased on85457980aa8c8f7a8491cfc90005fcce88fb9304after #20212 merged. This latest rebase is patch-equivalent (range-diff=), without conflicts or additional behavior changes. The rebase preserves the shared Composer, optimistic send rows, queue cards and send-tail recovery. This round also fixes the first-failure JSDoc, disables/marks Reconnect busy during a read, re-announces the notice after a failed manual read, and mutes the stale header dot. These are corrective changes, not a conflict-only rebase.Parent verified: 14 tests in
ChatEmbed.stalledPoll.test.tsx;npx tsc -p tsconfig.app.json --noEmit; targeted eslint; 53test_flake_pattern_ratchet.pytests. No full suite.Four mutations, run separately with the file restored and a clean status between them:
marks Reconnect busy while its read is in flightfails.announces the notice again when a Reconnect read failsfails. This proves DOM alert remounting, not a physical screen-reader run.mutes the header dot while stalled instead of showing it idlefails.drops the live caret: a stale half-written reply renders as settledandkeeps an optimistic send after the settled stale reply, and sending stays enabledfail.All 14 tests pass after restoration. After rebasing onto the merged #20212 main fix, the parent ran all 10 ChatEmbed test files: 122 passed, zero failures. The five previously inherited optimisticSend failures are resolved by that main test-only fix, not by changes to this PR. Typecheck and targeted eslint pass on this published revision.
Manual verification
The real ChatEmbed and shared Composer run in Chromium via the checked-in gateway-free capture entry. The first scoped read succeeds and later reads return 503. At the stale notice, each capture had made 12 reads and no longer showed streaming. The capture holds the manual read to verify disabled + aria-busy, releases a 503 to verify retry becomes available with the notice intact, then returns success and verifies the notice disappears and streaming resumes. Dark/light 720px, dark 360px, light 320px all pass. No authentication or network exposure change; preview binds loopback only.
Screenshots / video
Fresh real-component captures from published tree
4aeb7b42abd72c642c070a598c59b8620ca28151. The pending button is disabled and dimmed; a failed read re-enables it while retaining the notice. The pending-label polish is held pending the scope decision, not claimed fixed.Related Issues
Found in a ChatEmbed audit. Follow-up for status-specific recovery: #20216 (401/403/404), requested by CrysisDeu; intentionally outside this PR’s frozen goal.
Pattern harvest
Rule candidate: review-prompt
Pattern: a polled React Query view that hides
isErroronce it has data, so a stalerunning/live flag outlives the source and the poll never backs off.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.