perf(pr): reduce quota use when refreshing workspace checks - #12442
juliusmarminge merged 9 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces a new authenticated GitHub conditional-check caching subsystem and changes existing polling, idle-refresh, push invalidation, and orchestration behavior across server and web paths. The altered product refresh defaults and broad runtime surface warrant human review. You can add or adjust custom eligibility rules. Learn more. |
|
The latest code and Effect reviews are clear; all three findings are fixed and resolved. CI is blocked by the existing vp test run apps/server/src/orchestration-v2/testkit/OrchestratorReplayFixtures.integration.test.ts -t 'queued_cancelled_while_active/codex'Please rerun the failed job. GitHub rejected my rerun request with HTTP 403, requiring repository admin rights. |
5ff0a93 to
fd8ea2f
Compare
11ddbab to
435b6e3
Compare
|
Rebased onto the current The base branch was force-pushed, which stranded this PR: GitHub compared it against a rewritten base, so it reported |
juliusmarminge
left a comment
There was a problem hiding this comment.
Reviewed at 435b6e3. The revalidator itself is solid and the tests cover the paths I cared about (304 reuse, later pages, fork approvals, head change, account separation, forced 5-minute read). One regression in the shared hook needs fixing before this lands.
Blocking
useLiveRefresh: arrival now counts as interaction, which defeats the idle gate for every live view.
useLiveRefresh.ts:149 adds if (visible()) lastInteractedAt = now; inside onArrival. onArrival runs on focus and visibilitychange, not only on real input. A window left visible on a second monitor gets a focus event every time the person alt-tabs on their main monitor, so lastInteractedAt keeps advancing and shouldRefreshOnInterval never sees the six-minute idle threshold. That is exactly the case the hook's own doc comment (lines 24–30) says it exists to prevent, and it applies to the PR list, the PR detail panel, and the workspace row, not just checks.
Fix: remove that line from onArrival and bump lastInteractedAt only inside the watchInteraction resume callback, where a pointer/key/wheel event is the cause. The existing test resumes via pointerdown so it still passes; please add a case that fires window.focus after six idle minutes and asserts no read.
Non-blocking
usePullRequestChecksRefreshcarries awaitingSincestate machine plusheadSha/updatedAtprops (and the newheadShafield onPullRequestChecks) to give a fresh push two minutes at 45s instead of 60s. That is a lot of plumbing for a 15-second difference.checks.some(pending) || checks.length === 0 ? 45_000 : 60_000would drop all of it and the contract change. Your call; I would take the simpler one.mergeable_state: unstableon this PR is only the Vercel marketing status; this diff does not touch marketing, so ignore it.
|
Handled both review notes in b2aafe7489 and 118507a78d.
263 focused tests and web/server type checks pass. Scoped lint and formatting pass, with one existing ref-during-render warning in |
|
The full post-fix audit found one further bug: after a forced five-minute read could not confirm workflow approvals, the cache kept the older result and marked it fresh for another five minutes. The next unchanged poll could replace the unknown approval state with an old success. d7efcb604d now clears that value; the regression test fails before the fix and passes after it. CI also caught TS377026 in the updated base branch at ProjectionStore.getTurnStartHistory. Synced the base and replaced that JSON.stringify call with the existing encodeIdList. Existing SQLite and memory tests cover omitted, empty, matching, and nonmatching run IDs. 388 focused tests, web/server type checks with Effect diagnostics enabled, scoped lint, and formatting pass. The full PR audit found no further code blockers after these fixes. Watching the latest CI and reviews. A follow-up review from Julius is still needed; the request-review API returned HTTP 404. |
|
Effect service convention review found one blocking issue. See the inline review comment for the expected namespace-import fix. Posted via Macroscope — Effect Service Conventions |
|
The next CI pass exposed a base-branch queued-turn regression. Later queued turns reuse the root checkpoint scope and replace its node metadata; the startup query then lost that scope for earlier turns. fb9b65c612 now looks it up through checkpointScopeId. The SQLite regression failed before the fix. Both storage variants, all 65 provider-switch tests, and all six affected replay cases pass. Server types, scoped lint, formatting, and ponytail-review pass. Both new Macroscope notes are fixed and resolved. Watching fresh CI and reviews on this commit. |
a1f8051 to
0337dd6
Compare
fb9b65c to
1864d77
Compare
|
Rebased onto the current |
|
CI on |
c1bf586
into
pingdotgg:t3code/codex-turn-mapping
Workspace PR checks currently trigger a full GitHub read every 45 seconds, even when all checks have finished. This PR reuses unchanged checks through authenticated REST ETags, checks every page, keeps caches separate by account, and preserves fork workflow approval and rate-limit handling. A full read every five minutes bounds stale data if the REST and GraphQL views disagree.
Pending, action-required, or missing checks refresh every 45 seconds; settled checks refresh every 60 seconds. Hidden and idle views pause polling. Real pointer, key, or wheel input resumes idle views; focus and visibility events alone do not. T3 pushes notify the project immediately, including draft worktrees.
Verified with 388 focused tests, web and server type checks with Effect diagnostics enabled, scoped lint, and formatting. Regression tests cover idle focus/visibility and clearing old cache values after an incomplete forced refresh. Both regressions failed before their fixes. No visual layout changed.
Synced the current base and fixed two CI regressions in ProjectionStore: reuse the existing run-ID JSON encoder, and load shared root checkpoint scopes by ID so later queued turns cannot hide them from earlier turns. The checkpoint regression failed before the fix; both storage variants, all 65 provider-switch tests, and all six affected queued-turn replay cases pass.
Conditional requests still create network traffic and remain subject to secondary limits. External changes are normally seen on the next 45–60 second poll; the five-minute full read is a safety fallback.
Stacked on #2829 (t3code/codex-turn-mapping).
Model: GPT-6. Harness: OpenAI Codex.