Repository navigation
fix(sidebar): gate session rename while the gateway is offline - #10920
Conversation
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The seven committed frames show every control and state the diff adds, but this fork lane has no blind first-time read; pushing the branch to this repository runs one. Notes
[UX-REVIEWED] d0047ca Description read[DESCRIPTION-READ] 39a8c6f9a58c9edee408d4b473df5272a24dd678f6383862a4d5107d59c2f785 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 |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the gate goes into the hooks that already own rename, it changes nothing while online, and the patch removes nothing. Notes
[DESIGN-REVIEWED] d0047ca Description read[DESCRIPTION-READ] 4236d391e48b43268c1735c0e69bac452eb3a72a13709032bad9f90a552c09fd 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 |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The two new gates sit where the draft is lost, in the two rename sinks that had none. The description's menu and catalogue paragraphs describe work the diff does not contain. Notes
What this change shipsInventory (10 items) — 9 justifiedIntent: stop a session rename typed while the gateway is down from being silently lost; keep the draft and say why. FIX.
[FIRST-PRINCIPLES-REVIEWED] d0047ca Description read[DESCRIPTION-READ] 58be047e95a18408ce4fe28b378e9c8e52e26df038f63a9a34707aeeed87d7bf That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
|
[operator: chenmingwei23#de330d0c] This PR has been inactive for 7+ days. The remaining blockers need author or maintainer input:
After these choices and updates, the pipeline will re-assess this PR on its next cycle. |
|
Triage (automated, read against Main still has the defect. On main, neither rename commit path checks Why it needs more than a conflict fix. The merge base
Overlaps to coordinate. These complement this PR; none duplicates it:
Flags: I found no breaking change and no P0 bug. The PATCH response keeps its shape and now returns the live |
41a58e1 to
ce41401
Compare
|
Hold. Gating session rename on What would clear this:
Reviewed head: 18c9118 — crew-pr-reviewer (r118) |
18c9118 to
50dbc27
Compare
0b58667 to
53b1bc1
Compare
53b1bc1 to
f4f5868
Compare
f4f5868 to
87c318a
Compare
87c318a to
f6e4d03
Compare
|
Hold: the branch no longer merges into main. The fix looks sound. Both rename sinks are gated on What would clear this:
AI findings judged non-blocking:
Reviewed head: cd54848 — crew-pr-reviewer (r134) |
Security Scope Review (fork) — 🔴 BLOCK (blocking)Which legitimate operations does the review scope was never resolved: the generate job did not finish (it timed out, failed or was cancelled), so no leg ran; its log names the step that stopped No |
A rename typed while the gateway was down was accepted and silently lost, and a late reply could overwrite a newer title. Split from a larger sweep.
iamwhatever
left a comment
There was a problem hiding this comment.
Approve at d0047ca.
The fix is sound. Both rename hosts read useConnected() themselves and gate twice: when the editor opens and again at commit. The sidebar returns before setRenamingSlot(null) (rename.ts#L165-L173). The header keeps its editor open through a latch that Escape still overrides (SessionTitleControl.tsx#L225-L230). Either way, the typed name survives and no request is sent. Online behaviour is unchanged.
Our r134 hold is cleared. The branch merges cleanly into current main. #10911 has merged, so the shared key and menu gate now come from main. Every check on this head is green or skipped.
AI findings judged non-blocking:
- Design / First Principles: the description says this PR changes
SessionActionsMenu.tsxand addsrename_sessionsto 13 catalogues. Both are already on main from #10911 (SessionActionsMenu.tsx#L256). This is a record-accuracy issue with no runtime effect. Please reword those two paragraphs before merge. The commit message's 'a late reply could overwrite a newer title' should go too, since Not a goal rules out the race fix. - Design / First Principles: the
connectedChannelLinksmove is a byte-identical move with a re-export (connectedChannelLinks.ts, SessionRow.tsx#L160). It is needed to keep SessionRow.tsx under the 2,000-line cap. - Design: the phone shell row is now
minmax(42px,auto). It stays 42px whenever content fits and only grows where content used to spill under the offline strip (App.tsx#L625). - UX: the header notice baseline and gap, and the spacing between the sidebar notice and the preview line, are cosmetic. The text, role and placement are correct (SessionTitleControl.tsx#L440-L446, SessionRow.tsx#L1893-L1899).
Optional: onRenameCommit now depends on renameScope and connected (rename.ts#L243). The row memo therefore changes when a rename arms in a new scope or connectivity flips, which the comment at L113 says should not happen. Reading renameScope through a ref would keep that promise. It has no effect on correctness.
The needs-author-decision label is stale now that #10911 has merged.
— crew-pr-reviewer (r147)
Problem / Motivation
Goal: refuse a session rename while the gateway is down, keep the typed draft, and say why.
Renaming a chat session while the gateway was down was accepted and then silently lost. The
editor closed, the row showed the new title optimistically, the
PATCHfailed, and the titlereverted with no explanation. The draft went with it, so the typed name was unrecoverable and
the only account available was that renaming "does not work sometimes".
Folder rename already refuses this way.
ChatSidebar'srenameCommitre-checksconnected,keeps the editor open, and shows a neutral notice. Session rename had no such gate on either
surface that owns it.
Why it matters
Evidence: seven committed frames under
temp-screenshots/10920-offline-rename/, captioned inScreenshots below.
A silent drop is worse than a refusal, and worse still once the user has typed. It costs the
work and gives no way to tell a dropped rename from one that never registered. It is reachable
any time the socket is down, which is also when a reader is least able to tell what happened.
Not a goal
client generation counters, and a
PATCHreply that returned the slot's live title. Upstreamalready publishes from the slot rather than from the request (
apply_manual_title), so thebroadcast half is solved on main. The reply half is out as well: no caller in this diff reads
the reply body, so it was server scope riding along.
src/kiro_crew/dashboard/chat_title.pyis byte-identical to the base here.
test_an_overtaken_rename_broadcasts_the_current_titleasserts the redundant push onpurpose and is untouched here.
useRenameSlot, nouseRenamesInFlight, nowrapAction,no
folderActionOffline. The gate lands inside the hosts that already own rename, so theper-slot refused-rename recovery on main keeps working unchanged.
What changed (motivation → approach → change)
The sidebar row (
chat-sidebar/rename.ts,chat-sidebar/SessionRow.tsx).useSessionRenamereadsuseConnected()itself rather than taking it as a prop, the wayutils/offline.tsprescribes, so no caller can mount it ungated. Two sinks, not one:onRenameStartrefuses to open an editor whose commit could not reach the gateway, andonRenameCommitre-checks beforesetRenamingSlot(null)for the case the open-time gatecannot catch, a drop while the editor is already open. Returning early there is what keeps
the editor and the draft. The refusal is keyed by SLOT, so the notice renders under the row
it refused instead of under every row.
The header (
chat/SessionTitleControl.tsx). The same pair, self-contained so none of itsthree hosts (
ChatPane,ChatTitleOverlay,MobileTopBar) change.TitleEditorcallsonCommitand thenonCloseunconditionally, so a refused commit sets a flag thatcloseEditorreads: without it the editor would close on the same keystroke and take thename with it. Escape still closes, because that is an explicit discard and runs no commit. The
flag is armed only while an editor is open, since Undo also commits with no editor to consume
it and the latch would then be swallowed by the next rename's close.
Keeping the editor means keeping its focus. Enter commits by BLURRING, so a refused commit
left focus on
document.body, which this file's focus contract forbids. Both hosts restore itfrom an effect, not the handler: the row remounts its textarea on that render. The effect is
keyed on a per-refusal COUNTER, because a second refused Enter leaves the refusal flag already
set and a flag-keyed effect would never re-run. And it only moves focus while nothing else
holds it, which is what tells Enter apart from a POINTER blur: a click has already focused its
own target by that frame, and pulling focus off it is the context change the same contract
forbids.
The phone's rename lives in the MENU, so the gate does too (
SessionActionsMenu.tsx).MobileTopBarrenders that menu until Rename fires and only THEN mounts the title editor, sothe editor's own open-time gate never sees a phone rename at all, and on a phone the menu is
the only rename entry there is. The item now takes
offlineMenuRow, the helper the foldermenu's gated rows already use: dimmed, the reason in its tooltip and accessible name, and
preventDefaulton select so the menu stays open. A touch screen never shows that tooltip, sothe menu also paints the shared
OfflineMenuReasonrow under Rename, as the folder and createmenus do. Every host that passes
onRenamegets both: the header and phone menus and thesidebar row menus. Online neither adds anything.
An unchanged name is not held (
chat-sidebar/rename.ts). Holding the editor open earnsnothing when the typed name equals the slot's own title: there is no draft at stake, and a
click-away could not then close it until the gateway returned. It closes instead, sending
nothing. The header already reached that outcome by returning on
refused === titlebeforeits own gate, so the two surfaces now agree.
The notice takes the next line, not the editor's width. Unshrinkable beside the editor, it
collapsed the phone-width editor to border and padding. The row now WRAPS and, while editing,
the notice takes
basis-full. Wrapping alone is not enough: the editing cluster isflex-1 min-w-0, which flex sizes at zero when it collects lines, so at any width where bothfit the notice still shared the line and squeezed the draft. The cluster keeps
min-w-0,which
sessionTitleSqueezerequires. The read-only notice stays beside the title.And the phone bar grows to hold that line (
App.tsx,isMobilebranch only). The offlinestrip is
absolute top-fullINSIDE the header, so it starts at the header's bottom edge andanything the header cannot fit lands under it. The shell grid pinned that track to a hard
42pxaround 66px of content; it is nowminmax(42px,auto), identical while content fits.Desktop and bottom-dock keep their fixed
42px.The notice is neutral, not an error, and it is the SHARED row. No request was sent, so an
offline refusal is reported on
OfflineReasonRow(components/OfflineMenuReason.tsx) ratherthan the danger surface either host already has for a rejected
PATCH. That component existsfor exactly this case, "a field whose typed value is being held", and the folder-name field
already uses it; both hosts here render through it, with no icon and no second copy of its
styling. It retires on the disconnected → connected transition only.
The row title keeps its tooltip.
offlinePropsis spread BEFOREtitle, deliberately:it would otherwise replace the full-name tooltip, which is the only place a truncated session
name is shown in full, and the rename box that also shows it is exactly what is unreachable
offline. Only the
aria-disabledaffordance is taken there.The notice clears the row's hover controls. That cluster is absolutely placed at the row's
centre, so a second line landed under it and the buttons covered the reason. The padding applies
under
group-hover:only, so an unhovered row wraps no earlier.utils.offline.rename_sessionsis added to all 13 catalogues. Each value is composedfrom that locale's OWN
rename_foldersandcreate_sessionsrather than translated fresh,and a checker asserts every codepoint of the new value appears in those two source strings.
en-XAis regenerated, not hand-edited.Backwards compatibility
Online behaviour is unchanged on both surfaces: the gates are
!connectedbranches. No serverfile is touched, no API shape changes, no prop is removed. The only fixture change is THREE suites that modelled an offline dashboard
incidentally while testing rename-to-session pinning, menu focus restore and which menu
items render; they now use a
connected store, because with the gate in place an offline fixture cannot open the editor and
those cases would pass vacuously. The two suites that test the gate itself take the flag as a
parameter defaulting to connected, so their existing cases are unchanged.
Tests
SessionTitleControl.test.tsx: the header refuses to open offline and names the reason, thetrigger is
aria-disabledwith the offline tooltip, and a drop mid-edit keeps the editorwith its draft and sends nothing.
ChatSidebar.renameFailureRecovery.test.tsx: the same three for the sidebar row, includingthat the notice is
role="status"and is keyed to the refused row.SessionActionsMenu.renameOffline.test.tsx: the menu's Rename is dimmed offline, names thereason, paints it as visible text, and does not fire; it runs while connected with no reason
row. Control: without the reason row the visible-text arm fails to find it. Control: restoring the plain
onSelectreddens the refusal arm and leaves the online arm green.
offlineRenameReasonSource.test.ts: a source gate, in the idiom ofsessionTitleSqueeze,requiring both hosts to render through
OfflineReasonRowand forbidding aWifiOffineither. Control: both arms fail against the pre-swap hosts.
SessionTitleControl.test.tsxalso covers an offline Undo leaving no keep-open latch, focusreturning to the editor, focus returning again on a SECOND refused Enter, focus STAYING where
a pointer put it, and the row wrapping rather than squeezing the editor.
Each has a negative control that reddens only its own case: removing the sidebar commit
re-check, dropping the header keep-open flag, ungating that flag from
editing, re-keying therestore on the refusal flag, dropping its idle-focus guard, and removing the wrap each fail
exactly one test. The focus and layout contracts are also measured in a real browser, which is
where they bite: re-keying the sidebar restore on its refusal value turns its repeat-Enter
assertion from
TEXTAREA in-rowintobody.Manual verification
tscclean, ESLint clean at--max-warnings 0over every changed file, and all 19i18n-checkarms pass withI18N_BASE_REFset, including the per-locale style arms that onlyrun diff-scoped. All four CI shards were run on this head and every remaining failure was
reproduced on a pristine worktree at the same merge base, by failing-test NAME and not merely
by count.
npm run jscpdreports 0 clones, which the new harness must satisfy at 0%.Harness mutation controls, each measured: the
onRenameStartbail, the hover padding(
clear->overlap 63px), either focus restore (->body), and the wrap (236px -> 12px).Two of its checks were VACUOUS and are fixed: "opened no editor" counted
inputwhere the roweditor is a
textarea, and the focus checks sampled before a frame-deferred restore.Screenshots / video
Seven frames are COMMITTED here under
temp-screenshots/10920-offline-rename/, fromwebsite/scripts/capture-10920-offline-rename.mjsagainst the real built SPA: 35 assertions,0 failures.
Double-click offline: the title is
aria-disabledand keeps its full-name tooltip, no editoropens, the reason sits under the title. Hovered, so the cluster case above is visible.
The commit re-check: opened while connected, a name typed, the socket dropped, then Enter.
Editor and draft survive, nothing sent, and focus stays on the editor. The notice sits on its
own line under the editor, which the harness asserts once the layout has settled.
360px, the same drop. The editor measures 236px with the notice showing, 12px without the
wrap, and the notice clears the global "Gateway offline" strip it overlapped by 16px while the
bar's track was pinned.
360px, offline, the session menu open: Rename is dimmed and
aria-disabled, the reason ispainted under it, and choosing it opens no editor. On a phone this menu is the only rename entry.
The sidebar's half of the same path.
The header host, same refusal.
The control: connected, the gesture opens the editor and no notice renders.
Related Issues
None.
Pattern harvest
Rule candidate: review-prompt
Pattern: a precondition gate written on a control's own trigger, while another host opens the
same editor by setting its state directly, leaving the gate unreachable from that entry. Ask
which entry points can open it, not only the one in the diff. Measured here: the phone bar
renders a menu until Rename fires and only then mounts the editor with
editingalready true,so the trigger's gate never saw a phone rename, and that menu is the phone's only rename entry.
Rule candidate: review-prompt
Pattern: a hand-written "held because the gateway is down" line beside a field when
OfflineReasonRowalready exists for exactly that case. Two copies had already drifted todifferent type sizes before the third was caught.
Gate a write at the sink that closes the editor, not only where the editor opens. An open-time
gate cannot see a connection that drops while someone is typing, and the close is what
destroys the draft, so the refusal has to return before it.
Checklist
mainContribution License Agreement
By submitting this pull request, I confirm that my contribution is made under the terms of the
project's license.