Repository navigation
Description
Context
#1646 fixed the runaway that exhausted the GitHub GraphQL budget, and set positive TTLs of
180 s (open PR/issue lists) and 600 s (the two 24 h search windows) to bound forge spend.
Those TTLs do not govern spend as completely as they look, because
POST /api/overview/refresh bypasses them by design — a refresh means "fetch now" — and
that route is fired automatically, not by a human:
commands/porch/index.ts— after every mutating porch commandapps/vscode/src/review-queue/overview-nudge.ts— every review-queue mutationagent-farm/commands/cleanup.ts
In a workspace with a dozen builders running porch, the invalidation rate governed spend
rather than the TTLs. #1646 shipped a 60 s debounce on invalidation-driven refreshes,
which puts a ceiling back on (~4× idle for the busiest workspace) but is a cap on the
symptom.
The actual problem
Almost none of those invalidations can have changed the forge lists. A porch phase
transition moves builder state — which is filesystem-derived and refreshes on every 2.5 s
poll regardless of any cache. The forge-backed lists change only when a PR is opened or
merged, or an issue is closed.
So the overview cache is being told "your GitHub data is stale" by events that cannot have
made it stale.
What to build
Scope the invalidation to what actually changed.
- The refresh route takes a scope — e.g.
POST /api/overview/refresh?scope=forge|local. - porch sends
forgeonly for the commands that touch a PR or issue (porch done --pr N,
--merged N, issue closure); everything else sendslocal, which invalidates nothing
forge-backed. - VSCode's review-queue nudge and
cleanupare audited the same way. localrefreshes skip the debounce (they cost nothing);forgerefreshes keep it.- A test asserting a phase-transition refresh spends no forge commands.
Touches porch's Tower client, the route contract, TowerClient.refreshOverview(), and
OverviewCache.invalidate().
Rejected alternative
Make invalidate() simply stop clearing the forge caches. Correct in effect and a
one-line change, but it silently removes a behaviour people rely on: #388 added
refresh-forces-refetch so a dashboard user pressing Refresh gets fresh GitHub data, and a
genuine PR merge would then take up to 180 s to appear with no way to hurry it. Scoping
keeps the fast path for events that warrant it and drops it only for events that do not,
which is the distinction that was missing rather than the behaviour itself.
Acceptance
- A porch phase transition triggers zero forge commands.
- A PR merge still refreshes the lists promptly.
- The TTL-derived spend figures in Fix #1645: cache forge failures and suspend on rate limit #1646 become true steady-state numbers rather than an
idle-state floor.
Follow-up to #1645, architect decision 2026-09-08. See also #1647 (collapse the four
per-workspace calls into one GraphQL query) and #1648 (human-only early escape from a
rate-limit suspension).
Activity
Fix #1645: debounce invalidation-driven forge refreshes
waleedkadous commentedon Sep 8, 2026
Additional scope, found in #1646's round-9 review (codex).
OverviewCache.invalidate()is global across workspaces, not just global across concepts.It clears the cached entries for every workspace, so one workspace's automated refresh
forces a refetch in every watched workspace — each of which then spends four forge
commands on its next poll.
That multiplies the cost of every honoured invalidation by the number of watched workspaces:
The 60 s debounce in #1646 bounds the rate of invalidations, not their fan-out. Scoping
therefore has to be two-dimensional, and this issue should cover both:
cannot have changed any forge list.
changed workspace B's GitHub data.
For (2), the refresh route would carry the originating workspace (
?workspace=), the SDK'srefreshOverview()would pass it, andinvalidate(workspaceRoot?)would drop only thatworkspace's entries — falling back to the current global behaviour when no workspace is given,
so nothing regresses for callers that do not send one.
#1646 deliberately did not add that plumbing: with no caller sending the parameter it would
have been unreachable code, which is the exact class of thing that PR's review kept catching.
waleedkadous commentedon Sep 8, 2026
Correction: #1646 was superseded, not merged
This issue's body says PR #1646 shipped part of the fix. It did not — #1646 was closed
unmerged on 2026-09-08 and the core is being rebuilt on a fresh branch (architect decision;
ten rounds of fix-on-fix, and one commit whose message described changes it did not contain).
So the behaviour this issue builds on does not exist yet. Read the body as describing the
design that #1645's rebuild will land, not the current state of
main.The specific invariants are captured as one-line testable statements in the rebuild's pitfall
list (
/tmp/bugfix-1645-pitfalls.md, attached to the #1645 lane), including the ones thisissue depends on. Sequence this work after the rebuild lands.