π OpenHands: AI-Driven Development
fix: back off and stop refetch-on-focus bursts that trip cloud rate limits (#17984)
Tim O'Farrell14ee77847162
diff --git a/.pr/issue-17268/index.html b/.pr/issue-17268/index.htmldeleted file mode 100644index 7e175d8ab1..0000000000--- a/.pr/issue-17268/index.html+++ /dev/null@@ -1,457 +0,0 @@-<!doctype html>-<html lang="en">- <head>- <meta charset="utf-8" />- <meta name="viewport" content="width=device-width, initial-scale=1" />- <title>Accessible conversation drawer tabs β review doc</title>- <style>- :root {- --bg: #101114;- --panel: #17191d;- --panel-2: #1d2026;- --ink: #e8e9ec;- --muted: #9aa0ab;- --line: #2a2e36;- --accent: #f2c94c;- --good: #5ac48b;- --bad: #e2766b;- --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;- }- * { box-sizing: border-box; }- body {- margin: 0;- background: var(--bg);- color: var(--ink);- font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;- }- .wrap { max-width: 1040px; margin: 0 auto; padding: 40px 20px 80px; }- header h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.02em; }- header .sub { color: var(--muted); font-size: 14px; margin: 0 0 4px; }- header .stats { color: var(--muted); font-size: 13px; font-family: var(--mono); }- .star {- margin: 24px 0 32px;- border: 1px solid var(--accent);- border-left-width: 4px;- border-radius: 8px;- background: rgba(242, 201, 76, 0.07);- padding: 16px 18px;- }- .star b { color: var(--accent); }- h2 {- font-size: 20px;- margin: 40px 0 14px;- padding-bottom: 8px;- border-bottom: 1px solid var(--line);- letter-spacing: -0.01em;- }- h3 { font-size: 16px; margin: 26px 0 8px; }- p { margin: 10px 0; }- code, .mono { font-family: var(--mono); font-size: 13px; }- code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }- a { color: #8ab4f8; }- .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }- @media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }- .card {- background: var(--panel);- border: 1px solid var(--line);- border-radius: 10px;- padding: 14px 16px;- }- .card h4 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }- .card.before h4 { color: var(--bad); }- .card.after h4 { color: var(--good); }- pre {- margin: 0;- overflow-x: auto;- font-family: var(--mono);- font-size: 12.5px;- line-height: 1.55;- color: #cfd3da;- white-space: pre;- }- figure { margin: 14px 0 0; }- figure img { width: 100%; border: 1px solid var(--line); border-radius: 8px; display: block; }- figcaption { color: var(--muted); font-size: 12.5px; margin-top: 6px; }- table { border-collapse: collapse; width: 100%; font-size: 14px; }- th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }- th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; }- td.path { font-family: var(--mono); font-size: 12.5px; }- .tag { font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }- ul { margin: 10px 0; padding-left: 20px; }- li { margin: 4px 0; }- .note { color: var(--muted); font-size: 13.5px; }- </style>- </head>- <body>- <div class="wrap">- <header>- <h1>Accessible conversation drawer tabs</h1>- <p class="sub">- Review doc for <strong>OpenHands/OpenHands#17268</strong> β conversation- drawer tabs need accessible semantics and collision-aware overflow.- </p>- <p class="stats">- base cf1cc69f Β· 10 code files Β· updated after the first review- </p>- </header>-- <div class="star">- <b>β The whole change lives in one folder</b>- (<code>src/components/features/conversation/conversation-tabs/</code>) plus two- new translation keys. Nothing in the tab store, the pin/unpin preferences,- or the responsive overflow measurement moves β the strip keeps the exact- same DOM shape and click behaviour, and gains ARIA attributes, a roving- tabindex, and a viewport clamp on the portaled menu. The one behavioural- change a mouse user can notice is the overflow menu no longer running off- the right edge of the viewport.- </div>-- <h2>1 Β· What a screen-reader / keyboard user gets</h2>-- <p class="note">- Captured from a real Chromium session against <code>npm run dev:mock</code>,- on this branch and on its merge-base, same viewport (1280Γ800) and same- drawer width. <code>ariaSnapshot()</code> is Playwright's view of the- browser's accessibility tree β not our own assertion of it.- </p>-- <div class="grid2">- <div class="card before">- <h4>Before β accessibility tree of the tab strip</h4>-<pre>- button "Files":- - img- - text: Files-- button:- - img-- button-- button "More options":- - img</pre>- <p class="note">- No tablist, no tabs, no selected state. Every tab except the open one- hides its label, so it reaches assistive tech as an unnamed- <code>button</code>. The overflow trigger is "More options".- </p>- </div>- <div class="card after">- <h4>After β accessibility tree of the tab strip</h4>-<pre>- tablist "Conversation panels":- - tab "Files" [selected]:- - img- - text: Files- - tab "Commits":- - img- - tab "Planner"- - tab "Terminal"- - tab "Browser"- - tab "Usage"-- button "Customize tabs":- - img</pre>- <p class="note">- Every control is a named <code>tab</code> inside a named- <code>tablist</code>, with the open one marked selected.- </p>- </div>- </div>-- <h3>Keyboard: two <kbd>β</kbd> presses from the open Files tab</h3>- <div class="grid2">- <div class="card before">- <h4>Before β focus does not move</h4>- <figure>- <img src="./keyboard-before.png" onerror="this.onerror=null;this.src='https://raw.githubusercontent.com/errmakov/OpenHands/feat/accessible-conversation-drawer-tabs/.pr/issue-17268/keyboard-before.png'" alt="Tab strip with the focus ring still on the Files tab after two right-arrow presses" />- <figcaption>- <code>document.activeElement</code> β- <code>conversation-tab-files</code>, <code>aria-label: null</code>.- Arrow keys do nothing; every tab is its own <kbd>Tab</kbd> stop.- </figcaption>- </figure>- </div>- <div class="card after">- <h4>After β focus roves, selection stays put</h4>- <figure>- <img src="./keyboard-after.png" onerror="this.onerror=null;this.src='https://raw.githubusercontent.com/errmakov/OpenHands/feat/accessible-conversation-drawer-tabs/.pr/issue-17268/keyboard-after.png'" alt="Tab strip with the focus ring on the third tab while Files remains the selected tab" />- <figcaption>- <code>document.activeElement</code> β- <code>conversation-tab-planner</code>,- <code>aria-label: "Planner"</code>. Files is still the selected tab β- activation is manual (<kbd>Enter</kbd>/<kbd>Space</kbd>), so scanning- the strip does not thrash the drawer.- </figcaption>- </figure>- </div>- </div>-- <h2>2 Β· The overflow menu at the viewport edge</h2>-- <p>- The menu is portaled to <code>document.body</code> with- <code>position: fixed</code>. It was anchored with- <code>left: rect.left</code> and nothing else, so wherever the trigger sat- near the right edge β an embedded canvas, or just a narrow drawer β the- labels and the pin controls fell outside the viewport with no way to reach- them.- </p>-- <div class="grid2">- <div class="card before">- <h4>Before β 87px of the menu is off-screen</h4>- <figure>- <img src="./overflow-menu-before.png" onerror="this.onerror=null;this.src='https://raw.githubusercontent.com/errmakov/OpenHands/feat/accessible-conversation-drawer-tabs/.pr/issue-17268/overflow-menu-before.png'" alt="Overflow menu clipped at the right edge, showing only the first letter of each tab name and no pin controls" />- <figcaption>- trigger <code>x = 1234.6</code> Β· menu- <code>x = 1234.6, w = 132.2</code> Β· viewport <code>1280</code> β- <strong>87px clipped</strong>. Labels read "P / F / C / T / B / U";- the pin toggles are unreachable.- </figcaption>- </figure>- </div>- <div class="card after">- <h4>After β clamped inside the viewport</h4>- <figure>- <img src="./overflow-menu-after.png" onerror="this.onerror=null;this.src='https://raw.githubusercontent.com/errmakov/OpenHands/feat/accessible-conversation-drawer-tabs/.pr/issue-17268/overflow-menu-after.png'" alt="Overflow menu fully inside the viewport with full tab names and pin controls visible" />- <figcaption>- same trigger Β· menu <code>x = 1139.8, w = 132.2</code> β right edge- <code>1272</code> Β· <strong>0px clipped</strong>. Full labels and the- pin toggles are visible.- </figcaption>- </figure>- </div>- </div>-- <h3>The placement rule</h3>- <div class="grid2">- <div class="card before">- <h4>Before</h4>-<pre>const gap = 8;-setPortalStyle({- position: "fixed",- zIndex: 9999,- top: rect.bottom + gap,- left: rect.left,-});</pre>- </div>- <div class="card after">- <h4>After</h4>-<pre>const menuRect = ref.current?.getBoundingClientRect();--const overflowsBelow =- rect.bottom + MENU_GAP_PX + (menuRect?.height ?? 0) >- window.innerHeight;--const rightmostLeft =- window.innerWidth - (menuRect?.width ?? 0)- - MENU_VIEWPORT_MARGIN_PX;--setPortalStyle({- position: "fixed",- zIndex: 9999,- ...(overflowsBelow- ? { bottom: window.innerHeight - rect.top + MENU_GAP_PX }- : { top: rect.bottom + MENU_GAP_PX }),- left: Math.max(- MENU_VIEWPORT_MARGIN_PX,- Math.min(rect.left, rightmostLeft),- ),-});</pre>- </div>- </div>- <p class="note">- The menu's own box is only measurable once it has painted, so the first- pass falls back to the trigger and a- <code>requestAnimationFrame</code> re-runs with real dimensions β the same- two-pass shape already used by the automations kebab menu- (<code>src/components/features/automations/kebab-menu.tsx</code>, PR #16926),- which this now matches, plus the horizontal clamp.- </p>-- <h2>3 Β· Component API</h2>-- <p>- <code>ConversationTabNav</code> gains three optional props. All are- additive; the measurement clones in the offscreen- <code>aria-hidden</code> row pass none of them and stay inert.- </p>-- <div class="grid2">- <div class="card before">- <h4>Before</h4>-<pre>type ConversationTabNavProps = {- tabValue: string;- icon: ComponentType<{ className: string }>;- onClick(): void;- isActive?: boolean;- label?: string;- className?: string;- measureOnly?: boolean;- suppressLayoutAnimation?: boolean;-};</pre>- </div>- <div class="card after">- <h4>After</h4>-<pre>type ConversationTabNavProps = {- tabValue: string;- icon: ComponentType<{ className: string }>;- onClick(): void;- isActive?: boolean;- label?: string;- className?: string;- measureOnly?: boolean;- suppressLayoutAnimation?: boolean;- <b>isSelected?: boolean;</b>- <b>tabIndex?: number;</b>- <b>onKeyDown?(event: KeyboardEvent<HTMLButtonElement>): void;</b>- <b>buttonRef?: Ref<HTMLButtonElement>;</b>-};</pre>- </div>- </div>-- <h3>New module: <code>conversation-tab-ids.ts</code></h3>-<pre class="card">export const CONVERSATION_TAB_PANEL_ID = "conversation-tab-panel";</pre>- <p class="note">- Every tab's <code>aria-controls</code> and the panel's <code>id</code>- need the same identifier. The desktop drawer and the mobile- <code>/panel</code> route each render one strip and one panel and never- mount together, so a constant panel id is unambiguous.- </p>-- <h3>Two states the first revision got wrong (fixed after review)</h3>- <ul>- <li>- <strong>Drawer closed.</strong> The collapsed drawer is only- <code>w-0 translate-x-full opacity-0</code>, so the strip stays in the- accessibility tree. <code>aria-selected</code> and the roving tab stop- were derived from <code>isTabActive</code> (selected <em>and</em> drawer- open), which left the tablist with no selected tab. They now follow- <code>selectedTab</code> through a separate <code>isSelected</code> prop;- <code>isActive</code> still drives only the highlight and the expanded- label, so nothing changes visually.- </li>- <li>- <strong>Selected tab in the overflow menu.</strong> The panel was named- with <code>aria-labelledby</code> pointing at the selected tab's button,- which is not in the DOM when a narrow drawer pushes that tab into the- overflow menu. The panel now carries the tab's name as- <code>aria-label</code>, which holds in every overflow state β including- the one where no tab fits inline at all.- </li>- </ul>-- <h2>4 Β· Files</h2>- <table>- <thead>- <tr><th>File</th><th></th><th>What changed</th></tr>- </thead>- <tbody>- <tr>- <td class="path">conversation-tabs/conversation-tab-ids.ts</td>- <td><span class="tag">added</span></td>- <td>The panel id and the tab-id helper shared by the strip and the panel.</td>- </tr>- <tr>- <td class="path">conversation-tabs/conversation-tab-nav.tsx</td>- <td><span class="tag">changed</span></td>- <td>- Real tabs get <code>role="tab"</code>, <code>aria-selected</code>- (from the new <code>isSelected</code>, independent of the drawer being- open), <code>aria-controls</code>, an explicit- <code>aria-label</code>, and the roving <code>tabIndex</code> /- <code>onKeyDown</code> / <code>ref</code>. Measurement clones get- <code>tabIndex=-1</code> and no role, so the offscreen- <code>aria-hidden</code> row holds no focusable elements.- </td>- </tr>- <tr>- <td class="path">conversation-tabs/conversation-tabs.tsx</td>- <td><span class="tag">changed</span></td>- <td>- The inline row becomes the <code>tablist</code> (dropped when a narrow- drawer pushes every tab into the menu β a tablist owning no tabs is- not a tablist). Adds the roving-tabindex state and the- <code>β/β/Home/End</code> handler, and renames the overflow trigger.- </td>- </tr>- <tr>- <td class="path">conversation-tabs/conversation-tabs-context-menu.tsx</td>- <td><span class="tag">changed</span></td>- <td>Viewport-aware portal placement (clamp + flip), see Β§2.</td>- </tr>- <tr>- <td class="path">conversation-tab-content/tab-container.tsx</td>- <td><span class="tag">changed</span></td>- <td>- Becomes the <code>role="tabpanel"</code> with the shared id and an- <code>aria-label</code> carrying the selected tab's name.- </td>- </tr>- <tr>- <td class="path">conversation-tab-content/conversation-tab-content.tsx</td>- <td><span class="tag">changed</span></td>- <td>- <code>TAB_CONFIG</code> gains a <code>labelKey</code> per tab; passes- <code>label={t(activeTab.labelKey)}</code> to the panel.- </td>- </tr>- <tr>- <td class="path">src/i18n/translation.json</td>- <td><span class="tag">changed</span></td>- <td>- <code>CONVERSATION$TABS_LABEL</code> ("Conversation panels") and- <code>CONVERSATION$CUSTOMIZE_TABS</code> ("Customize tabs"), both with- all 15 locales.- </td>- </tr>- <tr>- <td class="path">__tests__/β¦/conversation-tabs.test.tsx</td>- <td><span class="tag">changed</span></td>- <td>- Seven cases: tablist + <code>aria-selected</code> +- <code>aria-controls</code>; the selected tab stays marked and on the- tab stop with the drawer closed; icon-only tabs are named; the open- tab holds the only tab stop; arrows move focus without changing the- open tab; <kbd>Enter</kbd> activates; the trigger's name.- </td>- </tr>- <tr>- <td class="path">__tests__/β¦/conversation-tabs-context-menu.test.tsx</td>- <td><span class="tag">changed</span></td>- <td>- Three placement cases against stubbed trigger/menu rects: anchors- below-left when it fits, clamps at the right edge, flips above at the- bottom edge.- </td>- </tr>- <tr>- <td class="path">__tests__/β¦/conversation-tab-content.test.tsx</td>- <td><span class="tag">changed</span></td>- <td>The content area is the <code>tabpanel</code>, named after the selected tab without an id reference.</td>- </tr>- </tbody>- </table>-- <h2>5 Β· What is deliberately not in this PR</h2>- <ul>- <li>- <strong>No <code>tabIndex={0}</code> on the panel.</strong> APG only asks- for it when the panel has no focusable content; these panels host a file- tree, a terminal and a browser view, and adding a focus stop over the- whole drawer risked changing terminal focus handling for no gain.- </li>- <li>- <strong>No <code>aria-expanded</code> on the overflow trigger.</strong>- That means touching the shared <code>EllipsisButton</code> used by four- other surfaces; the issue asks for the trigger's <em>name</em>, so that is- what changed here.- </li>- <li>- <strong>No change to pin/unpin or to the overflow measurement.</strong>- The existing localStorage tests cover both and still pass unmodified.- </li>- </ul>-- <p class="note" style="margin-top: 36px">- This page is a review aid under <code>.pr/</code> and is removed before- merge by <code>.github/workflows/pr-artifacts.yml</code>.- </p>- </div>- </body>-</html>diff --git a/.pr/issue-17268/keyboard-after.png b/.pr/issue-17268/keyboard-after.pngdeleted file mode 100644index 122dd7accb..0000000000Binary files a/.pr/issue-17268/keyboard-after.png and /dev/null differdiff --git a/.pr/issue-17268/keyboard-before.png b/.pr/issue-17268/keyboard-before.pngdeleted file mode 100644index 0401a850e9..0000000000Binary files a/.pr/issue-17268/keyboard-before.png and /dev/null differdiff --git a/.pr/issue-17268/overflow-menu-after.png b/.pr/issue-17268/overflow-menu-after.pngdeleted file mode 100644index 2ccd459e6a..0000000000Binary files a/.pr/issue-17268/overflow-menu-after.png and /dev/null differdiff --git a/.pr/issue-17268/overflow-menu-before.png b/.pr/issue-17268/overflow-menu-before.pngdeleted file mode 100644index 38c066873f..0000000000Binary files a/.pr/issue-17268/overflow-menu-before.png and /dev/null differdiff --git a/.pr/lint-verification.md b/.pr/lint-verification.mddeleted file mode 100644index 3689ea5d3a..0000000000--- a/.pr/lint-verification.md+++ /dev/null@@ -1,87 +0,0 @@-# Unknown-class lint adoption--Base: `a3cfe98267c52937dc4e91a55644a6131c6c01bc`. Pinned linter: `@shadcn/[email protected]`.--The rule is enabled at error level now that its initial findings are resolved. Four inert class usages are also removed; generated styling and the DOM structure are preserved.--## Inventory--`npx eslint src --rule 'shadcn/no-unknown-classes:warn' --format json` initially reported **6** unknown-class warnings, alongside **347** existing arbitrary-value warnings. No theme-loading or worker-fallback warnings were emitted.--Two exact exceptions are supported by code:--- `environment-switch-overlay`: `src/index.css:134` uses it to animate child elements; that stylesheet is outside the Tailwind theme import graph.-- `conversation-overview-diffs-git-action`: a selector target in `src/components/features/conversation/conversation-overview-diffs-row.tsx:40` for clearing row hover while the action is hovered.--All **4 genuine findings are fixed** by removing inert classes:--| File | Finding and correction |-| --- | --- |-| `src/components/features/chat/drag-over.tsx` | Remove `drag-over-content`, which has no stylesheet or selector consumer; retain the wrapper element. |-| `src/components/features/home/repo-selection-form.tsx` | Remove `max-w-auto`, which emits no CSS. |-| `src/components/features/home/workspace-selection-form.tsx` | Remove the same unsupported width class. |-| `src/utils/form-control-classes.ts` | Remove unsupported `ease`; retain the existing transform transition, duration, reduced-motion handling, and default timing. |--The dropdowns pass the optional class to `cn("relative", className)`; removing it does not reveal a previously overridden maximum width. Do not substitute `min-w-auto`: minimum width is a different property. Likewise, connecting the drag overlay to the similarly named `.drag-over-ui-content` rule would newly force white text and fixed typography. That is a separate visual decision, not necessary to remove an unused marker.--`node .pr/verify-inert-classes.mjs` verifies identical compiled CSS before/after removal with the actual Tailwind theme/plugins and checks that class merging preserves all valid utilities. A repository search found no CSS/JS/test consumers of the removed marker or utilities. The transition helper is shared by caret controls in both standalone and embedded Canvas, independent of backend/agent type; it retains its existing behavior in all consumers.--## Reproduction--Run `node .pr/verify-unknown-classes.mjs` from the repository root. It uses the actual ESLint config and virtual TSX under `src/ui`, verifying that the rule remains active inside component implementations.--Observed output:--```text-"hovr:flex" ... Did you mean "hover:flex"?-"flex-cols" ... Did you mean "flex-col"?-"environment-switch-overla" ... no CSS is generated for it.-PASS: real theme/plugins accepted; typos are errors; exceptions stay exact.-```--Accepted: Canvas surface/border/focus tokens, `prose`, `scrollbar-hide`, a HeroUI color with a data variant, and the two documented markers. This also detects the documented fallback mode that incorrectly accepts `hovr:flex`.--## Original adoption checks--Executed with Node 22.23.2, npm 10.9.8 on macOS (CI's supported Node environment should also run its normal checks):--- `npm run lint`: passed, **0 errors / 351 warnings** (347 existing + 4 new genuine findings).-- `npm run build`: passed.-- `npm run build:lib`: passed.-- `npm test -- --maxWorkers=2`: **733 files passed / 1 failed; 7,718 tests passed / 1 failed / 7 todo**. The existing `DeleteProfileModal > calls deleteProfile and shows success toast on successful delete` assertion expected a success-toast call but observed zero. No runtime source changed in this branch. Rerunning that file alone passed all 12 tests; the full-suite failure remains disclosed.-- Initial sandboxed test attempt was stopped because launcher tests could not bind local ports. Results above are from the rerun with port access.--The pinned rule delegates some missing color-token diagnostics to `no-raw-colors`; it is not a complete missing-token guard, nor does it detect the semantic `text-base` collision. Other rules retain their original settings.--This directory is PR-only evidence. Fork PRs require manual `.pr/` cleanup before merge.--## Warning cleanup checks--- `node .pr/verify-inert-classes.mjs`: passed; merged valid classes and compiled CSS are identical for all removals.-- `node .pr/verify-unknown-classes.mjs`: passed; valid theme/plugin utilities and exact selector exceptions accepted while typos remain reported.-- `npm run lint`: passed, **0 unknown-class warnings / 347 existing arbitrary-value warnings / 0 errors**; formatting and TypeScript checks passed.-- `npx vitest run __tests__/components/features/home/repo-selection-form.test.tsx __tests__/components/features/home/workspace-selection-form.test.tsx __tests__/components/features/home/git-repo-dropdown.test.tsx __tests__/components/features/home/workspace-dropdown.test.tsx __tests__/utils/form-control-classes.test.ts --maxWorkers=2`: **5 files / 69 tests passed**.-- `npm run build` and `npm run build:lib`: passed.-- No visual change is claimed: the removed classes have no styling or selector consumers, and the compiled CSS comparison above is identical. The PR also includes real-app workspace screenshots to satisfy frontend evidence CI; they are a smoke comparison, not pixel-diff coverage of every component.-- The original PR head passed Ubuntu and Windows test/build CI. The checks above disclose the earlier local full-suite flake; no new tests or weakened assertions were introduced for inert class removal.--### Real-app screenshot setup--`PATH=/opt/homebrew/opt/node@22/bin:$PATH VITE_DO_NOT_TRACK=1 npm run dev:mock -- --host 127.0.0.1 --port 3196 --strictPort`--Open Workspace in the real Canvas UI using MSW data. `workspace-before.png` uses the four affected source files from `0bfdebb`; `workspace-after.png` uses `a35e74e`. The same running app applied the revisions through Vite HMR. No live LLM or credentials were used. The workspace field and its shared caret retain their appearance; compiler/merge parity covers all four removals.--## Error-level enforcement after updating from main--Merged upstream main at `35dc8aafaad2d883cf0c6629dea857eb2235895e` following [review 5297880470](https://github.com/OpenHands/OpenHands/pull/17644#pullrequestreview-5297880470). With the initial findings resolved, `shadcn/no-unknown-classes` is now `error`; both exact exceptions and every other rule setting are unchanged. This supersedes the issue's original warning-level rollout. CI continues to use ordinary `npm run lint`, without a warning-count gate.--Verified on the merged tree with a fresh `npm ci` (Node 22.23.2):--- `npm run lint`: passed, **zero unknown-class findings / zero errors / 376 existing `shadcn/no-arbitrary-values` warnings**. TypeScript and formatting checks also passed.-- `node .pr/verify-unknown-classes.mjs`: passed; each deliberately invalid utility/variant is severity 2, representative project/plugin utilities are accepted, and exceptions remain exact.-- Real CLI negative check: created a temporary `src/ui/lint-rule-probe-*.tsx` containing `export const Probe = () => <div className="hovr:flex" />;`, ran `node node_modules/eslint/bin/eslint.js <file> --format json`, then removed the file in `finally`. **Exit 1**, exactly one error, from `shadcn/no-unknown-classes`; no parser/fatal error. The earlier stdin attempt was unsuitable for the project-aware parser, so the final check used an actual source file.-- `node .pr/verify-inert-classes.mjs`: passed; the merged theme still generates identical CSS for the removals.-- The five form/dropdown/helper test files listed above: **70 tests passed** on current main.-- `npm run build` and `npm run build:lib`: passed.--Full-suite CI will rerun on the pushed merge. The historical checks above refer to earlier heads; no new full-suite local result is claimed here.diff --git a/.pr/verify-inert-classes.mjs b/.pr/verify-inert-classes.mjsdeleted file mode 100644index 5bbda09eaa..0000000000--- a/.pr/verify-inert-classes.mjs+++ /dev/null@@ -1,38 +0,0 @@-import assert from "node:assert/strict";-import { readFileSync } from "node:fs";-import { resolve } from "node:path";-import { compile } from "@tailwindcss/node";-import { twMerge } from "tailwind-merge";--// PR-only evidence: run from the repository root with installed dependencies.-// These are the affected elements' class combinations, including the shared-// caret transition helper. Removal must not resurrect a merged-away utility.-const pairs = [- ["drag-over-content", ""],- ["relative max-w-auto", "relative"],- [- "transition-[transform] ease duration-75 motion-reduce:transition-none",- "transition-[transform] duration-75 motion-reduce:transition-none",- ],-];-const stylesheet = readFileSync("src/tailwind.css", "utf8");-async function css(classes) {- const compiler = await compile(stylesheet, {- base: resolve("src"),- onDependency() {},- });- return compiler.build(twMerge(classes).split(/\s+/).filter(Boolean));-}-for (const [before, after] of pairs) {- assert.equal(await css(before), await css(after));- assert.equal(- twMerge(before)- .split(/\s+/)- .filter((c) => !["drag-over-content", "max-w-auto", "ease"].includes(c))- .join(" "),- twMerge(after),- );-}-console.log(- "PASS: merged valid classes and compiled CSS are identical for all removals.",-);diff --git a/.pr/verify-unknown-classes.mjs b/.pr/verify-unknown-classes.mjsdeleted file mode 100644index 3fca1842ed..0000000000--- a/.pr/verify-unknown-classes.mjs+++ /dev/null@@ -1,47 +0,0 @@-import assert from "node:assert/strict";-import { ESLint } from "eslint";--// Run from the repository root: node .pr/verify-unknown-classes.mjs-// Use the real flat config and theme, but let lintText accept a virtual TSX file.-const eslint = new ESLint({- overrideConfig: [- {- languageOptions: { parserOptions: { project: null } },- rules: { "@typescript-eslint/prefer-optional-chain": "off" },- },- ],-});-const classes = [- "hovr:flex",- "flex-cols", // Deliberate mistakes; also detect grammar fallback.- "bg-surface-raised",- "border-border-input",- "ring-focus", // Canvas theme.- "prose",- "scrollbar-hide",- "data-[hover=true]:bg-default-100", // Plugins.- "environment-switch-overlay",- "conversation-overview-diffs-git-action", // Exceptions.- "environment-switch-overla", // A nearby typo must still be reported.-];-const [result] = await eslint.lintText(- `export const probe = <div className="${classes.join(" ")}" />;`,- { filePath: "src/ui/lint-probe.tsx" },-);-assert.equal(result.fatalErrorCount, 0);-const findings = result.messages.filter(- (m) => m.ruleId === "shadcn/no-unknown-classes",-);-assert.deepEqual(findings.map((m) => m.message.match(/^"([^"]+)"/)[1]).sort(), [- "environment-switch-overla",- "flex-cols",- "hovr:flex",-]);-for (const finding of findings) {- assert.equal(finding.severity, 2);- console.log(finding.message);-}--console.log(- "PASS: real theme/plugins accepted; typos are errors; exceptions stay exact.",-);diff --git a/.pr/workspace-after.png b/.pr/workspace-after.pngdeleted file mode 100644index 149a0d868b..0000000000Binary files a/.pr/workspace-after.png and /dev/null differdiff --git a/.pr/workspace-before.png b/.pr/workspace-before.pngdeleted file mode 100644index 9236b6fa4a..0000000000Binary files a/.pr/workspace-before.png and /dev/null differdiff --git a/__tests__/utils/rate-limit-retry.test.ts b/__tests__/utils/rate-limit-retry.test.tsnew file mode 100644index 0000000000..3123b3c5e2--- /dev/null+++ b/__tests__/utils/rate-limit-retry.test.ts@@ -0,0 +1,64 @@+import { AxiosError } from "axios";+import { afterEach, describe, expect, it, vi } from "vitest";+import { getQueryRetryDelay, isRateLimitError } from "#/utils/rate-limit-retry";++afterEach(() => {+ vi.restoreAllMocks();+});++describe("isRateLimitError", () => {+ it("recognizes a 429 surfaced via AxiosError.response.status", () => {+ const error = new AxiosError(+ "Too Many Requests",+ "ERR_BAD_REQUEST",+ undefined,+ undefined,+ {+ status: 429,+ } as never,+ );+ expect(isRateLimitError(error)).toBe(true);+ });++ it("recognizes a 429 surfaced via AxiosError.status directly", () => {+ const error = new AxiosError("Too Many Requests");+ error.status = 429;+ expect(isRateLimitError(error)).toBe(true);+ });++ it("recognizes a 429 on a duck-typed HttpError-shaped object", () => {+ expect(isRateLimitError({ status: 429 })).toBe(true);+ });++ it("returns false for non-429 errors", () => {+ expect(isRateLimitError(new AxiosError("Server error"))).toBe(false);+ expect(isRateLimitError({ status: 500 })).toBe(false);+ expect(isRateLimitError(null)).toBe(false);+ expect(isRateLimitError(undefined)).toBe(false);+ expect(isRateLimitError("not an error")).toBe(false);+ });+});++describe("getQueryRetryDelay", () => {+ it("caps the delay and never returns a negative or zero value", () => {+ for (let attempt = 0; attempt < 10; attempt += 1) {+ const delay = getQueryRetryDelay(attempt, new Error("boom"));+ expect(delay).toBeGreaterThan(0);+ expect(delay).toBeLessThanOrEqual(30000);+ }+ });++ it("backs off further for a confirmed rate-limit error than a generic error at the same attempt", () => {+ vi.spyOn(Math, "random").mockReturnValue(1);+ const rateLimited = getQueryRetryDelay(1, { status: 429 });+ const generic = getQueryRetryDelay(1, new Error("boom"));+ expect(rateLimited).toBeGreaterThan(generic);+ });++ it("applies jitter so repeated calls for the same attempt are not identical", () => {+ const delays = new Set(+ Array.from({ length: 20 }, () => getQueryRetryDelay(3, { status: 429 })),+ );+ expect(delays.size).toBeGreaterThan(1);+ });+});diff --git a/src/hooks/query/use-cloud-organizations.ts b/src/hooks/query/use-cloud-organizations.tsindex 352e5af92d..5985795618 100644--- a/src/hooks/query/use-cloud-organizations.ts+++ b/src/hooks/query/use-cloud-organizations.ts@@ -69,6 +69,13 @@ export function useAllCloudOrganizations() {failureCount < 2 && !isAuthorizationError(error),// Mounting workspace consumers must not restart a failed startup query.retryOnMount: false,+ // Org membership rarely changes mid-session and is already fetched+ // once per backend with a 5-minute staleTime. Refetching on every+ // window focus means this query re-fires for every registered cloud+ // backend each time the tab regains focus, which compounds with+ // every other focus-triggered query into the kind of burst that+ // trips a server-side rate limiter.+ refetchOnWindowFocus: false,meta: { disableToast: true },})),});diff --git a/src/hooks/query/use-sub-conversations.ts b/src/hooks/query/use-sub-conversations.tsindex c7de6c4abd..6b66d71ace 100644--- a/src/hooks/query/use-sub-conversations.ts+++ b/src/hooks/query/use-sub-conversations.ts@@ -2,8 +2,10 @@ import { useQuery } from "@tanstack/react-query";import AgentServerConversationService from "#/api/conversation-service/agent-server-conversation-service.api";import { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";import { useActiveBackend } from "#/contexts/active-backend-context";+import { isRateLimitError } from "#/utils/rate-limit-retry";import { CONVERSATION_QUERY_KEYS } from "./query-keys";+const MAX_RATE_LIMIT_RETRIES = 2;const FIVE_MINUTES = 1000 * 60 * 5;const FIFTEEN_MINUTES = 1000 * 60 * 15;@@ -47,6 +49,11 @@ export const useSubConversations = (enabled: ids.length > 0,staleTime: FIVE_MINUTES,gcTime: FIFTEEN_MINUTES,- retry: false,+ // Same rate-limit-aware retry and no eager window-focus refetch as+ // `useUserConversation` β these two hooks hit the same batch endpoint+ // and compound into the same burst otherwise.+ retry: (failureCount: number, error: unknown) =>+ failureCount < MAX_RATE_LIMIT_RETRIES && isRateLimitError(error),+ refetchOnWindowFocus: false,});};diff --git a/src/hooks/query/use-user-conversation.ts b/src/hooks/query/use-user-conversation.tsindex 89adc167c4..e037c2cd92 100644--- a/src/hooks/query/use-user-conversation.ts+++ b/src/hooks/query/use-user-conversation.ts@@ -5,7 +5,9 @@ import { AxiosError } from "axios";import AgentServerConversationService from "#/api/conversation-service/agent-server-conversation-service.api";import { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";import { useActiveBackend } from "#/contexts/active-backend-context";+import { isRateLimitError } from "#/utils/rate-limit-retry";+const MAX_RATE_LIMIT_RETRIES = 2;const FIVE_MINUTES = 1000 * 60 * 5;const FIFTEEN_MINUTES = 1000 * 60 * 15;@@ -58,7 +60,17 @@ export const useUserConversation = (return results[0] ?? null;},enabled: !!cid && !cid.startsWith("task-") && !backendChanged,- retry: false,+ // Rate limits (429) are transient and worth a couple of backed-off+ // retries; any other failure (404, 5xx, network) fails immediately as+ // before rather than masking a real problem.+ retry: (failureCount, error) =>+ failureCount < MAX_RATE_LIMIT_RETRIES && isRateLimitError(error),+ // Freshness while it matters is already covered by `refetchInterval`+ // above. Refetching on every window focus too means every open+ // conversation tab/browser tab fires a request the instant it regains+ // focus β a burst that's a prime way to trip a rate limiter when+ // several tabs are open.+ refetchOnWindowFocus: false,refetchInterval,staleTime: FIVE_MINUTES,gcTime: FIFTEEN_MINUTES,diff --git a/src/query-client-config.ts b/src/query-client-config.tsindex c4d28ea881..e96cd656bb 100644--- a/src/query-client-config.ts+++ b/src/query-client-config.ts@@ -6,6 +6,7 @@ import { retrieveAxiosErrorMessage } from "./utils/retrieve-axios-error-message"import { displayErrorToast } from "./utils/custom-toast-handlers";import { getActiveBackend } from "#/api/backend-registry/active-store";import { recordBackendSuccess } from "#/api/backend-registry/health-store";+import { getQueryRetryDelay } from "./utils/rate-limit-retry";const handle401Error = (error: AxiosError, client: QueryClient) => {if (error?.response?.status === 401 || error?.status === 401) {@@ -30,6 +31,16 @@ const shownErrors = new Set<string>();export const createAgentServerQueryClient = () => {const client = new QueryClient({+ defaultOptions: {+ queries: {+ // Jittered exponential backoff, with extra backoff on a confirmed+ // 429, so a burst of queries that all got rate-limited together+ // (e.g. every open browser tab refetching on window focus at once)+ // don't retry in lockstep and immediately re-trip the limiter.+ // Queries that set their own `retryDelay` are unaffected.+ retryDelay: getQueryRetryDelay,+ },+ },queryCache: new QueryCache({onSuccess: (_data, query) => {const backendId =diff --git a/src/utils/rate-limit-retry.ts b/src/utils/rate-limit-retry.tsnew file mode 100644index 0000000000..8794ca4402--- /dev/null+++ b/src/utils/rate-limit-retry.ts@@ -0,0 +1,50 @@+import { AxiosError } from "axios";++const BASE_DELAY_MS = 1000;+const MAX_DELAY_MS = 30000;+/**+ * Extra backoff multiplier applied on top of the normal exponential curve+ * once a request has actually been rate-limited (429). A plain network+ * blip should back off quickly; a server telling us to slow down should+ * back off harder so a burst of tabs/queries don't all retry in lockstep+ * and immediately re-trip the limiter.+ */+const RATE_LIMIT_BACKOFF_MULTIPLIER = 2;++/**+ * True for a 429 from either transport this app talks to a backend with:+ * Axios (agent-server / legacy cloud calls) or the duck-typed `{ status }`+ * shape `@openhands/typescript-client`'s `HttpError` uses for the cloud+ * proxy. `HttpError` isn't imported here to keep this usable from any+ * query regardless of which client raised the error.+ */+export function isRateLimitError(error: unknown): boolean {+ if (error instanceof AxiosError) {+ return error.response?.status === 429 || error.status === 429;+ }+ if (error && typeof error === "object" && "status" in error) {+ return (error as { status?: unknown }).status === 429;+ }+ return false;+}++/**+ * Default `retryDelay` for the shared query client: exponential backoff+ * capped at 30s, with full jitter so concurrent queries (e.g. every open+ * browser tab refetching on window focus at once) don't retry in sync and+ * re-create the burst that got them rate-limited in the first place.+ * Doubles the base delay on a confirmed 429 before applying jitter.+ */+export function getQueryRetryDelay(+ attemptIndex: number,+ error: unknown,+): number {+ const multiplier = isRateLimitError(error)+ ? RATE_LIMIT_BACKOFF_MULTIPLIER+ : 1;+ const capped = Math.min(+ BASE_DELAY_MS * multiplier * 2 ** attemptIndex,+ MAX_DELAY_MS,+ );+ return Math.round(capped * (0.5 + Math.random() * 0.5));+}