Repository navigation
Read every project's pull requests from the start and keep the last answer across restarts - #407
Merged
Merged
Conversation
yansfil
force-pushed
the
fix/sidebar-pr-state-on-start
branch
from
October 4, 2026 17:53
1dc521a to
c46da25
Compare
…every five minutes, and keep the last answer across restarts The sidebar row's pull request state no longer waits for Overview or the palette to ask for a project. The core reads all local Git projects (the project in front and screen-named ones first, at most 64, past that is logged), asks again five minutes after a project's last answer, saves the last successful answer to github-snapshot.json in the state folder off the runtime lock, and restores it as stale when the daemon starts.
…ake the fake gh answer both list calls
yansfil
force-pushed
the
fix/sidebar-pr-state-on-start
branch
from
October 4, 2026 18:21
c46da25 to
e22aedc
Compare
This was referenced Oct 4, 2026
yansfil
added a commit
that referenced
this pull request
Oct 5, 2026
…522) Related: #390 (PR 상태와 worktree 정리), #407, #411 ## Summary agent가 연 PR이 사이드바 체크아웃 행에 붙기까지 최대 5분이 걸렸습니다. 프로젝트의 GitHub 재조회가 직전 응답 5분 뒤에야 다시 돌기 때문입니다. 이제 label worker가 agent 대화 기록에서 이미 추출하던 PR 주소를 신호로 씁니다. core의 GitHub 응답에 없는 주소가 보이면, 그 PR을 소유한 프로젝트를 기존 reader의 generation bump로 곧바로 다시 읽습니다. push 시점은 트리거로 쓰지 않았습니다. push가 `gh pr create`보다 먼저라서 그때 읽으면 PR이 아직 없습니다. 대화 기록은 agent 상태가 바뀔 때 읽히므로, 늦어도 그 agent의 턴이 끝날 때 반영됩니다. 화면 구성은 바뀌지 않습니다. 기존 PR 글리프가 더 일찍 붙을 뿐이고, 이 조회 동안에는 `loading`을 띄우지 않습니다. ## Review - **판단해 주세요**: 프로젝트는 같은 `owner/name`의 PR을 가진 프로젝트로 고릅니다. 그런 프로젝트가 없으면 주소를 출력한 pane의 프로젝트(다른 저장소의 PR이 없을 때만)를 씁니다. fork 체크아웃에서 upstream으로 연 PR은 다시 읽지 않습니다. - **판단해 주세요**: 주소 하나당 추가 조회는 출력 후 15분 안에 한 번만 합니다. 200개 목록 밖의 PR이나 다른 저장소의 PR 때문에 같은 조회가 반복되지 않게 하려는 것입니다. - **조심해서 볼 파일**: `herdr-core/src/runtime/projects.rs` - failure path. 응답을 아직 받지 못한 조회(5분 주기, 새로고침, request view, 앞선 sighting)가 있으면 앞질러 읽지 않습니다. 그 응답이 PR을 담고 있지 않을 때만 한 번 더 읽고, 연속 실패 중인 프로젝트는 읽지 않습니다. 앞질러 읽으면 `publish_github`가 진행 중이던 응답을 통째로 버립니다. - **조심해서 볼 파일**: `herdr-core/src/session_sync/coordinator.rs` - runtime mutex. `exchange_pull_requests`는 lock 구간 하나로 sighting을 넘기고 PR 시각을 받아 옵니다. 시각은 lock 밖에서 읽고, sighting이 없으면 하는 일이 새로 생기지 않습니다. - **비용 검토**: sighting이 있을 때만 lock 안에서 메모리 작업이 늘어납니다(주소당 맵 조회와 프로젝트 1회 스캔). 상한은 worker 대기 32개(초과 시 `read.sighted_capped`)와 기억 주소 64개(초과 시 `read.sighted_over_limit`)입니다. 소유자가 없는 주소는 자리를 차지하지 않습니다(`read.sighted_unowned`). `docs/PERFORMANCE_TESTING.md` GitHub 행을 갱신했습니다. - **질문**: 메뉴 PR 새로고침과 request view의 check 재조회도 진행 중인 조회를 앞지를 수 있습니다(같은 응답 폐기). 이번 범위 밖이라 그대로 뒀는데, 이슈로 남길까요? ## Evidence - **확인한 것**: runtime 테스트로 다음을 확인했습니다. - 소유 프로젝트 매핑과 첫 PR 매핑. - 응답을 기다리는 조회가 있으면 앞지르지 않음(첫 조회, 새로고침, 처리 전 응답, 앞선 sighting 조회). - 응답 후 PR이 없을 때만 1회 조회. - 실패 backoff 중이면 조회하지 않음. - 15분이 지났거나 시계가 앞선 기록은 아무것도 일으키지 않음. - 64개 상한과 소유자 없는 주소 70개. - **확인한 것**: label worker 테스트로 실제 transcript 읽기를 통한 추출, 최신 32개 유지, device worker는 sighting을 보관하지 않음을 확인했습니다. - **확인한 것**: 핵심 테스트마다 해당 코드를 빼서 실패하는 것을 확인했습니다(mutation 확인). 대상은 앞지르기 방지, 응답 후 재조회, 신선도 정리, 시계 앞섬 상한, device 차단입니다. - **확인한 것**: `verify-cargo.sh lint` 통과, `nextest -p herdr-core` 1428/1428 통과. 별도 리뷰 3회의 Fix-now를 모두 반영했습니다. - **확인하지 못한 것**: worker에서 `exchange_pull_requests`를 거쳐 runtime까지 한 번에 지나가는 테스트는 없습니다. coordinator 테스트 fixture로는 로컬 Git 프로젝트를 만들 수 없어서, 이 연결부(약 10줄)는 코드 리뷰로만 확인했습니다. - **확인하지 못한 것**: 실제 `gh`로 agent가 PR을 여는 라이브 확인은 하지 않았습니다. CI e2e도 이 경로를 지나지 않습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #391 (part of #390). Rebased over #408 (two-call PR query, head-commit linking); this PR does not change the query or the linking rule.
Summary
After a daemon restart the sidebar drew every worktree as a plain branch until Overview or the palette asked for that project, because the core read GitHub only for the focused project and a memory-only set those screens filled, and kept nothing on disk.
Now the core reads GitHub for every local Git project on its own once a window is attached, asks again five minutes after a project's last answer, and saves the last successful answer to
github-snapshot.jsonin the state folder.A restart restores that file as stale, so the first frame already draws the previous run's pull requests, muted, until the first read replaces them.
A failed read still keeps the last value, now across a restart too.
No UI change: the same icons appear without the screens that used to be needed to ask for them.
Review
GITHUB_PROJECT_LIMIT). Past it the project in front is read first, then projects a screen named withgithub_request/overview_refresh, then the rest by path; the count is logged asprojects.over_limit. A project left out shows no PR icon.herdr-core/src/github_store.rs- the file keeps what the wire omits (head_oid,cross_repository, created/closed times) so a settled pull request reconnects to its worktree after a restart; a newskip_serializingfield onPullRequestSnapshotmust be added there (the round-trip test builds the type literally, so it fails to compile). New off-lock writer: one thread, one pending slot,hide_platform::fsatomic replace, joined on drop; a file that is unreadable, damaged or of another schema version is discarded with asnapshot.discardeddiagnostic.herdr-core/src/runtime/projects.rs-github_request,reread_stale_github,ingest_github_answer. An empty answer to an empty request is ignored so a navigator that has not arrived cannot erase the restored answer or its file.herdr-core/src/handle.rs- the file is read before the runtime lock is taken; no I/O underMutex<Runtime>(check-capability-readers-off-lock.shpasses).ghpass happens per due project every 5 minutes only while a window is attached (the reader stays in the UI-attached block). Ledger row added todocs/PERFORMANCE_TESTING.md.Evidence
Confirmed:
lintandtestfor the whole workspace pass on the rebased head (herdr-core lib 1267 passed); the capability-readers-off-lock, workstation-identity and harness-anchor gates pass;web lint,typecheckandbuildpass.Confirmed: the 16 new Rust tests (
runtime/tests/github_reads.rs,github_store.rs) ran 20 times in a row with no failure; they use injectedInstants, a temp folder and nogh, network or sleep. One of them covers Read PR checks for open PRs only and attach settled PRs by commit #408's rule: a merged pull request plus a worktree on its head commit, saved, restored in a new runtime, attaches to the worktree, and stops attaching when the head moves. They cover the request set (local Git only, path order), the five-minute cycle including the unanswered-ask case, the cap,loadingending for a project the reader returns nothing for, restore as stale withlast_success_at_unix_mskept, a failed read keeping the restored value, and damaged or other-version files.Confirmed: new
web/e2e/sidebar-pr-start.spec.tsran 20 times in a row, no failure, on an isolated pinned Herdr and hided with a fakeghthat answers both of the reader'spr listcalls (two repositories, neither the project in front). Each start resumes on a Workspace with the right panel on Explorer; no Overview, project Overview or palette opens, and the page's wire carries only terminal and usage-hint events, asserted as zerogithub_requestand zerooverview_refresh. Start 1: both rows draw their lifecycle. Start 2 (ghdown): both draw muted as stale. Start 3 (ghback): both replace it, all without any screen asking. With the snapshot file deleted before the restart the spec fails.Confirmed: the new cap-priority tests (project in front, screen-named project, a named project that is no longer registered) are part of the 20 repeated runs of the Rust tests, 10 in
github_reads.rs, 5 ingithub_store.rsand 1 inruntime/tests/pull_requests.rs.Not confirmed: real
ghagainst this repository and a packaged app. The e2e uses a fakeghand an isolated daemon;/Applications/hide.appand the operator's daemon were not touched.Not confirmed: a first pass over many slow projects publishes only when the whole pass finishes, so a large first pass can take a while to fill the sidebar; no timing was measured.
CI note:
e2e/overview-modal.spec.ts:7failed in the first CI run (toBeFocusedafter the Overview modal closes). Under the same CPU load (6 busy loops, 3 workers,--retries 0)origin/mainfailed 6/30 and this branch 7/30; an earlier smaller run was 1/15 on main and 3/15 here. Failures are focus-handoff steps (lines 92 and 100) and several failing pages show the shellreconnecting. It reproduces on main, so this change is not its cause; it is not fixed here.hide-platforma_burst_is_bounded_and_ends_in_an_overflow_rather_than_silenceandonly_a_guarded_launch_returns_startup_prooffailed in local full runs while other jobs loaded the machine; this PR does not touchhide-platform.Verification record
Arcinstead of a clone under the lock, partial-navigator saves.