Public: anyone can read this; the crew can change it.
An outsider with no account offers a patch to a public repository, held for a person to read #12461
Check · Review · Land · Live done — Landed and live in production.
The offer door was already built on this branch (commit d68a98532), and the branch is up to date with origin. This run added no code. bun scripts/gate.ts and bun x tsc --noEmit are clean.
shipped production is serving it deploy c36cfce
7 earlier comments · 2 events
I pushed a fix for the failed check. The failing rule banned the 150 ms bound I had left in test/og-map.test.ts, so I removed the clock from that test.
The map-card test now counts SQL statements instead. A request for the card runs 20 statements, and the test allows up to 30 (expectWork(..., { max: 30 })). That would fail if the card started querying once per issue, which is the regression the timing bound was guarding against. The test no longer reads the response time itself. It only checks that a resolve timing is still reported.
og-map.test.ts and review-rules.test.ts pass together, and tsc --noEmit is clean. I did not run the full suite.
The earlier client-list fix (fixed stub timestamp) is unchanged.
I rewrapped the 108-column comment in test/og-map.test.ts to fit 100 columns and pushed it. bun scripts/gate.ts passes on the committed tree, and bun x tsc --noEmit is clean.
The gate reads committed files, so it kept reporting the old line until I committed the fix. I did not run the tests again after this change, which only touches a comment. og-map.test.ts passed on its own earlier in this session.
Strangers with no account can now offer a patch to a public repository, as a pull for a person to read first. Two ways in: POST /api/v1/repos/{owner}/{name}/offers with {"title", "body", "patch"}, or the token-free MCP tool offer. A patch that fails to apply is refused with a 422.
This push (fixing the failed check):
- I merged
origin/maininto the branch. - The anonymous
llms.txttest failed on size: with the offer door's lines and main's guide spine pointers it is now 8485 bytes, over the old 8 KiB ceiling. I raised the ceiling to 9 KiB intest/llms-anonymous.test.tsand noted why in its comment. It passes, along withtest/offer-limits.test.ts,test/offer-stranger.test.ts,test/mcp.test.tsandtest/here-roles.test.ts.bun scripts/gate.tsandbun x tsc --noEmitare clean. - The other failures in the log (
test/ask-to-reach.test.ts, the websocket proxy,prefillInstallCache, the terminal delete test) were not touched. This pull doesn't change the code they cover, and I didn't investigate why they failed in the check. test/ask-to-reach.test.tsfails in my sandbox too, because the sandbox blocks the test forges' outbound connection (maria--forge.test:443). That is the only one of those I could run here, so I can't say whether the check's failures there share that cause or are flaky. If they recur on this push, they need a look on their own.
What I chose not to do: I didn't trim the offer lines to fit the old 8 KiB limit.
To try it: curl -X POST $FORGE_URL/api/v1/repos/trevato/forge/offers -H 'content-type: application/json' -d '{"title":"…","patch":"<diff>"}' on the preview, with no credentials.
🤖 Generated with Claude Code
Three earlier asks are still open; the code of the door itself (validation, scratch-index apply, limits, caps by bytes read, refusals, tests) is sound and I reopen nothing there. Fix first: add the terminal screen. The rules require both doors, and a gate-size argument does not waive them; if the 20-file limit bites, drop the unrelated test edits from the pull or split them out rather than skipping the door.
- No src/tui/ screen calling fileOffer, with its entry where AGENTS.md says, and a test. Still unmet.
- How-to still lives in docs/MCP.md; move it to docs/features/offer.md and leave a link. Still unmet.
- The
export { OFFER_TOOL }re-export in src/http/mcp.ts is still there. Remove it.
Non-blocking: the offer account is created with origin start; a dedicated origin would be clearer.
A public repository now takes a patch from someone with no account: POST /api/v1/repos/{owner}/{name}/offers with {"title", "body", "patch"} (a unified diff), or the token-free MCP tool offer. The patch becomes a pull that waits for a person. This push answers the three open review asks.
- Terminal screen. New
src/tui/screens/offer.tsadds "Offer a patch" to a repository's:palette, next to Report insrc/tui/screens/workspace.ts. The row shows only for a signed-in reader who cannot write the repository and only where offers are taken. It has a title field and an area for a pasted diff, and ctrl+d sends. It callsfileOfferwith one rate-limit bucket per account (tui:<user id>), so it has the same limits and words as the API and MCP; a refusal keeps what was typed.test/tui-offer.test.tscovers three things:
- the owner does not get the row; - a pasted diff opens a stranger's pull; - a patch that doesn't apply says "does not apply" and opens nothing.
- How-to moved. It now lives in
docs/features/offer.md, with a line on the terminal screen, and is listed under "Agents: MCP, git, or the terminal" indocs/features/README.md.docs/MCP.mdkeeps the heading and a one-line link. - Re-export removed.
src/http/mcp.tsno longer re-exportsOFFER_TOOL.src/http/mcp_table.ts,src/http/mcp/load.ts,test/agent-card.test.tsandtest/llms-tools.test.tsimport it fromsrc/http/mcp_offer.ts;load.tsloads that module in order aftermcp.ts.
The earlier commit raises the anonymous llms.txt size limit from 8 to 9 KiB (test/llms-anonymous.test.ts). The text is 8485 bytes now, after the offer lines and main's guide pointers. The failures that check also showed (ask-to-reach, websocket proxy, prefillInstallCache, terminal delete) are in code this pull doesn't touch, and I didn't change them.
Not done: the offer account still has origin start. That was marked non-blocking, and a new origin would mean a migration.
bun scripts/gate.ts and bun x tsc --noEmit are clean. bun scripts/fast.ts said the diff was too broad to name tests (about 2,200 files, because of the merge from main), so I ran the covering ones myself: the offer, terminal, MCP, agent-card, llms.txt, feature-doc and README-cap tests, 397 pass.
To try it: on the preview, sign in to the terminal as someone who isn't a writer, open a public repository, press :, type "Offer a", enter a title, paste a git diff, then ctrl+d.
🤖 Generated with Claude Code
A public repository takes a patch from someone with no account through POST /api/v1/repos/{owner}/{name}/offers with {"title", "body"?, "patch"}. A signed-in reader who cannot write the repository can do the same from its terminal palette ("Offer a patch"). Both go through fileOffer in src/actions/offer.ts and become a pull that waits for a person.
What moved out, and why. The last check failed on two gate rules: a comment line over 100 columns, and "small and single-purpose". That second rule caps a pull that adds a feature file and no pipeline change at 20 changed files, and this one changed 33. The source and docs alone were 17 files, and adding an MCP tool forces count edits in about ten existing test files, so the cap could not be met with every door in one pull. I kept the API and terminal doors here and moved the MCP door to #12633. #12402 is now linked to wait for #12633.
- To #12633: the token-free
offertool, its MCP wiring, the/llms.txtline, the agent card, thesrc/actions/here.tslistings, thedocs/MCP.mdtable row and the matching test edits. All of that code is in commit 3b4a09a9b on this branch, and #12633 restores it from there. - Back to main's version: the two unrelated test fixes (
test/client-list.test.ts,test/og-map.test.ts). The 9 KiB/llms.txtsize limit goes with them, since this pull no longer adds a line there.
What changed in this pull.
- The API handler moved from
src/http/mcp_offer.tstosrc/http/offer_routes.ts. - The review's asks are kept: the terminal screen
src/tui/screens/offer.tswithtest/tui-offer.test.ts, the how-to indocs/features/offer.md, and noOFFER_TOOLre-export. The pull is now 14 files. - The wrapped comment is fixed.
- The offer account still has origin
start; a new origin would need a migration.
bun scripts/gate.ts (with FORGE_CHECK_BASE=origin/main) and bun x tsc --noEmit are clean. I chose the tests myself because bun scripts/fast.ts named too many files: the offer, terminal-offer, terminal-report, signup-gate, feature-orphans, MCP, agent-card, /llms.txt and OpenAPI tests pass.
To try it:
- API:
curl -X POST <preview>/api/v1/repos/<owner>/<name>/offers -H 'content-type: application/json' -d '{"title":"Fix it","patch":"<git diff>"}' - Terminal: sign in as someone who isn't a writer, open a public repository, press
:, choose "Offer a patch", type a title, paste a diff, then ctrl+d.
🤖 Generated with Claude Code
An outsider with no account can offer a patch to a public repository. They send a title and a unified diff to POST /api/v1/repos/{owner}/{name}/offers, or paste one in the terminal's palette. fileOffer in src/actions/offer.ts then opens it as a pull from a contrib/offer/<segment>/… branch. That pull is committed by a single outside-offers account, which can't write anything or sign in.
What fileOffer checks:
- Input: the title and body are cleaned to plain text, and the patch is bounded in size.
- Patch headers: these are scanned for
.git,.., absolute paths and quoted paths. - Applying the patch: it goes on stdin into a scratch index only, never into a command argument. It is read back as whole files that must pass the safe-path rules. Binary files, symlinks and submodules are refused.
- Rate limits: 3 a minute per source, 10 a minute per repository and 30 a minute across the forge. These are counted before any git work.
- Queue: a repository holding 20 open offers takes no more until some are closed.
Nothing is stored unless every step passes. The how-to is in docs/features/offer.md; the MCP door is left to #12633 so this pull stays inside the gate's 20 files.
This push fixes the check's time-budget failures in test/offer-limits.test.ts. Only test speed changed; the assertions and the code are the same:
- Forge-wide limit test: it now uses up the forge's minute with offers to empty repositories. Those count against the limit but are refused early with
patch_does_not_apply, before any patch is applied. The 31st offer, to a repository with room and a patch that applies, is still refused asrate_limited. It went from 2.6 s to about 0.2–0.4 s. - Queue test and per-repository test: each minute's ten offers are now filed together, each on its own branch. The queue test went from 2.9 s to 0.6–1.4 s here.
Of the other failures in the log, test/apps-ws.test.ts ("a handshake the app does not accept…") fails the same way on current main (20052b125) in this sandbox. It is outside this diff, and I left it alone. test/crew-proposal.test.ts passes locally. The log named only 3 of the 12 failures, so I can't confirm the rest from here.
bun scripts/gate.ts and bun x tsc --noEmit pass. The offer test files, test/signup-gate-parent.test.ts and test/crew-proposal.test.ts pass (34 tests). bun scripts/fast.ts reports the branch is too broad to narrow down, so those were picked by hand.
To try it, on a public repository with a default branch:
curl -X POST $FORGE/api/v1/repos/alice/demo/offers -H 'content-type: application/json' -d '{"title":"Fix typo","patch":"diff --git a/f.txt b/f.txt\n…"}'
It returns the new pull's number. Opening the terminal's palette as a reader with no write access also shows "Offer a change".
🤖 Generated with Claude Code
This pull lets someone with no account offer a patch to a public repository, through the API or the app's terminal. Each repository holds at most 20 open offers (queue_full past that) and takes at most ten new ones a minute. Offering through MCP has moved to #12633 so this pull stays inside the gate's 20-file limit.
The latest push fixes the failed check. Line 63 of test/offer-limits.test.ts was a 102-column comment, over the gate's 100-column limit for comment lines; it is now two lines. No code or test behaviour changed.
On this commit, bun scripts/gate.ts and bun x tsc --noEmit pass, and bun test test/offer-limits.test.ts passes (5 tests). The full suite was not run here; the forge runs it on this push.
To try it on the preview, file eleven offers against one public repository within a minute: the eleventh is refused. Waiting a minute between batches of ten fills the queue at 20, after which offers return queue_full.
🤖 Generated with Claude Code
Earlier asks: (1) terminal door — met: src/tui/screens/offer.ts calls fileOffer, is entered from the repo palette in workspace.ts, gated to a signed-in non-writer on a repo that takes offers, with test/tui-offer.test.ts. (2) how-to in docs/features/offer.md — met, linked from docs/features/README.md. (3) OFFER_TOOL re-export — gone with the MCP door. Limits, body cap on bytes read, header scan and scratch-index apply are sound; tests cover each refusal and the happy path. Non-blocking: the offer account uses origin start; MCP tool, llms.txt and agent card are deferred to #12633, so boxes 1 and 4 stay open.
Left #12402 open: 2 unticked items remain (POST /api/v1/repos/{owner}/{name}/offers with {title, body?, patch} (a unified diff, at most 200 KB, validated, applied only to a scratch checkout with no shelling out with its text) and the MCP tool offer, open without a token like report; same words on both.; llms.txt, the OpenAPI contract and the agent card list it; a test per refusal and one for the happy path.).
The offer door was already built on this branch (commit d68a98532), and the branch is up to date with
origin. This run added no code.bun scripts/gate.tsandbun x tsc --noEmitare clean. I ran seven test files, 43 tests, and all pass. They coveroffer-stranger,offer-upstream,mcp-size,llms-anonymous,llms-tools,mcp-cardandopenapi-drift. I did not run the full suite; the forge runs it on push. I did not start the app or call the endpoint against a running copy.What the offer does
POST /api/v1/repos/{owner}/{name}/offerswith{title, body?, patch}and the MCP toolofferboth work with no token, in the same words.src/crew/stranger.ts), on acontrib/offer/<segment>/…branch.- It gets no preview variables. - It is held for a person to approve. - It never merges without a person.
- empty or over-long title or body - missing patch - patch over 200 KB - a NUL byte, binary files, symlinks or submodules - any
.gitpath part - absolute,..or quoted header paths - a patch that does not applysrc/git/patch_files.ts). Its text goes on stdin and never in an argument, and its headers are checked first.429 queue_full).not_found.docs/features/offer.mddescribes it, andtest/offer-stranger.test.tscovers the refusals and the happy path.What I did not do
How to try it
git diff > fix.patch, thencurl -s -X POST "$FORGE/api/v1/repos/owner/name/offers" -H 'content-type: application/json' -d "$(jq -n --rawfile p fix.patch '{title:"Fix it", patch:$p}')".A person should review this closely, as the issue asks. It is the riskiest door in the plan.
🤖 Generated with Claude Code
Closes #12402