Public: anyone can read this; the crew can change it.

With the weekly window full, the forge still rechecks stale reds and runs measurements, and /week says what it did #15828

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

While the weekly window is full, the forge now rechecks stale reds with no model run, and /week says what it did. Tests pass: the new test/stale-red-recheck.test.ts and the existing test/stalereds.test.ts (11 in all), plus tsc, gate.ts --fix and design-lint clean. I did not run the /week page against a running app.

Notes

shipped production is serving it deploy 3fede26

opened this

While the weekly window is full, the forge now rechecks stale reds with no model run, and /week says what it did. Tests pass: the new test/stale-red-recheck.test.ts and the existing test/stale_reds.test.ts (11 in all), plus tsc, gate.ts --fix and design-lint clean. I did not run the /week page against a running app. The window-full branch in autonomy.ts is also untested: the test calls recheckStaleReds directly.

What changed

  • Why it was needed: the existing stale-red sweep (src/crew/stale_reds.ts) only rechecks within free builder slots. A full window gives it zero slots, so no recheck happened. This is therefore not already done on main.
  • New module: src/checks/stale_red.ts queues a recheck (reason stale_red) for each open pull whose latest check on its head failed before main's latest green finished. It skips held pulls and does nothing until main has a green. It queues at most 3 per tick, and a pull is rechecked once per green of main.
  • Wiring: autonomy.ts calls it each tick only when crewWeekFor(...).slots === 0, i.e. the window is full. No builder is woken, so no allowance is spent.
  • /week: a single line, "While the window was full: N rechecks, M landed.", read from the last seven days. It is hidden when there were none. "Landed" counts pulls whose recheck went green and that merged afterwards.
  • Tests: a stale red is queued once and not again, a fresh red is not queued, nothing is queued before main has a green, and the line's wording is checked.

Left out

  • The issue's title also says the forge "runs measurements"; I did not add any.
  • "Once per main commit" is approximated as once per main green run.
  • The /week count covers the last seven days of stale_red rechecks. It does not check that the window was full at that moment.

Try it Open /<owner>/<repo>/week on a repo with a stale_red run in the last seven days. The line shows under the polish block.

[{"go":"/<owner>/<repo>/week","look":"the muted line under the Polish share block","expect":"\"While the window was full: N rechecks, M landed.\" appears only when such rechecks ran in the last seven days","ask":"Is a seven-day count the right scope for this line?"}]

Closes #15821

Show 7 earlier items

7 earlier comments · 2 events
commented

<!-- look-pages 391d8902f109 --> Look pages for 391d890, from the gate:

  • look pages (named): this pull changes src/web/pages/week.ts; a commit names /settings/security/controls
Changes requested — before the latest push

Changes needed, in one round:

  1. Both doors: /week has a terminal screen (src/tui/screens/week.ts) and the new line is only on the page. Show it there too, from the same whileFullLine, and add a short docs/features/ how-to (not README). The 'No door' note in a commit does not hold, because the line is a surface people read.
  2. Tests: the wiring in autonomy.ts (recheck only when slots === 0, never when slots > 0) is untested, and box 3 asks for a test with the window marked full. The /week line is also untested (page and TUI), and the whileFull test only asserts rechecks > 0, never the landed count. Add tests that fail without each.
  3. Naming: src/checks/stale_red.ts sits beside src/crew/stale_reds.ts with near-identical names and an overlapping job. Either fold the window-full path into the existing sweep (zero free slots means no builder wake, but still recheck) or name the module for what differs and say so in its header.
  4. Box 1 says 'once per main commit'; this is once per main green run, finished_at-ordered. Say so in the module header or key it on the commit.
  5. The preview /trevato/forge/week returned 404 for me, so I could not see the line working. Name a reachable page in the review block.

The pull's 'Looks:' line names /settings/security/controls, which is not the page this touches; correct it.

commented

The window-full recheck now shows on the terminal's week screen as well as the page, and each of juniper's points is addressed. bun x tsc --noEmit and bun scripts/design-lint.ts are clean, and the touched tests pass here. That is full-window-recheck, week-doors, feature-front-matter, search-docs, autonomy and week, but I did not run the forge's full check.

  • Both doors: The terminal week screen (src/tui/screens/week.ts) prints the same whileFullLine as the page. The how-to is docs/features/week-while-full.md, not the README. The "No door" note is no longer needed.
  • Tests that fail without each piece:
    • The slots === 0 guard is now recheckWhenFull, called from autonomyTick. A test marks the week used 10% (nothing queued) and then 100% (queued).
    • The landed count is checked with a seeded green recheck and a merged pull.
    • The page line is checked in test/week-doors.test.ts: absent before a recheck, present after.
    • The terminal line is checked in the same file.
  • Naming: I did not fold it into crew/stale_reds.ts. That sweep wakes a builder and needs a free slot, so I renamed the module to src/checks/full_window_recheck.ts. Its header says how it differs from that sweep, and the test file was renamed to match.
  • "Once per main commit": The header now says it is once per green main check run, ordered by that run's finished_at, not once per commit.
  • Look page: /alice/plan/week is a page I know exists in the week-doors test, and the new commit's Looks: line names it. The gate may still show /settings/security/controls because that older commit message stays in the branch, and I can't rewrite history. If it does, please read it as superseded.

I can't see the preview from here. juniper's 404 was probably from the repository name forge not existing there, so for the review block, open any repository's /week page. The line only appears once a model-free recheck has run in the last seven days.

[{"go":"/<owner>/<repo>/week for any repository the preview has","look":"under Polish share, one muted line appears only after a model-free recheck ran in the last 7 days","expect":"While the window was full: N rechecks, M landed.","ask":"Open the same repository's week screen in the terminal: the same words appear under the polish line."}]
commented

<!-- look-pages 8d66252a594e --> Look pages for 8d66252, from the gate:

  • look pages (named): this pull changes src/web/pages/week.ts; a commit names /settings/security/controls
commented

The gate failure is fixed and pushed; I haven't seen the forge's re-run of the check yet.

The gate rule "a test builds the real input, not as never" was failing on test/full-window-recheck.test.ts:123. fullWindowLines in src/tui/screens/week.ts only reads db from its session, so I narrowed its parameter to Pick<Session, "db">. The test now passes { db: app.db } with no cast. The week-page and terminal behaviour is unchanged.

Locally, bun scripts/gate.ts no longer reports that rule, tsc --noEmit is clean, and bun test test/full-window-recheck.test.ts passes (4 tests). The other gate lines are notes, not failures. They flag similar-looking helpers, a long comment line in src/web/pages/week.ts and the look-page reminder. I left them alone.

commented

With the window full, the forge now rechecks stale-red pulls with no model, and the week page and the terminal's week screen each show one line saying what ran. The look-pages comment is only a gate note, so I made no change for it and pushed nothing new. The last check I saw was red; I pushed the fix, bun scripts/gate.ts no longer reports that rule, and I haven't seen the forge's re-run.

  • What it does: a pull whose red check is older than main's latest green is checked again once, three at a time, and only when the weekly window has no free slot. src/checks/full_window_recheck.ts does it, called from the autonomy tick in src/crew/autonomy.ts.
  • The line: /<owner>/<repo>/week shows, for example, "While the window was full: 6 rechecks, 2 landed." Both pages print it from the same whileFullLine. It appears only when something ran in the last seven days.
  • Tests: test/full-window-recheck.test.ts and test/week-doors.test.ts cover the recheck, the one-time limit, the full-window condition, the wording and the terminal wiring. The last fix, which src/tui/screens/week.ts needed so the test could drop its as never cast, only changes a parameter type.
  • Look pages: the note reads "look pages (named): … a commit names /settings/security/controls". It is not a failure and it sits in the gate's own log at 8d66252. The gate matched an earlier commit that names that page for src/web/pages/week.ts, and /settings/security/controls is not the week page. If a reviewer wants the week page pictured, a later commit with Looks: <the week page path> would say so, but only if that path is in app.looks in forge.json.
  • Release hold: it says production is rolling and changes to it should wait. I read it as a hold on merging; I did not merge or deploy anything. This pull changes nothing until a person merges it.
  • Left out: recheck runs don't wake a builder or spend allowance, and held pulls and pulls without a head are skipped. The other gate notes (similar helper names and one long comment line in src/web/pages/week.ts) I left as they were.

To try it, open /<owner>/<repo>/week on the preview after a recheck has run with the window full.

commented

<!-- look-pages e06bfb4b9df1 --> Look pages for e06bfb4, from the gate:

  • look pages (named): this pull changes src/web/pages/week.ts; a commit names /settings/security/controls
commented

The look-pages note is cleared. I pushed an empty commit with a No look: waiver, and bun scripts/gate.ts now prints no "look pages" line. I only ran the gate, not the full check.

The note was a mismatch. src/web/pages/week.ts renders /<owner>/<repo>/week, which is per-repository data. No page in app.looks in forge.json shows it. An earlier commit on this branch had named /settings/security/controls, the one page the gate accepted. That page does not show this change, so the "named" note pointed at an unrelated page.

The waiver reads "the week page is per repository and no page of app.looks shows it; the line is one sentence the tests pin". If a reviewer wants it pictured, adding a week page to app.looks in forge.json and a Looks: line in a commit would do it. I chose not to widen forge.json for one line of text.

With the window full, the forge now rechecks stale-red pulls with no model. The recheck runs once per pull, three at a time, in src/checks/full_window_recheck.ts. The week page and the terminal's week screen show one line, for example "While the window was full: 6 rechecks, 2 landed." It appears only when something ran in the last seven days. The behaviour is unchanged from before. To try it, open /<owner>/<repo>/week on the preview after a recheck has run with the window full.

Changes requested — before the latest push

Behaviour, tests, both doors and the how-to are right, and I found no security problem: the new line is read-only, per repo, escaped through html``, and behind the week page's existing read check. Two things to fix in one round: (1) src/crew/autonomy.ts is not formatted like its neighbours: the .catch body is mis-indented and the new import sits among ./ imports with a ../checks path, so move it with the other cross-module imports. (2) The issue title says the forge also 'runs measurements' while the window is full. The boxes do not ask for it and the pull says it left it out, but the pull does not say why or open a follow-up. Open an issue for it and link it in the description, so the title's promise is not silently dropped. Also note: 'once per main commit' is implemented as once per green main run, so two green runs of one commit queue a second recheck. The header says so; acceptable, but keying on commit_oid is the exact fix if cheap.

commented

With the weekly window full, the forge now rechecks stale-red pulls with no model, and /week says what ran. The "runs measurements" half of the title is not in this pull; it is #15911.

What it does. A pull whose red check is older than main's latest green is checked again by the forge's own check. That happens once for each commit of main that checks green, at most three pulls per tick, and only when the week has no free slot. Held pulls and pulls without a head are skipped. The code is in src/checks/full_window_recheck.ts: recheckWhenFull is called from the autonomy tick in src/crew/autonomy.ts.

What /week shows. The repository's week page and the terminal's week screen print the same line from whileFullLine, for example "While the window was full: 6 rechecks, 2 landed." It only appears when something ran in the last seven days.

What changed since the last review:

  • Keyed on the commit: the time a recheck is measured from is now the first green run of main's latest green commit. A second green run of the same commit no longer queues another recheck, and a test fails without this change.
  • Formatting: in src/crew/autonomy.ts the .catch body now matches the sweep call above it, and the new import sits with the other ../checks imports.
  • Measurements: #15821's boxes don't say which measurement runs, how often, or what it costs, so I opened #15911 for that and made #10263 wait for it. docs/features/week-while-full.md links it.

Choices:

  • The commit that first named a look page had picked /settings/security/controls, which doesn't show this change. The week page is per repository and isn't in app.looks, so a commit now waives the picture with No look: instead of adding a page to forge.json.
  • The gate's "one implementation?" notes about similar helpers, and its note about one long comment line in src/web/pages/week.ts, are left as they are.

Tests. bun scripts/gate.ts and bun x tsc --noEmit are clean. bun scripts/fast.ts named 3410 test files because autonomy.ts is imported almost everywhere, so I ran the four that cover the change: test/full-window-recheck.test.ts, test/week-doors.test.ts, test/autonomy.test.ts and test/autonomy_sweep.test.ts. They pass (40 tests).

How to try it. Open /<owner>/<repo>/week on the preview after a recheck has run with the window full.

🤖 Generated with Claude Code

Approved

Earlier asks are met. The terminal week screen prints the same whileFullLine as the page, and the how-to is docs/features/week-while-full.md rather than the README. The slots===0 guard is its own function with a test at 10% and 100%. The recheck is keyed on the first green run of main's latest green commit, with a test that fails without it. The autonomy.ts formatting and import placement are fixed. The measurements half of the title is split to #15911 and linked from the how-to. The line is one muted paragraph and uses no new component or accent. It is a link-free read-only line, so it works with JavaScript off and on a 360px phone. I found nothing new to block on.

Two things I would do next:

  1. Non-blocking: whileFull counts every stale_red recheck in the last seven days, not only those queued while the window was full. That is the same thing today, since only recheckWhenFull queues them, but a one-line comment saying so would stop a later caller from skewing the count.
  2. Non-blocking: add a week page to app.looks in forge.json so the gate can picture this line, instead of the No look waiver.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs