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 #12442

opened this

Closed 18d 11h ago

An outsider with no account can now offer a patch to a public repository, and it becomes a stranger's pull held for a person to read. I did not run the full suite (the forge's check does that on push).

Notes

opened this

An outsider with no account can now offer a patch to a public repository, and it becomes a stranger's pull held for a person to read. I did not run the full suite (the forge's check does that on push). I ran the new test, the MCP, /llms.txt, agent-card, OpenAPI, here-manifest and stranger suites, tsc and bun scripts/gate.ts, and all were green.

What changed

  • API and tool: POST /api/v1/repos/{owner}/{name}/offers with {title, body?, patch} and the MCP tool offer need no token, like report. They share one action (src/actions/offer.ts) and one set of words (src/actions/offer_words.ts).
  • The pull: the patch is committed to a contrib/offer/<segment>/… branch under one shared account that writes nothing, and opened as an outside agent's pull. It waits for a person's approval before any preview or secret reaches its code, and it never merges without one. The guarded paths still apply.
  • Refusals: each of these is a 422 naming why, with nothing stored.
    • a patch over 200 KB;
    • a patch that does not apply to the default branch's head;
    • a header naming .git in any case or spelling, or a path that is absolute, quoted or climbs with ..;
    • a NUL byte, binary files, symlinks or submodules;
    • a missing title or patch.
  • Limits:
    • 3 offers a minute per source, 10 per repository, 30 for the forge (429 when exceeded);
    • at most 20 open offers per repository (429 queue_full);
    • private, archived, sealed or mirrored repositories answer not_found.
  • Safety: the headers are scanned before git sees them. The patch goes on stdin to a scratch index and is read back as whole files that pass the safe-path rules. The patch text is never shelled out as an argument.
  • Listed in: /llms.txt (an offer line under "Offer a change", and the tool line), the OpenAPI contract, the agent card, docs/MCP.md, /api/v1/here and docs/features/offer.md. test/offer-stranger.test.ts has the happy path through the API and MCP, a test per refusal, and the rate limit.

Choices to look at

  • One shared account: every offer is authored by one shared account that cannot sign in, instead of one account per offer, so spam cannot fill the users table.
  • Not in the default tool list: offer is not in a fresh connection's tool list. That list is capped at 6,000 bytes and the tool would have pushed it over it, so I left it out rather than raise the ceiling. find_tool and tools/list with all: true find it. /llms.txt and /api/v1/here still name it. Say if you want it in the default list instead.
  • Anonymous /llms.txt ceiling: I raised the byte ceiling in test/llms-anonymous.test.ts from 7 to 7.5 KiB, with a comment saying why. The new bullet and tool line cost about 390 bytes and the text had 27 bytes of room. The MCP ceilings are unchanged.
  • Stranger MCP body limit: a stranger's MCP body may now be about 1.2 MB, but only for a call to offer; every other call stays at 64 KB (strangerMessage in src/http/mcp_offer.ts).
  • Other test edits: a few existing tests hard-coded "report and start" as the only open tools. I updated them to include offer.

Not done

  • No per-author cap on a person's own open offers beyond the repository's 20.
  • I could not call the keep_plan or estimate tools from here, so there is no plan on the issue.

Try it: on the preview, curl -s -X POST $FORGE/api/v1/repos/<owner>/<name>/offers -H 'content-type: application/json' -d '{"title":"x","patch":"<git diff output>"}', then open the pull it returns.

🤖 Generated with Claude Code

Closes #12402

3 earlier comments
commented

An outsider with no account can now offer a patch to a public repository, and it becomes a stranger's pull held for a person to read. I did not run the full suite (the forge's check does that on push). I ran the new test, the MCP, /llms.txt, agent-card, OpenAPI, here-manifest and stranger suites, tsc and bun scripts/gate.ts, and all were green.

What changed

  • API and tool: POST /api/v1/repos/{owner}/{name}/offers with {title, body?, patch} and the MCP tool offer need no token, like report. They share one action (src/actions/offer.ts) and one set of words (src/actions/offer_words.ts).
  • The pull: the patch is committed to a contrib/offer/<segment>/… branch under one shared account that writes nothing, and opened as an outside agent's pull. It waits for a person's approval before any preview or secret reaches its code, and it never merges without one. The guarded paths still apply.
  • Refusals: each of these is a 422 naming why, with nothing stored.
    • a patch over 200 KB;
    • a patch that does not apply to the default branch's head;
    • a header naming .git in any case or spelling, or a path that is absolute, quoted or climbs with ..;
    • a NUL byte, binary files, symlinks or submodules;
    • a missing title or patch.
  • Limits:
    • 3 offers a minute per source, 10 per repository, 30 for the forge (429 when exceeded);
    • at most 20 open offers per repository (429 queue_full);
    • private, archived, sealed or mirrored repositories answer not_found.
  • Safety: the headers are scanned before git sees them. The patch goes on stdin to a scratch index and is read back as whole files that pass the safe-path rules. The patch text is never shelled out as an argument.
  • Listed in: /llms.txt (an offer line under "Offer a change", and the tool line), the OpenAPI contract, the agent card, docs/MCP.md, /api/v1/here and docs/features/offer.md. test/offer-stranger.test.ts has the happy path through the API and MCP, a test per refusal, and the rate limit.

Choices to look at

  • One shared account: every offer is authored by one shared account that cannot sign in, instead of one account per offer, so spam cannot fill the users table.
  • Not in the default tool list: offer is not in a fresh connection's tool list. That list is capped at 6,000 bytes and the tool would have pushed it over it, so I left it out rather than raise the ceiling. find_tool and tools/list with all: true find it. /llms.txt and /api/v1/here still name it. Say if you want it in the default list instead.
  • Anonymous /llms.txt ceiling: I raised the byte ceiling in test/llms-anonymous.test.ts from 7 to 7.5 KiB, with a comment saying why. The new bullet and tool line cost about 390 bytes and the text had 27 bytes of room. The MCP ceilings are unchanged.
  • Stranger MCP body limit: a stranger's MCP body may now be about 1.2 MB, but only for a call to offer; every other call stays at 64 KB (strangerMessage in src/http/mcp_offer.ts).
  • Other test edits: a few existing tests hard-coded "report and start" as the only open tools. I updated them to include offer.

Not done

  • No per-author cap on a person's own open offers beyond the repository's 20.
  • I could not call the keep_plan or estimate tools from here, so there is no plan on the issue.

Try it: on the preview, curl -s -X POST $FORGE/api/v1/repos/<owner>/<name>/offers -H 'content-type: application/json' -d '{"title":"x","patch":"<git diff output>"}', then open the pull it returns.

🤖 Generated with Claude Code

commented

This push fixes the four gate failures from the failed check. I re-ran the gate, tsc --noEmit and test/offer-stranger.test.ts (9 pass); the gate and tsc passed. I did not run the forge's full check.

  • Comment width: I rewrapped the three comment lines over 100 columns, in src/actions/offer.ts, src/actions/offer_words.ts and test/offer-stranger.test.ts. The text is unchanged, so behaviour is too.
  • Looks rule: the new commit message carries No look:. The src/web/standards.ts change is a one-line document edit, not a page that app.looks shows.
  • Pipeline-first rule: the same commit message carries Direction:. It gives the reason that letting an outsider reach a public repository goes ahead of the pipeline items.

The offer feature itself is as described in the earlier commit: POST …/offers and the MCP tool offer, held as a stranger's pull for a person.

commented

I merged main into the branch and pushed it. The only conflict was in test/llms-anonymous.test.ts, and the merge is committed as f1498407d.

The conflict was in the size cap on the anonymous /llms.txt body. This branch kept a comment saying the offer door added about 390 bytes. main raised the cap to 7.5 KiB for the check.txt door. I kept the 7.5 KiB cap and merged the two comments into one that names both doors. The offer door fits within the cap, so I didn't raise it again.

Checks after the merge:

  • bun x tsc --noEmit: clean.
  • test/llms-anonymous.test.ts: 4 pass, 0 fail.
  • scripts/gate.ts: I ran it and it printed nothing; I didn't check its exit code.

I didn't run the full suite here. The forge runs it on the push.

commented

Declined: the check's "small and single-purpose" rule is a size limit on this pull, and I can't get under it without splitting the work or dodging the rule. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m7cffcjcvvdjsz4h3tkrppjv

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs