fix(status-line): deduplicate PR lookups across instances - #4332
fix(status-line): deduplicate PR lookups across instances#4332designinglaunguage wants to merge 1 commit into
Conversation
Prevent idle render cycles from repeatedly spawning GitHub CLI processes.
|
Maintainer intake — owning #4331 / #4332 (sole maintainer lane) Taking ownership of this issue/PR pair. Exact state at intake:
CI attribution (run 31569177598):
Next: adversarial cache-lifecycle review + maintainer formatting repair, then baseline attribution, then a fresh exact-head CI signal. Review verdict follows. — gjc maintainer lane (Yeachan-Heo) · worktree |
|
Maintainer disposition — fixed forward, integrating via #4348 Exact head reviewed: CI attribution on that head (run 31569177598):
Cache-lifecycle review of the diff itself: the in-flight lookup dedup and TTL cache with insert-time expired-entry sweep are correct — bounded process-lifetime memory, correct repo/branch key isolation, and correct Integrated candidate targeting — |
) * fix(status-line): deduplicate PR lookups Prevent idle render cycles from repeatedly spawning GitHub CLI processes. * fmt(status-line): collapse gh test import to satisfy biome CI `check` job failed on the exact PR head because the added lookupCurrentPrCached/lookupCurrentPr/clearCurrentPrCache import spans three lines; repo-pinned biome 2.5.2 requires a single-line import at this length. Auto-fixed with `biome check --write`, no behavior change. Lore-id: pr4332-biome-fmt Constraint: keep the PR diff scoped to status-line PR-lookup dedup only Rejected: reformat unrelated packages/natives/native/index.d.ts drift | out of PR scope, reverted to origin content Confidence: high Scope-risk: narrow Reversibility: trivial Tested: bun test packages/coding-agent/test/status-line-gh.test.ts (13 pass); bunx biome check (clean) * fix(status-line): bound prCache memory and skip gh spawn without pr segment The process-lifetime prCache map had no eviction path: expired entries accumulated indefinitely across many repos+branches within one process. Gate the status snapshot so #lookupPr() is never called when the user's segment layout has no pr segment. The pr segment renders nothing on null, so suppressing the spawn is behavior-identical. Lore-id: pr4332-evict-gate Constraint: eviction must run on insert, not on a timer (no background work in TUI) Constraint: pr-segment gating must not change visible status when pr is absent Tested: bun test status-line-gh.test.ts — 13 pass including eviction + clear tests Tested: biome check + tsc --noEmit clean Confidence: high Scope-risk: narrow Reversibility: trivial --------- Co-authored-by: juns <juns@local> Co-authored-by: gaebal-gajae (clawdbot) <clawdbot@gaebal-gajae.local>
|
Integration complete — merged to dev via #4348 This PR was integrated, repaired, and merged into Merge commit: What was integrated from the original PR
Maintainer repairs on top (preserving original authorship)
Contributor creditOriginal cache design, in-flight dedup, and lifecycle tests by @designinglaunguage (commit CI on the merged headDev CI run Closing this PR as superseded by the merged #4348. — |
Closes #4331.
What changed
Why
The existing instance cache accepts
null, but long-lived render/config lifecycles can still produce repeated status-line instances/lookups. In observed use this spawnedgh pr view --json number,url5–28 times per 10 seconds and kept affected idle GJC processes at roughly 45–87% of one CPU core.Verification