Repository navigation
fix(chat): bound the @-menu file-search fetch so a slow gateway fails visibly - #7068
Conversation
078f243 to
ca51006
Compare
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the 15s/10s budgets against a network-mounted project dir — every sample is local-disk, and Retry re-enters the same bound (#11419). [DESIGN-REVIEWED] 7a6c6c5 Description read[DESCRIPTION-READ] d753ff43cee5d35dfdfa5a26f71539ec195192605dc650150c398947491654b8 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 |
UX Review (Fable 5, fork) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS No blind reader has seen these notices — every cause-keyed string and Retry control is evidenced only by screenshots this lane read after the diff. Watch
Suggestions
[UX-REVIEWED] 7a6c6c5 Description read[DESCRIPTION-READ] 5945cb8b206c3dccd66e1c461a2991cb09e0c31a9448fb907606d242f139d1d4 That sha256 names everything this verdict read: the PR description, plus the 38 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 (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the 10s/15s bounds on a network-mounted project directory: every measurement behind them is local-disk, author-admitted (#11419), and there is deliberately no knob. Not justified as shipped
What this change shipsInventory (10 items) — 9 justifiedIntent: stop a wedged gateway turning the chat's file-browsing surfaces into eternal spinners, by bounding the reads and naming each failure with its remedy — a FIX. The change has more than 10 observable differences; the 10 most noticeable are kept (omitted: WorkspacePicker typing-ownership race fixes, Select-on-blank no-op,
[FIRST-PRINCIPLES-REVIEWED] 7a6c6c5 Description read[DESCRIPTION-READ] 97e986f99f00ee2256f8f2a13bc07994899095ec53c91b868f4bbbe4d6bd8853 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
ca51006 to
e5dca34
Compare
e5dca34 to
c3f5eff
Compare
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
… gateway A wedged gateway used to hang the dashboard's file search and the folder pickers forever. Every file-search and directory/drive listing read now runs under a client deadline, fails into a cause-keyed notice naming the path still on screen, and keeps the stale list usable. Both folder pickers offer a Retry beside a timed-out or failed listing, inert as Retrying while its re-ask is in flight. Co-authored-by: Kiro Crew <noreply@kirodotdev.github.io>
|
self-added: yes
|
|
Rebased: main moved in the locale catalogs ( |
|
self-added: no
|
|
self-added: no
|
|
self-added: yes
|
|
self-added: yes
|
iamwhatever
left a comment
There was a problem hiding this comment.
Reviewed. All five files.py hunks add a code field to existing error bodies and change nothing else: is_sensitive_path gate, audit logging, status codes and check order are unchanged. Client bounds (15s/10s) are backed by the measurements in files.ts:18-68, queryClient never retries a deadline, Retry appears only for timed-out/failed reads, late results are discarded. Backend tests assert each new code; withDeadline and FolderPanel.deadline tests are meaningful.
Non-blocking: pathComplete (files.ts:142) is still unbounded, so the @-menu's ./ path mode can still spin; browseDirs/browseDrives/projectTree/recentProjects pass undefined as the outer signal so unmount does not abort them.
Problem / Motivation
Goal: Stop a wedged gateway turning every file-browsing surface into an eternal spinner, by bounding the reads and naming each failure with its remedy.
When the gateway stops answering, the chat page's file reads hang forever. The composer's
@file-mention menu sits on "Searching…" with Enter swallowed, the folder tab's listing and search never settle, the file rail's tree never loads, and both folder pickers' browse listings spin. Nothing tells the user what failed or what would fix it.Why it matters
A wedged gateway is exactly the moment a person reaches for the file browser to check what state their project is in. Every one of these surfaces answering with an eternal spinner turns one stuck process into a dashboard that looks entirely broken.
Not a goal
What changed (motivation → approach → change)
/api/file-search,/api/project/tree, browse listings, drive roots, and recent projects are bounded (15s search, 10s browse) in the API client's files endpoint module (api/client/files.ts), through one journaling deadline helper the facade hands the endpoint modules on their shared transport (api/client.ts,api/client/transport.ts,lib/withDeadline.ts), so every caller of the shared query keys inherits the bound; a read that hits its bound journals its own report (endpoint, codetimeout) and every failed request pins its journaled report to its own rejection (utils/errorReport.ts), so each notice hands the agent its own read's report even when several reads fail together with the same message; the recent-projects read keeps its own sequence ticket, so a stale result from an earlier open is discarded, and a recents failure never replaces a folder or drive-list failure on screenchat/FolderPanel.tsx) and both folder pickers (components/ProjectPicker.tsx,components/WorkspacePicker.tsx) name each failure apart — timed out, failed, no access, folder not found — through the shared classifier (lib/searchErrorCause.ts); a failed recent-projects read lands on the Browse tab with a notice naming its cause instead of a silently empty picker, and the Recent tab states the same failure instead of claiming there are no recent projects; the drive-list read keys its notice the same way, so a drive list that timed out says "Drive list timed out" with the typed-drive and All-drives remedies, and a refused one names the path still on screen; a refused or missing folder in the workspace picker names the folder that refused and the remedy ("No access to {{path}}. Type another path above."); the notice strings are translated in every catalog underi18n/locales(e.g.locales/zh-CN.json), and the German and Russian picker families each address the reader in one register throughout, the informal one their style guides require (locales/de.json,locales/ru.json)components/WorkspacePicker.tsx,components/ProjectPicker.tsx) carry aRetrybutton for timed-out and failed listings only — a permanent refusal offers none — and it re-asks exactly the read that failed (a folder, the opening read, or the project picker's drive list), not wherever the user browsed since; while that re-ask is in flight the control turns inert asRetrying…—aria-disabled, so a keyboard press keeps focus on it — and the notice row carriesaria-busy, so the wait is visible and a second press is impossible; typing in the path field clears a notice that names the folder being replaced, and its Retry, and in the workspace picker a listing still loading lands its folders without overwriting what was typed; a listing that settles after a newer request started is discarded, so a slow failure never overwrites the current view, and closing or re-opening a picker clears a stale noticechat/FolderPanel.tsx); a background listing read the button did not start still spins the icon but never blocks a press; the header keeps room for the button'sRefreshtext label while the user has pressed it, holds a searchable query, or a notice names it, so the label never appears under a cursor already reaching for it, and ordinary folder navigation never resizes the buttoncodecontracthandlers/files.py) return machine-readable codes (access_denied,project_not_found,not_a_directory), so the client can tell a permanent refusal (no Retry) from a recoverable failure (Retry)chat/FileBrowserRail.tsx,chat/SidePanel.tsx) and its toggle mounted with a notice. A timed-out or failed read names the header Refresh, whose label shows and which stays in the tab order while it works (busy, not disabled) so a keyboard press on the named remedy keeps its place; a refused or missing folder states only its cause, and Refresh stays an icon for after the user fixes it outside the app (failureMessageinlib/searchErrorCause.ts, shared with the folder tab). A tree that has not loaded yet renders nothing under the notice, so no loading shimmer contradicts it, while a tree already on screen stays usable under the notice when a later read fails; the Files home lands in its error arm (chat/FilesHomePanel.tsx) instead of a false "No project directory"; the tree notice names its cause — no access, folder not found, else the generic line — on all three surfaces through one map (TREE_FAILURE_KEYSinlib/searchErrorCause.ts); when the tree and the folder listing fail together, the folder tab shows one notice, not twopierre/PierreWorkspaceTreeImpl.tsx) stops while the read is errored and resumes on recovery, and the folder tab's Refresh refetches exactly the active search key (chat/FolderPanel.tsx), not every cached variantThe reads hang because nothing bounds them: the server never answers and the client waits forever. The fix puts the deadline in the API client — react-query dedupes on the query key, so a per-component bound would let the weakest caller decide it. A deadline the client set itself is a known cause, so those arms say "timed out", while any other rejection honestly says "failed". Permanent refusals come from the new backend
codefields and deliberately offer no Retry, because re-asking a refusal returns the same answer.Both pickers name the folder a failed read asked for whenever they know it, a drive clicked in the Windows drive list included, and mention the list still shown only when there is one. Only the opening read, which asks for no folder of its own, takes copy that names none, so neither a first open nor a reopen against a wedged gateway renders a blank folder name. The
@-menu keeps main's own error surface — the deadline lives below it, in the client — and its "Searching…"/"No matches" lines carryrole="status"so the settling is announced to screen readers. The workspace picker's Back and Escape clear a stale failure notice along with the form state they already reset, and its "No subdirectories" line waits for a listing to land, so typing during the opening read never calls an unread folder empty. The drives harness (scripts/capture-windows-drives-evidence.mjs) asserts the drive list's timed-out and denied copy verbatim, so a copy drift fails its run.Backwards compatibility
Compatible: the bounded methods reject after the deadline where they previously hung forever; every consumer of those promises already handles rejection (the same paths a 5xx takes today). The API coverage test keeps all wrapped methods under the universal request probe; a caller's own AbortSignal is accepted only where a production caller passes one (
browseFiles, via FolderPanel's query), and the deadline signal is composed inside the client everywhere.Tests
withDeadline.test.ts— the deadline rejects with aTimeoutError-named error (the name the cause classifier keys on; an executable pin for any future transport swap) and forwards caller aborts.FolderPanel.deadline.test.tsx— each cause renders its own copy; Refresh appears only where re-asking can help; a running retry shows "Searching…" with the header spinning, never the stale timeout copy; Refresh re-reads the listing after non-timeout failures too; a press still re-runs a timed-out search while a listing read it did not start is in flight, and is not announced as disabled.FolderPanel.search.test.tsx/FolderPanel.test.tsx/FolderPanel.tree.test.tsx— notice suppression (no "Empty folder" claim under a tree notice), Refresh refetches the failed reads with exactly the active (query, limit) key, stays busy and inert until the press-started search walk and recoverable tree read settle (a second press dispatches nothing); the tree notice's agent hand-off carries the read's journaled report (endpoint, status, code), not the composed notice line; a wedged gateway failing the tree and the listing together raises exactly one alert, and each notice's hand-off names its own endpoint when two deadlines fire in sequence; a refused search or listing hands the agent endpoint, status and code; a listing 400 names a missing folder, an unnamed 400 stays generic, and a failure with no status stays retryable; a session-expiry 403 carryingaccess_deniedstill reads as a plain failure; a listing read with an empty search box keeps the button compact with no label, while a pressed Refresh keeps its reserved width when a timeout then names it.FileBrowserRail.test.tsx/FilesHomePanel.test.tsx/sidePanelFileRailDefault.test.tsx— a timed-out tree keeps the rail mounted with its notice and an empty tree body (no skeleton); per cause, a timed-out or failed tree names Refresh and shows its label while a refused or missing tree shows the bare cause with an icon-only Refresh, and in the file tab a refused tree keeps the toggle and the notice; a tree that already loaded stays on screen under the notice when a later refetch fails, recovers after Refresh, whose button stays focusable and refuses a second press while its refresh runs, and lands in the panel's error arm (not "No project directory"); a refused or missing tree names its cause, and a failure naming no cause keeps the generic line; the Files home tree notice hands the agent the read's report (endpoint, status, code).PierreWorkspaceTreeImpl.test.tsx— an errored tree read fires zero further polls; recovery resumes the poll.ApiClient.coverage.test.tsx— the six deadline-wrapped methods stay in the universal probe; a new assertion fails the suite if they are exempted again; the caller's abort signal is relayed throughbrowseFiles; two same-message refusals from different endpoints each keep their own journaled report.ApiClient.refactor.surface.test.ts—browseFilesandfileSearchtake an AbortSignal now, so the no-session-key probe passes them real arguments instead of placeholder strings.WorkspacePickerCoverage.test.tsx— a rejecting folder listing renders the error notice with Retry, never "No subdirectories"; Retry re-asks the failed path and clears the notice on success; while the re-ask is in flight the control is inert asRetrying…, keeps focus after a keyboard press, and a second press dispatches nothing; a keystroke in the path field clears a folder-naming notice and its Retry but keeps the opening read's, and the listing in flight still lands its folders without its late success overwriting what was typed or its late failure naming a replaced path; leaving the create form before anything listed re-runs the opening read, and Select with nothing to select does nothing; a stale settlement neither re-enables the control nor replaces the notice — only the request that still holds the ticket does; a denied listing shows no Retry; a listing superseded by navigation or close settles without touching the view; a successful empty listing still shows the empty state; a failed Back to the parent keeps an empty folder's empty state beside the notice, while a reopen whose opening read fails hides it; a failed drill names the folder it asked for, whatever the cause, while the opening read's failure names none.ProjectPicker.listingError.test.tsx— each failure cause renders its own copy (with and without a failed path); a drive-list timeout says "Drive list timed out" with the All-drives remedy (never the folder-listing line), and a refused drive list renders its own arm; a failure of the listing on screen never shows the empty-state, while a failed drive list or a failed different typed path keeps an empty folder's empty-state; success-empty still does; an opening-folder timeout says "Open it again, or pick a folder from the list." beside a Retry that re-lists that folder, and Retry equally re-runs a failed opening read or re-lists a timed-out drive list, while a refused or missing listing offers none; during the re-ask the same button readsRetrying…, stays focused andaria-disabled, and a second press sends nothing; a keystroke during the re-ask drops the notice and its Retry, and the retired re-ask lands neither its folders nor its path over what was typed; a rejecting recent-projects read lands on Browse with the recents notice (pp-recent-error), a resolving one shows none; when both opening reads fail, in either order, the folder-listing notice stays and no empty-state appears; a directory notice's hand-off keeps its own report after a later deadline is journaled; the Recent tab states a recents failure with its own copy, including when a directory failure outranks it on Browse; a reopen keeps the previous open's rows on screen, with no "No recent projects" claim and no remount of the search box, while its recents read is still pending; a reopen whose recents read rejects shows none of the previous open's rows under the notice; a reopen whose opening listing fails takes the copy that names no folder; a typed drill that fails before any listing landed, and a timed-out click on a drive in the Windows drive list, name the folder that failed without claiming a list still shown.test_dashboard_files_onloop_fs.py/test_file_search.py/test_browse_files.pypin thecodefields (access_denied,not_a_directoryon browse-files too);error-code-baseline.jsonratchets down (six newly-coded responses).Manual verification
Ran the bundled drives harness (
website/scripts/capture-windows-drives-evidence.mjs) against the production build — it drives the real SPA with the drive-list read answering, refusing, and hanging, waits on the timed-out arm's copy verbatim ("Drive list timed out"), and photographs each arm. The workspace picker's timed-out Retry and its in-flightRetrying…state were captured from thecapture/error-notice-surfaces.htmlpage with the browse read hung, so the client's own 10s deadline is what fires in the frames. The project picker, workspace picker, Files home and folder tab frames come from a local page that mounts the real components with the network stubbed to refuse, report missing, or hang; each frame asserts its copy verbatim before it is photographed (the path-edit frame asserts the notice and Retry are gone and the typed path kept), and the one-notice frame asserts both reads journaled a timeout. The project picker's Retry frames — timed out,Retrying…, recovered, a failed opening read, a timed-out drill and a timed-out drive list — were captured on the production build with every API call stubbed and the listing read hung or failing, so the client's own 10s deadline fires; each frame asserts its notice text and the button's label before it is photographed.Screenshots / video
The wedged
@-menu settling into its notice instead of hanging:The folder tab naming a timeout apart from other causes, with the remedy in the notice:
The workspace picker's bounded browse failure with its Retry, the in-flight state one press produces, the recovery, typing a new path, and the denied arm with Retry withheld:
The project picker when recent projects time out, and when a folder refuses — the list stays usable:
The project picker's Retry beside a timed-out or failed listing, the in-flight state one press produces, and the recovery:
The workspace picker naming the folder that refused, and the Files home and folder tab naming the tree's cause — one notice when the tree and listing both fail:
The drive list naming its own timeout and refusal:
All evidence frames
Related Issues
no linked issue: the hang was reported in review triage, not a tracked issue; follow-ups live in #11405, #11419, #11420.
Pattern harvest
Not generalizable: the deadline-at-the-client-level pattern is already the repo's convention for bounded reads (slash commands, skills); this PR extends it to the file surfaces rather than introducing a new pattern.
Checklist
npm run buildand the frontend suites pass locally