Public: anyone can read this; the crew can change it.
A Mac can take a repository's checks and report them on the pull #17915
Merged 6h 45m ago, live in production
A machine outside the forge can now report a named check on a pull's head, and requirechecks counts it. The label-claiming runner and the per-run repository secrets are not built, so forge-apple's Mac build still can't claim its runs or read the App Store Connect key through the forge.
-
Reviews
Changes requested — before the latest pushThe design is sound: the reports are a table read as check runs, so
require_checksneeds no second rule. Writes need an rw token and write access, agents are refused, the pull must be open, and inputs are validated. I found no high-severity security finding. Two things block the approval: the guards you added are not all tested, and the reply does not match the OpenAPI contract. I opened the preview:/answers 200 with the token. The forge's picture files are outside my sandbox, so I could not read them. This is an API-only change with no page of its own.- Missing tests. Two behaviours have no test that would fail without them:
- The agent refusal. It is the stated reason a crew member cannot turn a check green, and the
user.kind === "agent"branch is never exercised. - The
not_open409 for a closed or merged pull.
Add both. Also assert in the existing tests that reporting again under the same name replaces the report, with one row for that head and name. A
check.reportedevent assertion would help too. - The agent refusal. It is the stated reason a crew member cannot turn a check green, and the
- Reply does not match the contract. The handler returns
states(OUTSIDE_STATES), but the OpenAPIreplydeclares only{ head, check, state }. Dropstatesfrom the reply, or declare it. Dropping it is better, because it is noise. - Row growth (minor). Rows for old heads are never removed, since they only cascade on delete of the pull. A writer can also create unlimited names per head, and every head read loads them all. Keep this in mind for the claiming-runner slice. Prefer deleting reports of superseded heads when a new head is reported over adding a cap.
README is untouched and the how-to is in
docs/features/outside-checks.md, as the rules require.ApprovedAll three earlier asks are met. (1) The reply is now only { head, check, state }, matching the OpenAPI reply. (2) recordReport deletes the pull's reports for older heads, so rows stay bounded by the names on the current head. (3) There are now tests for agent refusal with no row written, 409 not_open, replacement with one row and an event per report, and pruning of a superseded head. The new lines in this round are clean: the name, state, summary, url and oid are validated at the boundary, the route needs an rw token, write access and a person (not an agent), and the body is read through the shared capped
body. Non-blocking: thepersontest helper duplicatesmkin another test file. - Missing tests. Two behaviours have no test that would fail without them:
-
Checks
shipped production is serving it deploy 5ce50ab
-
History
- Outside checks: drop states from the reply, prune superseded heads' reports, test agent refusal, not_open and replacement (#17910) bd9554f
- Read outside reports in the same statement as the heads' runs in the batch too, so a page of pulls costs no extra statement (#17910) d47ea2e
- Classify check.reported, index the route, read outside reports in the head's own statement (#17910) 8d6b332
- Merge remote-tracking branch 'origin/main' into scout/17910-a-mac-can-take-a-repository-s-checks-and e88dd8e
- Post-quantum signatures and host keys: track ML-DSA, nothing to build yet (#18078) c265edf
- Sentinel: Crew runs in trevato/deal-clock keep failing at the push or the sandbox (#18076) a98d939
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:sh74wg48ib is past its budget: trevato/forge: "on production's size > a cold /map answers within a few passes over the runs" failed on 3 pulls in the … (#18070) c5a926e
- Traces 2: /traces lists every trace with facets and search (#18015) 1c60934
- Traces 1a: a trace index table, filled when a run or Talk turn ends and backfilled once off the serving thread (#18061) 35e4ee2
- Games: pin forge-velocity f7d5d4e72 (/forge words as you type, Yes and No to click, an answer shown once) (#18036) 0003ecb
- Merge pull request #18054 from sold/agent-rollback d6960b3
- Give an outside report's run the feed field main added (#17910) 849d533
- Games: a new server's words are searched on Modrinth, not matched against five names (#18041) 31cdee4
- Merge remote-tracking branch 'origin/main' into scout/17910-a-mac-can-take-a-repository-s-checks-and 17ba3fd
- Lists answer next_cursor as a string, as openapi.json declares (full suite red, #18027) (#18040) ab67833
- Game box agent: put a container left as <12 hex>_<service> back to its service name (#18052) 99480aa
- Deploys never move a live name by surprise: DNS is asked before Build, a restore asks once more (#18030) 49e77a8
- Plugin config: a line too long to read stays as the file has it (#17782) 1c79353
- Games: a server the box no longer runs leaves its list (#18029) 492f6df
- A migration that makes a return to the image before unproven can be named (#17766) 63bef0b
7 earlier comments
This pull adds an API for a machine outside the forge to report a named check (pending, ok or failed, with a summary and link) on a pull's head. Nothing new needed committing this turn, so I pushed nothing.
The earlier red check on #17915, the Property 'feed' is missing type error in src/checks/outside_checks.ts, no longer shows up. bun x tsc --noEmit is clean on the current head.
The four checks you listed (dead code, process-wide state, UNTIMED jobs, duplicate imports) pass. I ran test/dup-imports.test.ts, test/unused-exports.test.ts, test/module-state.test.ts and test/job-slices.test.ts, plus test/outside-checks.test.ts: 22 pass, 0 fail.
bun scripts/gate.ts --fix changed nothing. It still prints three notes, none of which I acted on:
- Long comment line: one is over 100 columns in
src/core/runs.ts; the gate says the nightly rewrap handles it on main. - Similar functions:
pullHeadOidinsrc/http/api.tslooks likeliveHeadinsrc/flow/why.ts, and thepersonhelper intest/outside-checks.test.tslooks likemkintest/app-reads-etag.test.ts. The gate asks "one implementation?".
What I chose not to do: the issue's other asks are not built here. That means device nodes that claim runs, streamed logs from the machine, and run-scoped repository secrets such as the App Store Connect key. This pull covers only the named-check state that require_checks counts.
To try it: the how-to is in docs/features/outside-checks.md, and bun test test/outside-checks.test.ts runs the tests.
A Mac, or any other machine outside the forge, can now report a named check on a pull's head. PUT /api/v1/repos/:owner/:name/pulls/:number/checks/:name takes {state: pending|ok|failed, summary?, url?, oid?}. The report counts in require_checks like any other run.
What I fixed this time: the branch was 67 commits behind main, and main had added a feed field to Run. The outside report's run lacked it, so tsc failed and two outside-check tests failed on the OpenAPI response check. I merged main and added feed: null.
Checks: after the merge, tsc is clean. These pass: test/outside-checks.test.ts, test/unused-exports.test.ts, test/module-state.test.ts and test/job-slices.test.ts. I did not run the rest of the suite; the forge runs it on push.
The three named tests: my files don't trip them. The change adds no module-level Map, Set or array, no job under during, and no export without a caller. The unused-exports test does list five unused exports in other files (src/http/crawl.ts, src/kernel/migrate.ts, src/spawn/watch_probe_default.ts, src/spawn/reach_default.ts). I left those alone.
Both doors: bun scripts/gate.ts --explain passes the both-doors rule. The first commit already says No door: because the terminal's pull screen reads the same head verdict, so it shows the report. The new commit also has a No door: line, since it changes no page, action or route. The how-to is docs/features/outside-checks.md.
Not done:
- Agents can't report checks; only a person with write access can. That stops a crew member turning a check green.
- A report for an older head is refused with 409
head_moved, never put on the new head. - I did not merge the duplicate test helper
person(test/outside-checks.test.ts:30) withmkintest/app-reads-etag.test.ts. The gate only notes it.
Try it: PUT …/pulls/N/checks/macos with {"state":"ok"} using a writer's rw token, then GET …/pulls/N/checks.
🤖 Generated with Claude Code
A machine outside the forge can now report a named check on a pull's head. Those three tests failed on the last push and now pass locally, along with 600 others in the files I re-ran. tsc is clean.
PUT /api/v1/repos/:owner/:name/pulls/:number/checks/:check takes {state: pending|ok|failed, summary?, url?, oid?}. require_checks counts the report like any other run on the head.
What failed and why:
- Route index: the generated route index was stale. I regenerated it with
bun scripts/openapi-routes.ts. - Event audience: the new
check.reportedevent was not classified. I added it to the audience list insrc/core/event_audience.ts. - Pull page SQL budget: the pull page was at 118 SQL statements against a budget of 115. It asks for a head's checks three times, and each ask cost one extra statement for the reports.
checksForHeadnow reads the reports in a column of the same statement that reads the runs, so a head costs no extra statement. The list readers (checksForHeads) cost one batched statement however many pulls.
Not done:
- Agents cannot report checks. Only a person who can write to the repository can, so a crew member cannot turn a check green.
- A report for an older head is refused with 409
head_moved, never put on the new head. - A request with
oidis not matched to a head here. The pull's head is read from git. - I did not merge the duplicate test helper
personintest/outside-checks.test.tswithmkintest/app-reads-etag.test.ts. The gate only notes it.
Try it: PUT …/pulls/N/checks/macos with {"state":"ok"} using a writer's rw token, then GET …/pulls/N/checks.
🤖 Generated with Claude Code
A repository's checks now include what a machine outside the forge reported on the same head, and the batch read behind the pull lists no longer costs an extra SQL statement. That extra statement is why path-steps-batch and pulls-words went over their budgets (6 statements against a limit of 5).
What changed
- Cause: the earlier commit in this pull added a second statement to
checksForHeads, the function that reads many pulls' checks at once. It ran one query per chunk of pulls plus one for the outside reports. - Fix:
checksForHeadsinsrc/core/runs.tsnow reads the runs and the outside reports in one statement. Each head's reports ride along as a JSON column and are merged newest-first with the runs. - Helper: the column builder in
src/checks/outside_checks.tsis nowoutsideAsJson(issue, oid), which both the single-head and batch reads use. - Behaviour: unchanged apart from the statement count. A head with only outside reports still shows up.
Tests
path-steps-batch,pulls-wordsand the outside-check suites pass: 113 tests across 10 files.tsc --noEmitis clean.- I did not run the full suite; the forge's check does that on this push.
Left out
- Each run row of a head repeats that head's reports column. That is fine while reports are rare, and I did not de-duplicate it.
- The gate's remaining notes (comment wrapping, two lookalike functions) were advisory, and I did not act on them.
Try it
Run bun test test/path-steps-batch.test.ts test/pulls-words.test.ts test/outside-checks.test.ts.
🤖 Generated with Claude Code
All three review points are addressed and pushed. The outside-checks tests (10) and tsc pass. I did not run the full suite, so the forge's check on this push is its first run.
What changed
- Reply:
PUT …/pulls/:number/checks/:checknow returns only{ head, check, state }, which is what the OpenAPIreplydeclares.statesis gone from the handler. - Row growth:
recordReportnow deletes the pull's reports for any older head before writing the new one. Rows stay bounded by the number of names on the current head. I added no cap on names per head; the reviewer said pruning was preferable. - Tests added in
test/outside-checks.test.ts:- An agent session is refused with 403 and writes no row.
- A closed pull answers 409
not_open, then the test reopens it. - Reporting twice under the same name leaves one row, each report appends a
check.reportedevent, and the reply keys are exactlycheck,headandstate. - A report stored under an older head is deleted when the current head is reported.
Left alone
- The agent test sets
is_agenton a second user. It does not usecreateAgent. - Gate notes, advisory only and not acted on: the
persontest helper duplicatesmkin another test file, andpullHeadOidresemblesliveHead. Two over-long comments sit in files I didn't touch,src/core/event_audience.tsandsrc/core/runs.ts. - The commit carries
No door:. The only API change is dropping an undeclared field, so the terminal side anddocs/features/outside-checks.mdare unchanged.
To try
bun test test/outside-checks.test.ts.
A machine outside the forge can now report a named check on a pull's head, and
require_checkscounts it. The label-claiming runner and the per-run repository secrets are not built, so forge-apple's Mac build still can't claim its runs or read the App Store Connect key through the forge.I ran
outside-checks.test.ts, the OpenAPI, boot-lazy and doors tests, the dead-code, module-state and route-timing tests, and the migration tests. They pass, and so doestsc --noEmit. The gate has no failing rule. It still asks "one implementation?" aboutpullHeadOidand the test helperperson; I kept both. I did not run the full suite:scripts/fast.tsnamed 3,727 files, so I stopped that run and left the full check to the forge.What changed
PUT /api/v1/repos/:owner/:name/pulls/:number/checks/:check(e.g.macos) takes{ state: pending|ok|failed, summary?, url?, oid? }. Reporting again under the same name replaces the report. The route and its OpenAPI entry are insrc/http/api/outside_checks.ts.outside_checktable, not a queued run, so no scheduler picks it up.checksForHeadandchecksForHeadsinsrc/core/runs.tsreturn it as a check run of the head. The head is green only when the forge's own check and every named report areok. The pull page, the terminal pull screen and the merge gate read the same verdict, so no second rule was added.oidis not the current head, the answer is 409head_movedand nothing is written.oidare validated at the boundary.check.reportedevent.docs/features/outside-checks.md; tests intest/outside-checks.test.ts.Left out
secret.readlogging.No door:.Reused:
body,requireScope,loadPull,canWrite,checkSummaryandnewestOfEachKind, and the migration-pin and lazy-list scripts. I also exportedpullHeadOidfromapi.ts.Try it: run
curl -X PUT -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' -d '{"state":"ok","summary":"uploaded"}' $FORGE_URL/api/v1/repos/OWNER/NAME/pulls/N/checks/macos, thenGET …/pulls/N/checksand look at thestate.🤖 Generated with Claude Code
Closes #17910