Skip to content

fix(chat): keep a failed phone update item and harness mark in place - #36537

Merged
bolichen97 merged 1 commit into
mainfrom
fix/33603-lazy-retry-rest
Nov 17, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/33603-lazy-retry-rest

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When the phone menu's update item or the composer's harness mark fails to load its code, the failure stays inside that control and the rest of the chat page keeps working, and the phone menu offers a Try Again that asks for the code again.

Two chat-page parts listed in #33603 still kept a module-level React.lazy() after #35043:

  • The composer's harness mark (the small logo on the model chip, drawn when a session runs on another harness than the install's). It sat inside the chip's button behind only a Suspense. When its chunk failed, the chat route's error card ("Something went wrong / Failed to fetch dynamically imported module: …/HarnessLogo-….js") replaced the whole chat page: the sessions sidebar, the transcript and the composer.
  • The phone menu's update item. Its own boundary showed "Couldn't load the update entry." and an "Ask the agent" item, but no Try Again. lazy() caches a rejected import, so the only way to load it again was a page reload.

Why it matters

A chat kept open across an upgrade or on a flaky network can lose the whole chat page, composer included, because the small harness mark on the model chip could not load. On a phone, a failed update item says so but has no way to load it again short of reloading the page.

Not a goal

What changed (motivation → approach → change)

A failed harness mark now leaves a blank mark on a chip that still works, and a failed phone update item now offers Try Again and Reload page as menu items.

Part When its code failed Now
Composer harness mark (chat-input/ContextShelf.tsx) The route error card replaced the whole chat page, composer included The chip keeps its 13px placeholder and still opens the model picker. The boundary still journals the failure
Phone menu update item (pages/chat/page/MobileTopBar.tsx) A notice and "Ask the agent", no retry The notice, then Try Again, Reload page and Ask the agent as menu items

Cause: both parts kept a plain module-level lazy(). The harness mark had nothing between it and the route boundary, and the update item's boundary could not retry, because lazy() caches a rejected import. lazyRetry (components/lazyRetry.tsx) gains a menu layout for a part inside a Radix dropdown menu. It renders the passive inline notice (its id from useId()), then Try Again and Reload page as DropdownMenuItems using the existing components.errorBoundary.* strings, then, unless askAgent: false, an ErrorNoticeMenuItem hand-off described by the notice. A menu's roving focus reaches items, never a button nested in one. Try Again takes the same path as the other layouts (a new lazy() and a remounted boundary). It calls preventDefault() so the menu stays open and the part loads in place. After the retry commits, focus moves to the menu: focused any earlier, the menu's roving focus handed it straight back to the unmounting Try Again, and in Chromium focus ended up on <body>. The update item now uses lazyRetry(…, { layout: 'menu', … }), and its hand-written boundary is gone. The harness mark gets a local ErrorBoundary (composer-harness-mark) whose fallback is the placeholder the Suspense already used. It shows no notice: the mark is decorative, sits inside a button that cannot hold Try Again or Reload, and the chip's label already names the harness. The Routing paragraph of learn-cron-dashboard.md now describes both.

Backwards compatibility

Compatible: lazyRetry's existing layouts render exactly as before. menu is a new value, and both changed parts render the same component when their chunk loads.

Removes nothing: the update item's notice and hand-off are still there, with two more menu items beside them, and the harness mark still renders when its chunk loads.

Tests

  • website/src/test/chatLazyParts.lazyRetry.test.ts: the static check now expects no module under pages/chat/ on a plain lazy(), with the KNOWN_PLAIN exception for MobileTopBar.tsx removed. Red on the base (expected [ Array(1) ] to deeply equal []).
  • website/src/test/lazyRetry.menu.test.tsx (new): in an open DropdownMenu, a part whose first import rejects shows the notice, Try Again and Reload page as menu items, and the hand-off with aria-describedby set to the notice's id, with no nested button. askAgent: false drops the hand-off. Try Again keeps the menu open, imports again (2 imports) and renders the part, with focus still in the menu. Red on the base (3 of 3: Unable to find role="menuitem" and name "Try Again"). Without the preventDefault() the third test fails (the menu closes, so the part never renders). jsdom does not reproduce the focus drop to <body>; the Chromium smoke below covers that.
  • website/src/test/ChatInput.harnessChipLoadFailure.test.tsx (new): a HarnessLogo import that rejects leaves composer-model-chip rendered and clickable, with the 13px placeholder in composer-model-chip-harness, and the boundary above it untouched. Red on the base (the failure stays inside the chip: expected <div …(1)></div> to be null).

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

Determinism: the three files above plus ChatInput.harnessChip.test.tsx and lazyRetry.askAgent.test.tsx passed 20 runs in a row (20/20) and once with --sequence.shuffle --sequence.seed=33603.

Manual verification

Run on Ubuntu 24.04.5 LTS (Linux 7.0.0, x86_64) with Chromium 145 through Playwright 1.58.2. The gateway was isolated (KIROCREW_HOME=$(mktemp -d), kirocrew gateway --port auto --seed minimal --no-tunnel --no-crons, 127.0.0.1) and served the SPA from npm run build. Each context blocked service workers, which otherwise serve the chunk past page.route, and set sessionStorage['vite-preload-reload-count']='3' to spend main.tsx's reload guard. For the harness mark, /api/chat/slots/*/selection-capabilities was answered with models_backend: "claude" added: a session on a second, signed-in harness cannot be started on this host, and that field is the only thing the chip reads to draw the mark.

Base build, chunk aborted:

[base] harness: blocked=["HarnessLogo-YPf9Va39.js"]
[base] harness: composer-model-chip count=0
[base] harness: sessions sidebar "Sessions" visible=false
[base] phone: menu items=["Ask the agent","Pop out to window","Open activity panel"]
[base] phone: alerts in menu=["Couldn't load the update entry. Check for updates in Settings."]

Fixed build, same steps:

[fix] harness: blocked=["HarnessLogo-C6LNRxFh.js"]
[fix] harness: composer-model-chip count=1
[fix] harness: composer-model-chip-harness html=<span class="inline-block w-[13px] h-[13px]" aria-hidden="true"></span>
[fix] harness: sessions sidebar "Sessions" visible=true
[fix] harness: after chip click, dialogs=1 listboxes=1
[fix] phone: menu items=["Try Again","Reload page","Ask the agent","Pop out to window","Open activity panel"]
[fix] phone: buttons in menu=0

Try Again after un-blocking the chunk:

[fix] after un-block + Try Again (Enter): chunk requests=[] preloadError events=2 menu open=1 items=["Try Again","Reload page","Ask the agent","Pop out to window","Open activity panel"]
[fix] focus after Try Again: DIV role=menuitem text=Pop out to window

What was observed: with the reload guard spent, Try Again runs import() again and fires vite:preloadError. Chromium sends no new request, because it keeps the failed module record until the page reloads, so the failure shows again with the menu still open and focus on a live menu item, and Reload page is the way out. No update is pending on this host, so the loaded item draws nothing.

Happy path, nothing blocked: the harness mark renders on the chip (harness-logo-claude, chip Runs on Claude Code · Model: auto · Reasoning effort: Default), and the phone menu opens with its usual items and no notice.

Related checks on the same tree: npx tsc -p tsconfig.app.json --noEmit exit 0; the five test files under Tests passed once, 5 more times in a row, and once with --sequence.shuffle --sequence.seed=33603.

Screenshots / video

Harness mark, base: the HarnessLogo chunk aborted, and the route's error card replaces the whole chat page.

Base: the route error card in place of the chat page

Harness mark, this PR: the same failure keeps the chat page and the composer; the model chip shows a blank mark before "auto".

Fix: chat page and composer kept, blank mark on the model chip

Phone menu, base (390x844): the UpdatePill chunk aborted, the notice and Ask the agent with no retry.

Base: phone menu with the notice and no retry

Phone menu, this PR: the notice, then Try Again, Reload page and Ask the agent as menu items.

Fix: phone menu with Try Again, Reload page and Ask the agent

After Try Again, and the happy path

After un-blocking the chunk and Try Again with the reload guard spent: the menu stays open.

Fix: menu still open after Try Again

Nothing blocked: the harness mark on the chip, and the phone menu as before.

Fix: harness mark rendered on the chip

Fix: phone menu with nothing blocked

Related Issues

Part of #33603

Sibling sweep

Swept: git grep -nE "\blazy(" -- website/src/pages/chat website/src/components/chat-input website/src/components/mobileConnect.tsx website/src/pierre website/src/components/PreviewTabBody.tsx
Sibling: website/src/components/chat-input/ContextShelf.tsx:18 -- changed here
Sibling: website/src/pages/chat/page/MobileTopBar.tsx -- changed here
Sibling: website/src/components/mobileConnect.tsx:11 -- tracked in #33603
Sibling: website/src/pierre/index.tsx:28 -- tracked in #33603
Sibling: website/src/pierre/tree.tsx:8 -- tracked in #33603
Sibling: website/src/components/chat-input/engine.tsx:8 -- not affected -- ComposerLoadBoundary falls back to the textarea with the draft kept

Pattern harvest

Rule candidate: lint
Pattern: a module-level React.lazy() component rendered with only a Suspense above it and no ErrorBoundary of its own between it and the route; chatLazyParts.lazyRetry.test.ts already enforces this for pages/chat/, and the same static check could cover components/chat-input/.

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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design-level concerns. Both failures now stay inside their own control, the menu layout reuses lazyRetry's retry path instead of adding a second one, and the screenshots cover the reshaped phone menu.

Notes

  • The phone menu's "Ask the agent" item now sends the raw import error (error.message) where it used to send the translated "Couldn't load the update entry." text. Check that this change to what the agent receives is intended.

[DESIGN-REVIEWED] 90e2b97

Description read

[DESCRIPTION-READ] 0a72aa7463dfd224430d395d5557818419f3d6e12dec630c7fcc2c71d76c4c19

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 90e2b9751baece296f7c85586b7b433a71696575 — 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. Both parts fix the cause named in #33603, a plain module-level lazy(), and they reuse the existing lazyRetry and ErrorBoundary instead of adding new ones.

Inventory (8 items) — 6 justified

Intent: a failed code chunk for the phone update item or the harness mark stays inside that control and can be loaded again, without losing the chat page — FIX.

  1. If the harness mark's chunk fails, the chip keeps a blank mark and still works, instead of the whole chat page being replaced — justified
  2. A failed phone update item now offers Try Again as a menu item — justified
  3. A failed phone update item also offers Reload page — rides along (harmless; the other lazyRetry layouts already offer it)
  4. The update item's failure notice now uses the title form and passes the raw error to screen readers only — undeclared
  5. Try Again keeps the menu open, loads the item in place, and puts focus back in the menu — justified
  6. lazyRetry gains a menu layout value (the update item is its only user today) — justified
  7. The static check no longer allows MobileTopBar.tsx as an exception to the plain-lazy() rule — justified
  8. The Routing paragraph of learn-cron-dashboard.md describes both new behaviours — justified

[FIRST-PRINCIPLES-REVIEWED] 90e2b97

Description read

[DESCRIPTION-READ] 9c15696bbcc3c1df1c46df7b86209f0fd6962e296eb6f2b7a289a794b4d6b022

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing blocks. The screenshots show both failure states. The blind reader understood the new Try Again and Reload page items and said it would use them.

Notes

  • The failed-state phone menu runs past the right edge of the screen (shot-03/04/05). The reader wrote: "full width and runs off the right edge… feels like two different menus" compared with the normal menu in shot-07. Wrap the notice inside the menu's normal width, for example with whitespace-normal and a max-w on the menu layout's ErrorNotice.
  • The reader "can't tell the difference" between Try Again and Reload page. Your own Chromium log also shows Try Again making no new chunk request once the reload guard is spent, so the user sees nothing happen. Consider naming the object in the label, e.g. "Try loading again".
  • "Couldn't load the update entry" uses "update entry", which the reader didn't recognise ("I don't know what an 'update entry' is"). Name the thing the user knows instead, e.g. "Couldn't load the app update check. Check for updates in Settings."

[UX-REVIEWED] 90e2b97

Description read

[DESCRIPTION-READ] c9fa4b361e220e551553a522f71158523203e6dbca734f821e63b57f0be58bc8

That sha256 names everything this verdict read: the PR description, plus the 10 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 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 90e2b97

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

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

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 90e2b97

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

@bolichen97
bolichen97 enabled auto-merge (squash) November 13, 2026 09:50
@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 13, 2026
@bolichen97

bolichen97 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=9b0949fe2799 Surface the caught harness-mark load failure

Rebutted: disproportional, and outside this PR's goal. The mark is decorative (HarnessLogo is aria-hidden, HarnessLogo.tsx:44). The chip that holds it keeps its title and aria-label naming the harness (ContextShelf.tsx:494-527) and still opens the model picker, so nothing the user asked for failed to load: only a 13px glyph is blank, and the chat page stays usable.
The fix asked for adds a visible error notice outside the chip in the composer row, plus a new catalog string in every locale, for that glyph. The frozen goal keeps the failure inside that control; a notice beside the chip is a placement the goal does not include, and #33603 does not need it.
The failure is not discarded: the boundary's componentDidCatch journals it through recordError (scope composer-harness-mark) and sends the react_error event, as every ErrorBoundary does.
Main already treats a decorative part this way: the theme's aria-hidden top-bar decoration sits in <ErrorBoundary scope="theme-topbar" fallback={null}> (website/src/shell/topbar/shellHeader.tsx:472).
Before this PR the same failure replaced the whole chat page. Design, First Principles and UX passed the boundary with the blank-mark screenshot, and this lane's own adjudication rated the harm low and upheld it only for the rule's blocking flag.
[operator: bolichen97]

@KiroCrewCaptain

KiroCrewCaptain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier pending: being reviewed.

The harness mark now has its own ErrorBoundary, with the existing 13px placeholder as its fallback, so a failed chunk no longer reaches the route boundary. lazyRetry gains a menu layout: the notice, then Try Again (preventDefault keeps the menu open, then it takes the same retry path as the other layouts), Reload page and the hand-off as DropdownMenuItems. The existing layouts are unchanged apart from pulling the shared retry handler out into retry(). The phone update item uses the new layout, and its old boundary is gone. Nothing else referenced the old notice id; the journal scope and i18n key are unchanged, and the loading fallback is still null. The KNOWN_PLAIN exception is removed and the spec paragraph updated. New tests would fail on the base. CI is green and every AI review lane passed.

Tier: pending: being reviewed.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 90e2b9751b · 290 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 4093547 not-applicable: agent: the harness mark is a decorative aria-hidden glyph; the chip still names the harness in its title and aria-label and opens the picker, and the boundary journals the failure. A notice beside the chip plus a string in every locale is scope #33603 does not need.

[operator: bolichen97]

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@bolichen97 recorded a not-applicable release (class not-applicable) for the gpt AI finding on 40935473210b64070aae27508554be9550d2c990.

agent: the harness mark is a decorative aria-hidden glyph; the chip still names the harness in its title and aria-label and opens the picker, and the boundary journals the failure. A notice beside the chip plus a string in every locale is scope #33603 does not need.

This decision applies only to this commit. A new push requires a new judgment.

The phone menu's update item was still a plain module-level lazy(). Its
own boundary showed a notice and the agent hand-off but no retry, and
because lazy() caches a rejected import, nothing short of a page reload
could load it again. lazyRetry gains a `menu` layout for a part inside a
Radix dropdown menu: the passive notice, then Try Again, Reload page and
the hand-off as menu items. Try Again keeps the menu open, builds a new
lazy() and remounts the boundary, then moves focus to the menu once the
old item has unmounted. The update item now uses it, which leaves
chatLazyParts.lazyRetry.test.ts with no exception.

The composer's harness mark is a lazy chunk inside the model chip's
button, wrapped only in Suspense, so a failed load reached the route
boundary and replaced the whole chat page, composer included. A local
boundary now keeps the same 13px placeholder and the failure is still
journaled. It shows no notice: the mark is decorative, sits inside a
button, and the chip's label already names the harness.

Part of #33603.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bolichen97
bolichen97 force-pushed the fix/33603-lazy-retry-rest branch from 4093547 to 90e2b97 Compare November 17, 2026 20:23
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/learn-cron-dashboard.md, website/src/components/chat-input/ContextShelf.tsx and website/src/pages/chat/page/MobileTopBar.tsx since this head went green (2f7e9f2 -> 654781f); CI re-running.

The previous head's one red, Source Gates (with Await Fast Gate and Coverage Gate behind it), was main's own docs-lint failure, fixed on main by #36504. The rebased tree passes ./scripts/docs-lint.sh. The patch itself is unchanged (identical patch-id), and the rebase was clean.

[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 17, 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. On this head the review checked these things. The new menu layout in lazyRetry runs the same retry() as the other layouts, so Try Again really imports the part again. The Radix onSelect preventDefault keeps the menu open. The passive notice's id describes the hand-off item. The harness mark boundary keeps a failed chunk inside the chip and journals it under composer-harness-mark. Each red-on-base test claim was reproduced, and the five named test files passed under several shuffle seeds.

Done well: removing the last KNOWN_PLAIN exception means the static guard now fails any new plain lazy() under pages/chat/.

Optional:

  • The menu hand-off now sends error.message where it used to send the translated sentence. This matches the other layouts and the journal entry. One sentence under Backwards compatibility, or a reply to Design's note, would record that.
  • The focus-restore effect (lazyRetry.tsx:114) has no test that fails without it, because jsdom's FocusScope already moves focus back into the menu. You could spy on the menu element's focus, or reword the "focus stays in the menu" message.
  • No test checks that MobileTopBar.tsx:34 uses layout: 'menu'. A small test that makes the UpdatePill import fail and asserts the menu holds no button would cover it.

@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: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Nov 17, 2026
@bolichen97
bolichen97 merged commit 7a3cec9 into main Nov 17, 2026
100 checks passed
@bolichen97
bolichen97 deleted the fix/33603-lazy-retry-rest branch November 17, 2026 22:29
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 17, 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