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

Talk proposes the person's copy upstream: a pull request at the origin, its branch pushed there or to their fork there #16403

Merged opened this

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

Merged

proposeupstream { repo, branch? } plans and reads only: the repository at the origin, and whether the branch is pushed into it (the origin says the person may push) or to their fork there (made through the existing fork route when they may only read), in one sentence (upstreamWords).

Notes

shipped production is serving it deploy 496afdb

opened this

propose_upstream { repo, branch? } plans and reads only: the repository at the origin, and whether the branch is pushed into it (the origin says the person may push) or to their fork there (made through the existing fork route when they may only read), in one sentence (upstreamWords). Sent again with that plan and a title it is held behind a confirm that says the same sentence, and the yes opens the pull request at the origin and answers its address. A plan that no longer holds is refused (plan_changed), and openPull takes the told route (route) or refuses (route_changed), never quietly the other way. A branch never goes up under the origin's default branch's name: the copy's main goes up as alice/main, so a proposal never moves the origin's default branch.

Two provider fixes the two-forge test found, each its own bug on main:

  • A forge origin always read "may push": the forge's repository JSON carried no rights. GET /api/v1/repos/:owner/:name now answers permissions { push, admin }, the caller's own rights there (canWrite, canAdmin; false for no one signed in), seen only by whoever may read the repository, as the rest of that answer is. The forge provider reads it; an older forge that sends none is still read as "may push", and its refusal falls back to the fork as before.
  • The forge provider listed another forge's branches with Gitea's page, which the forge's cursor-paged list refuses (400), so a push to the person's fork on another forge could never start. It now walks { items, next_cursor } (a bare array from an older forge still reads).

The terminal's door is "Propose upstream" (palette, a person's). The system tool's line says "admin only" for "a forge admin only" so /llms.txt keeps its budget.

Try: in Talk, after "bring <origin link> in" and a change on your copy, say "open a PR upstream"; or call MCP propose_upstream with { "repo": "<you>/<name>-work" } No look: no page changes; an MCP tool, a terminal screen, Talk's confirm and an API field No door: the how-to is the bring section of docs/features/bring.md this extends, and the terminal door is the new Propose upstream screen Replaces: nothing, Talk had no way to send work on a copy back to where the repository is kept Direction: Talk works with origins, the person's repositories hosted elsewhere, the owner's ask of 11-24 (#10262), ahead of #6534

Co-Authored-By: Claude Fable 5 <[email protected]>

--- Part 3 of the origins series (#16370, #16374 landed). The owner, 2026-11-25: "i could use the crew to iterate on my fork then open a PR upstream". One commit.

For the reviewer, since this pushes to and opens pulls on another host: please check that the plan sentence is drawn from the forge, that a stale plan is refused, that the origin's default branch can never move, and the two provider fixes (push rights read from the origin; the forge provider's branch paging).

🤖 Generated with Claude Code

Changes requested — before the latest push

The design is sound: the plan is said before the yes, a stale plan is refused (plan_changed, route_changed), the crew is refused, the origin's default branch is never moved, and the Talk tool is held like every other write. I read the diff; I did not exercise the preview. These changes are needed, all in one round:

  1. No how-to. The pull adds a feature through Talk, MCP and the terminal, and there is no docs/features/<name>.md (for example docs/features/propose-upstream.md). Add it: what a person says, what the plan sentence means (branch pushed there vs. to their fork), the title, what comes back, and the terminal entry 'Propose upstream'. Do not put it in README.
  2. Untested behaviour. (a) GET /api/v1/repos/:owner/:name now returns permissions: { push, admin }, and src/core/repo_fields.ts allow-lists it. No test asserts it: a reader gets push:false, admin:false, a writer push:true, and a guest gets false. Add one. (b) ForgeProvider now parses permissions (an older forge with none still means push is unknown, so true) and has a new paged listBranches (cursor form and bare-array form). Neither has a direct test; add unit tests with canned responses. (c) openPull's new route_changed refusal and the input.route === 'direct' branch, which turns an origin refusal into an error instead of a fork fallback, have no test where the origin's answer differs from the plan. (d) The terminal screen src/tui/screens/proposeupstream.ts has no test beyond the palette roster line. Add a screen test: a plan, then a yes, then a title, then a toast with the address, and the refusal toast for a non-copy.
  3. Wording bug. upstreamWords in src/origins/words.ts prints 'your fork on GitHub' (a double space and no name) when into is fork and fork is null or empty, and proposeUpstream accepts such a told. Refuse invalid in the tool when into is fork and the fork name is empty, and never build a fork plan without a name.
  4. Boundary validation. title has no length cap or control-character check at the tool, the TUI or proposeUpstream before it goes to a foreign origin's API. Cap it (for example 256 chars, one line). branch is passed to openPull and on to a push at the origin; validate it as a ref name in planUpstream (no leading -, no .., no spaces or control characters, bounded length) instead of relying on later layers.
  5. Unrelated churn. The doc string of the system tool in src/http/mcp/tools/system.ts is rewritten. If it is needed to stay under the 18,500-byte tool-list cap, say so in the pull; otherwise revert it. Run bun scripts/gate.ts --fix and commit what it rewraps (the catalog.ts doc comment line is now long).
  6. Fallback in the ask words. In src/crew/conversation_ask.ts the propose_upstream form builds a pseudo-plan with as Args casts and defaults. asks already holds the no-plan case, so drop the fallback or return a plain sentence.

Nothing here is a Never; once these land I expect to approve.

Approved

The clone has no commit be710dab42fa, so I read the whole change instead of the diff since that head. I found nothing to block.

  • Plan and yes: a plan only reads. The yes re-plans and refuses with plan_changed or route_changed if the origin now answers differently. The title is one line of at most 256 characters, and the branch is checked with isSafeRef, so it can't become a flag. Agents are refused.
  • Origin default branch: it is never overwritten. The copy's default branch goes up as owner/main.
  • Held writes: propose_upstream is held behind a confirm when it carries a plan, and the confirm sentence comes from the plan. It is in the hostile-read test.
  • Both doors: the terminal screen is in the palette roster, docs/features/propose-upstream.md exists, and README is untouched.
  • permissions on repo GET: it reports only the caller's own rights, and a stranger gets false for both. The test covers owner, reader and stranger.
  • Tests: they cover the direct route, the fork route, the stale plan, refused pushes, bad branch and title input, the provider answers and the terminal flow.

Non-blocking: in ASKED_AS, the branch in the confirm sentence comes from the call's branch argument. Use the plan's own branch if the plan gains one.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs