Repository navigation
[Spec 1995] tower-collapse-the-four-per-wo - #2005
Closed
waleedkadous wants to merge 48 commits into
Closed
waleedkadous wants to merge 48 commits into
waleedkadous wants to merge 48 commits into
Conversation
…ge concept
One GraphQL query returns the open PRs, the open issues and, on request,
the two 24 h windows. Follow-up pages ask for one connection only, up to
its cap (issues 200, each window 1000). The output reproduces gh's --json
rendering, including bot and deleted authors and user-only reviewers. An
error confined to the window searches is salvaged as windowsError; any
other error fails the whole call, and gh's stderr is passed through.
- forge.ts: overview-bundle is the 21st concept. It is disabled on the
gitlab, gitea, linear and jira presets, and it counts as an issue
concept for resolveIssueIdKind.
- forge-contracts.ts: OverviewBundleResult and its conformance rule.
- github.ts: fetchForOverview('overview-bundle', cwd, {includeWindows})
with its own 60 s / 40 MB budgets, and per-contract validation.
Measured cost (Step 0): 2 points open-only, 3 with the windows.
Not called by OverviewCache yet; Phase 3 wires it in.
… notes - Drop a just-reopened issue (closedAt null) from the closed window, as recently-closed's 24 h filter does, instead of failing the call. - Always pass CODEV_INCLUDE_WINDOWS, so the open-only path cannot inherit a stray value from Tower's environment. - Salvage a window error with empty messages under a named reason.
…t disables across config layers deepMerge deletes a null, so a project's "<concept>": null in forge was lost whenever a lower layer (global, framework cache) or config.local.json carried a forge object, and the concept ran its default. loadConfig now merges each layer through mergeConfigLayer, which keeps nulls inside forge as "disabled" (key-wise, higher layer wins). deepMerge itself is unchanged.
…per open-list refresh, 24 h windows ride along resolveOverviewPath picks the bundle only when it resolves and no constituent concept is overridden or disabled; OverviewCache gains the bundle path with two positive-only freshness groups, the 420 s ride-along rule, read-only failure gates, a separate windows failure window and single-flight. The four-call path is unchanged. Existing overview, rate-limit and #1645 tests run on both paths.
… the project, in four-call reasons An override or disable can come from any config layer after the key-wise forge merge, and the reason reaches users through the doctor line.
…ction, doctor overview-path line and docs
…s a rate; guard dynamic imports too
…nd deepMerge comments
waleedkadous
marked this pull request as draft
November 27, 2026 06:47
waleedkadous
added a commit
that referenced
this pull request
Nov 29, 2026
deepMerge treats null as delete, so a project's "overview-bundle": null was dropped whenever a lower layer (framework cache, ~/.codev/config.json) also had a forge section, and the bundle ran anyway. mergeConfigLayer merges the flat forge section key-wise, so a higher layer's string or null wins and a whole-section "forge": null still deletes it. Ported from PR #2005 on the owner's ruling, with tests across the global, project and local layers.
Contributor
Author
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.
Summary
On GitHub, Tower's overview now fetches a workspace's lists with one
overview-bundleforgecall per open-list refresh. Before, it made four calls:
pr-list,issue-list,recently-closedandrecently-merged. The 24 h windows travel in the same GraphQL query,only when they are due (age ≥ 420 s), and they never make a call of their own.
ghprocesses/h (codev: 424 open issues → 2 pages)The point costs were measured with
rateLimit { cost }on the exact shipped request textbefore the cache work started: 2 points open-only, 3 with the windows. Both are at the spec's
ceilings.
Every non-GitHub preset (gitlab, gitea, linear, jira) and any project that overrides or
disables a constituent concept or
overview-bundlekeeps the four calls, with behaviourunchanged. A failed bundle never falls back to the four calls at runtime.
Closes #1995
Refs #1645, #1641, #1629
Changes
overview-bundle(scripts/forge/github/overview-bundle.sh,contract
OverviewBundleinforge-contracts.ts,KNOWN_CONCEPTS20 → 21).requests;
--paginateis not used because it re-costs the whole query.once, after the last page.
windowsErrorand failsonly the windows. Any other error, a rate limit included, fails the whole call.
--jsonrendering:app/for a deleted author, and user-onlyreviewers (Copilot and team reviewers dropped). Parity was checked by item set and field
on six real repos.
overview-bundleexplicitly.OverviewCachebundle path (servers/overview.ts,resolveOverviewPathinlib/forge.ts).(600 s maximum age, never invalidated).
the windows get their own. Dispatch is gated read-only by
isFailureWindowOpen.fourCallLists.servers/overview-budget.ts(new, no imports) owns the overview TTLs andprojectHourlyForgeCalls(20 bundled / 52 four-call).OverviewCacheimports the TTLs fromit.
codev doctorprints one informational row after the forge concepts:overview path bundled: ~20 forge calls/h per watched workspace (idle steady state, a floor that invalidation can raise).On the four-call path it prints
four calls (<reason>): ~52 …instead.forge.md"Tower Overview" section,arch.md, andcodev.mdplus its skeletonmirror.
Fixed in place: forge concept disables lost across config layers (pre-existing bug)
loadConfiglayered config files throughdeepMerge, which deletesnull. A documented"<concept>": nulldisable was therefore lost whenever a lower layer (~/.codev/config.json,the framework cache) or
config.local.jsonalso held aforgeobject. The fallback ruledepends on
"overview-bundle": nullholding, so this is fixed here. Theforgesection nowmerges key by key (
mergeConfigLayer), keepingnullas "disabled".deepMergeitself isunchanged because
commands/update.tsalso uses it. The bug was reproduced first: five casesfail on the old code and pass with the fix.
Owner ruling worth knowing when reviewing
On the bundle path, a failed invalidation-driven refresh keeps serving the still-fresh
open lists with
forgeStatus: 'ok'. The four-call path blanks them instead. This was decidedat plan approval (question (a)) and is pinned by its own test.
Adjacent doc fix
forge.md's "Validation" example showed a doctor output format that no longer exists. It isreplaced with real output.
Testing
npm run buildandtsc --noEmitare clean.spec-1995-overview-bundle-concept.test.ts: the script against aghstub (paging, caps,salvage, rendering, errors), contract validation and preset disables.
spec-1995-overview-bundle-cache.test.ts: injected-clock cadence (idle hour = 20 calls,churn, the 420 s boundary), failures, single-flight, fallback selection, parity, and an
idle hour per path asserting that the call count equals
projectHourlyForgeCalls.spec-1995-overview-bundle-gh.test.ts: real scripts through aghstub onPATH, oneghper refresh at ≤100 issues and two at 250.spec-1995-overview-budget.test.ts: projection values and drift guards.overview-rate-limit.test.tsruns the whole tower: overview cache burns the user's entire GitHub GraphQL quota (3 gh calls × N workspaces every 30s, failures uncached) — every gh command on the machine then fails #1645 suite on both paths.bugfix-1645-gh-quota.test.tsgains a bundle case and keeps the four-call case on afallback workspace.
overview.test.tsmoves the per-concept isolation tests to a fallback workspace and addsbundle counterparts.
forge.test.tsanddoctor.test.tsgoes from 20 to 21.config.test.ts, covering global/cache/local layers,forge: nullandprovider: null.codev doctorhere prints bundled ~20/h. A scratchprovider: gitlabprintsoverview-bundle disabled, four calls ~52/h, and anissue-listoverride prints fourcalls ~52/h.
getOverviewon cluesmith/codev returns deep-equal payloads from the bundle and from"overview-bundle": null.gh pr listin all four remote layouts.install verification, the
spec-1995targeted tests, and both probes. The install guardwas skipped (not requested).
gh) after the review-round change toHOME/USERPROFILEin the twoghharnesses. Itpassed:
bugfix-1645-gh-quota.test.tsran 3 tests on Windows with the pin.An earlier attempt (45954062073) used the filter
-gh, which vitest read as a flag, so itran nothing; it is not evidence.
overview-bundle.shskip, asthe pr-create is not a forge concept: gh pr create is hardcoded in the skeleton prompts, so non-GitHub forges need a gh shim #1455 and Read-only PR check for architects: merge readiness, deploy status, and whether a builder worktree can be removed #1951 forge-script tests already do. So are 24 of the 57 concept tests and
the
gh-stub harness. Windows CI therefore covers the TypeScript layer: the cache, contractvalidation, the tower: overview cache burns the user's entire GitHub GraphQL quota (3 gh calls × N workspaces every 30s, failures uncached) — every gh command on the machine then fails #1645 rate-limit suite on both paths, and the quota harness. It does not
run the script under Git Bash. The script needs
jq, which the default GitHub pathalready required (
pr-list.shpipes throughjqon main).gh-stub harness and the tower: overview cache burns the user's entire GitHub GraphQL quota (3 gh calls × N workspaces every 30s, failures uncached) — every gh command on the machine then fails #1645 quota harness now run under an empty fake home. Undera
HOMEwhose global config disablesoverview-bundle, the old quota harness fails andthe pinned one passes.
deepMerge's docstring tomergeConfigLayer.Verify phase (after merge)
These need the merged build in Tower, so they wait for a human go-ahead to restart Tower:
main;ghspawns.Spec
codev/specs/1995-tower-collapse-the-four-per-wo.md
Review
codev/reviews/1995-tower-collapse-the-four-per-wo.md