Repository navigation
fix(sidebar): dim folder and New-menu writes while the gateway is offline - #20749
Conversation
…line Items in the folder and New-chat menus now dim, refuse at the sink and carry one reason row per menu; a folder action refused offline shows a neutral notice and no longer claims "Folder update failed". Ported from #9485 onto main's chat-sidebar split (#20524): the gates live in folderBlocks.tsx, boardLane.tsx and SidebarHeader.tsx, and the sink refusals in the folders/create/drag hooks. The commit's screenshots are dropped. Fixes #20736
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that a folder collapsed or expanded while offline doesn't flip back without warning when the post-reconnect refetch overwrites the cached-only [DESIGN-REVIEWED] f2e3bf8 Description read[DESCRIPTION-READ] 91cbffb18ffdfa11d20d07cc8c355b31e86fb5bd0406466ef0e0ff8fa1a6f4a2 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) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS Offline gating is added at seven call sites, but the false "Folder update failed" comes from the shared Not justified as shipped
Inventory (9 items) — 6 justifiedIntent: while the gateway is offline, folder and New-chat menu writes look unavailable and say why, instead of reporting a false update failure (#20736). FIX.
[FIRST-PRINCIPLES-REVIEWED] f2e3bf8 Description read[DESCRIPTION-READ] 9bb714b20a92dfb1a4a832e57e68fe9017c2a85a5875280adfd468d963e49909 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS Offline, some create paths still look live: the "New chat in folder ›" trigger and the folder Watch
[UX-REVIEWED] f2e3bf8 Description read[DESCRIPTION-READ] 6354cd67e98bf56f563f76230d1f57eae2a2bb32024b20470e9d9755c14d0322 That sha256 names everything this verdict read: the PR description, plus the 13 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 |
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: |
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: |
A new module under website/src/pages trips the feature-map gate; the helper belongs beside offlineProps anyway. Co-authored-by: rnoack1 <rnoack@amazon.com>
chenmingwei23
left a comment
There was a problem hiding this comment.
Batch approval: readiness: passed, no merge conflict, checks green.
…20989) * fix(library): dim artifact-table writes while the gateway is offline Star, Delete and the folder menu wrote through the gateway with no connected check, so an offline click looked like it worked. Split from a larger sweep. Ported onto the offline primitive #20749 landed: menu rows use offlineMenuRow and the `offline` dim on DropdownMenuItem, the Move submenu uses FolderMoveSubmenu's offline/offlineTitle with the pick refused at the caller, the menu reason is OfflineMenuReason, and the table/field reason row is a named OfflineReasonRow beside it reusing utils.offline.menu_reason. Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com> * test(library): run SessionDocPath connected now that the row star reads it --------- Co-authored-by: Robert Noack <rnoack@amazon.com>
Problem / Motivation
Goal: While the gateway is offline, the sidebar's folder menus and the New-chat menu show their gateway writes as unavailable and say why, instead of looking live and then reporting a false "Folder update failed".
With the gateway offline, the folder ⋯ / right-click menus (list and board views) and the New-chat caret menu stay fully live. Rename, New subfolder, Folder settings, Hide when empty, Delete folder, Move folder to and every create row look clickable, but none of those writes can reach the gateway. A folder rename tried offline is worse than a dead click: it fires the PATCH, the cache snaps back, and the notice reads "Folder update failed — Failed to fetch" with an Ask the agent hand-off into a composer that cannot send. Session rows beside these menus are already dimmed and refuse offline, so one surface teaches two rules.
Why it matters
A user who learned that a dimmed session row means "not now" has no reason to read a full-weight Delete folder as unavailable, so the only way to find out is to click it and watch nothing happen. The false failure title is a correctness problem: it reports a server rejection that never happened, so a reader cannot tell "your change was refused" from "you are offline".
Not a goal
What changed (motivation → approach → change)
Symptom: gateway writes in the folder and create menus stay live offline, and a rename refused by the network is reported as an update failure. Root cause: those rows and their sinks never read the connection flag, and every folder write funnels its error into the one danger notice.
Rule applied: gate the gateway write at its sink, dim its entry rows, and leave an affordance that only reaches cached state at full weight.
DropdownMenuItem/ContextMenuItemgain anofflineprop that dims the row (composed afterclassName, so the redDelete folderrow goes muted too).FolderMoveSubmenugains opt-inoffline/offlineTitlefor its trigger. NewOfflineMenuReasonrenders onerole="status"row, appended last in each gated menu, saying the dimmed actions need a connection (a disabled row cannot open its own tooltip). NewofflineMenuRowinutils/offline.ts(besideofflineProps) spreadsoffline, theofflinePropstooltip / accessible name, and anonSelectthatpreventDefaults offline, so a refused row keeps the menu open.folderBlocks.tsx,boardLane.tsx) and the header New menu (SidebarHeader.tsx): Rename, New subfolder, the two private-chat rows, Move folder to, Folder settings, Hide when empty, Delete folder; New chat, New incognito/temporary chat, New folder and each New-chat-in-folder row. Folder-name double-click and the folder+buttons carry the offline tooltip.moveFolderToand the siblingreorderFolders(drag),createChatInFolder,renameCommit(keeps the editor and draft if the gateway drops mid-edit) and the header split button's primary segment refuse with a neutral notice.toggleCollapseflips the cached flag offline instead of sending a PATCH that would fail.folder-action-offlinenotice (role="status", dismissable, retired on the disconnected→connected transition). Every real folder-mutationonErrorclears it. The Ask the agent hand-off on "Folder update failed" is withheld while offline.utils.offline.*verbs plusmenu_reason, inen.manual.jsonand the 12 locale catalogues; the raw English verbs passed toofflinePropsinChatInput,busySend,SessionRow,HistoryPaneandSessionTabStripbecome catalogue lookups.Ported from #9485 onto main's
ChatSidebarsplit (#20524): the gates moved from one 5,360-line file into the chat-sidebar render owners and hooks.Backwards compatibility
Compatible: the new props are optional and default off; online behaviour of every row and sink is unchanged.
Removes nothing: offline the dimmed rows refuse a write that already could not reach the gateway; no data, key, route or public function is removed.
Tests
ChatSidebar.folderSettingsOffline.test.tsx(new, 27 cases): each gated row isaria-disabledand opens no modal / issues no write; the dim is visible (opacity-40 text-muted, danger colour dropped on Delete) with a connected control that carries no dim; a refused row leaves the menu open; the offline notice claims no update failure, offers no hand-off, and retires on reconnect; collapse still works offline from cache.ChatSidebar.createMenu.test.tsx: offline every create row is dimmed and refuses, the reason row renders, a folder row's accessible name becomes "Alpha disabled — gateway offline"; the primary split segment raises the neutral notice and does not callcreateChatSlot.Local:
tsc -p tsconfig.app.jsonclean; ESLint clean on touched files; 129 vitest files / 1,829 tests pass acrosssrc/test/ChatSidebar*,ChatInput,SessionTabStrip,pages/chat-sidebar,components/uiand the sidebar integration suite;i18n-check.mjs(withI18N_BASE_REF), restyle ratchet, phantom-classes, theme-colors, i18n-strings, ui-index check, bundle-size gate (908 chunks within budget) and chunk-cycle gate pass.Manual verification
Built SPA served with stubbed
/api/**; the/api/wsstub closes the socket (offline) or keeps it open (online). Offline on main, a folder rename fired 3PATCH /api/chat/folders/f2and showed "Folder update failed"; on this branch it fired none and showed the neutral notice.Screenshots / video
Folder ⋯ menu, offline — before (main) / after:
Folder rename refused offline — before (false failure) / after (neutral notice):
New-chat menu offline (before / after) and online controls (unchanged)
Related Issues
Fixes #20736
Replaces #9485 — thanks @rnoack1, whose change this is; the commit keeps their authorship. #10832 follows on the
offline/OfflineMenuReason/FolderMoveSubmenuprimitive added here.Pattern harvest
Rule candidate: review-prompt
Pattern: a menu row or handler that issues a gateway write without reading
useConnected()(offline it must dim, refuse at the sink, and never route the refusal into a failure notice).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.