Skip to content

Browse: retry on 502, auto-refresh, a fixed ⌘K; resume any time - #303

Merged
Mpdreamz merged 20 commits into
mainfrom
fix/browse-502
Nov 19, 2026
Merged

Mpdreamz merged 20 commits into
mainfrom
fix/browse-502

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

Four pieces that touch the same Browse code, merged and verified once together so they cost one CI run.

Browse survives GitHub timeouts

A big search could come back HTTP 502 and the raw error reached the screen. Browse now asks again from the same cursor at a smaller page (100, 50, 25, 10, then a light fragment without check status and reviewers), with short backoffs, remembers the size per search, and ends with "GitHub timed out running this search. Narrow it: a repo, a label, or a shorter age." Permanent errors (auth, SAML, bad query) are not retried; a secondary rate limit waits once. Each chunk of the checked-out-orgs search retries on its own cursor, and a chunk that cannot finish fails the whole fetch rather than showing a partial list. Two bugs found on the way: a GraphQL timeout (data: null) was read as "no results", and multi-page searches double-counted the total.

Auto-refresh

Browse refreshes when you come back to it (view switch, app active, window key) when the last answer is older than [browse] refresh_after (60 s), [browse] auto_refresh turns it off. Updates to rows you already have apply silently by id and never move a row. New, removed or reordered rows wait behind a banner ("3 new · 1 gone · 5 reordered") while you have an item selected, picks, a pushed reader, a live run or an open builder; r applies them, keeping the cursor on the same item and the picks. The count line says "updated 2m ago". Gone rows are removed from the cache.

⌘K

  • Switching to Browse now leaves INSERT mode. In INSERT every key goes to a terminal, so a session you were typing into left ⌘K (and j/k) dead in Browse. Not reproduced with a real keystroke; found by reading the key path and covered by a test.
  • The jump also lists saved queries first and ends with "Search GitHub for “…”" (⌘↩ searches the typed text), and a long list scrolls.

Resume any time

Right-click on a session always lists Resume its agent, Copy resume command and Start its agent fresh. gu forces a resume (kept id: the agent's own resume; no id: its latest-conversation form where one exists). A running agent greys Resume and Start fresh out with the reason; Copy still works. gY copies the exact command with the injected hooks, valid after heed exits, with secrets left off. Host and parked sessions are disabled with reasons. Built on the same launch builder as the resume banner.

Verified

mise run lint, swift build, the full suite (3033 tests), mise run text-check, mise run bundle, scripts/tutor-check.sh (0 problems), the docs build (0 warnings); the Browse, resume and menu shots regenerated and read; mutation checks on each part's tests.

Not tested

No live 502 reproduced (the retry ladder is tested against a fake gh). No real ⌘K keystroke injected, so the INSERT cause is likely, not proven. No real agent resume run (claude --resume/--continue). Auto-refresh's activation observers and the landing of a real fetch are unexercised.

🤖 Generated with Claude Code

Mpdreamz and others added 20 commits November 19, 2026 11:32
…ettings

BrowseDiff splits a fresh answer into in-place updates and the structural part (new, gone, reordered);
BrowseRefreshApply keeps the cursor and picks by id; BrowseRefreshPolicy decides when to ask and what to hold.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… held behind a banner

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…e, the menus always list resume

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A search over a big org asks for a hundred heavy nodes per page and GitHub can answer HTTP 502/504 or a timeout.
Browse now classifies the failure (BrowseFetchPolicy), retries the same page from the same cursor at 100, 50, 25,
10 and then 10 without checks and reviewers, remembers the size for the scope and query, waits out a secondary
rate limit once up to 30 s, and ends with a message that says to narrow the search. The count, repo count and org
repo list retry too; a null-data answer is a failure; GitHub.explain never returns a gateway page; the total is
what GitHub says, not a sum over pages.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…g into leaves INSERT

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
# Conflicts:
#	Sources/HeedCore/Browse/BrowseFetch.swift
# Conflicts:
#	Sources/HeedCore/Browse/BrowsePalette.swift
# Conflicts:
#	Sources/HeedApp/Browse/BrowseModel.swift
#	Sources/HeedApp/Views/BrowseView.swift
…s, dimmed orgs, search)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…d rows; browse-none shot enters Browse first

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions github-actions Bot added the bug Something isn't working label Nov 19, 2026
@Mpdreamz
Mpdreamz merged commit 1ee41db into main Nov 19, 2026
7 of 8 checks passed
@Mpdreamz
Mpdreamz deleted the fix/browse-502 branch November 19, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant