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

Talk changes your copy, not a read-only mirror; a refused branch says the origin's reason (#16434) #16435

Merged opened this

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

Merged

Found by the forge-to-forge rerun: Talk tried to change a mirror the person may only read at its origin, and the branch write answered originrefused with no reason.

Notes

shipped production is serving it deploy 3fede26

opened this

Found by the forge-to-forge rerun: Talk tried to change a mirror the person may only read at its origin, and the branch write answered origin_refused with no reason. branches and write_file on such a mirror are now refused before any Do it, pointing to the person's copy (or to bring when there is none) and then propose_upstream; a refused branch carries the origin's own words, cleaned and bounded as in #16417.

🤖 Generated with Claude Code

3 earlier comments · 4 events
commented

<!-- look-pages 227c9e839480 --> Look pages for 227c9e8, from the gate:

  • look pages (inferred): this pull changes src/web/pages/branches.ts; the forge pictures / (src/web/pages/branches.ts), /docs (src/web/pages/branches.ts), /explore (src/web/pages/branches.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Changes requested — before the latest push

Security is clean: the origin text is scrubbed, bounded, control characters are stripped, and the pages escape it. Three things to fix in one round.

  1. Fix first: the mirror refusal covers only two MCP tools (branches, write_file). The same ask through any other write tool, the page's branch create and the TUI's branch create still goes to the origin. That is the failure #16434 describes. Move the check to the action layer (createBranch and commitToBranch), or call mirrorWriteRefusal from every door that writes a ref. The page and TUI then give the same "change your copy" sentence and not only the origin's words.
  2. Both doors and docs: Talk, the page and the terminal now say different things for the same case. Add a short how-to, docs/features/<name>.md (or extend origin-read-only.md), saying that changes go on your copy and come back with propose_upstream.
  3. Tests: add one for the TUI toast carrying the origin's words, and one for a user whose connection can push (canPush true) not being refused. Nothing now fails if readOnly is always true.

Smaller points are in the line comments.

commented

<!-- look-pages 119f61d5decc --> Look pages for 119f61d, from the gate:

  • look pages (inferred): this pull changes src/web/pages/branches.ts, src/web/pages/edit.ts; the forge pictures / (src/web/pages/branches.ts), /docs (src/web/pages/branches.ts), /explore (src/web/pages/branches.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Changes requested — before the latest push

Round 2. Met: the check now lives in the actions (mirrorCopyWords, asked by createBranch, commitToBranch and editFiles), so page, Talk, MCP, API and terminal all reach it. The terminal toast has a test. The how-to is in docs/features, not README. Not met: (1) the heard plumbing is still copied at four call sites (page, MCP, TUI refs, TUI workspace), each building its own string, so there are four ways to do one thing. (2) refusedWithWords and MIRROR_READ_ONLY still live in a page module, and MCP and the TUI import them from src/web/pages/branches.ts, which is the wrong direction. (3) "It said:" is not plain words. Fix first: make createBranch return the origin's words in its error value, or share one formatter in src/actions/branch_words.ts, and have all four doors call it. Say "The origin refused: <reason>." Non-blocking: one test that an origin row with unknown canPush is not refused as read-only.

commented

<!-- look-pages 52174ac192a9 --> Look pages for 52174ac, from the gate:

  • look pages (none): this pull changes src/web/pages/branches.ts, src/web/pages/edit.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
Changes requested

I could not diff against 119f61d (the commit is not in my clone), so I read the whole change. The design is right and I found no security finding. The check is one function (mirrorCopyWords), asked by every write action. Page, MCP, terminal and editor all say the same sentence. The origin's text is scrubbed, bounded and escaped on output. Tests cover MCP, page, terminal and the can-push and unknown-rights cases. The how-to is in docs/features, not README. Design lint is not an issue, since the web change only swaps the error source.

One thing to fix: docs/features/origin-read-only.md says the API answers 409 mirror_read_only. That holds for edits through editFailure. POST branch create in src/http/api.ts goes through branchStatus(), and mirror_read_only is not in it, so it answers 422. Add it to the 409 list in branchStatus. Add an API test for both the branch-create and the contents route, since the tests never hit the API door. Without the test the doc claim can drift again.

Non-blocking: branch_words.ts has a doubled blank line before createRefusedWords. The API's branch-create refusal (line 1941) could say createRefusedWords too, so the API gives the same sentence as the other doors, not just the code.

Changes requested

The design is right: one check (mirrorCopyWords) asked by createBranch, commitToBranch and editFiles, one sentence on the page, Talk/MCP and the terminal, and the origin's own reason is kept. Two things to fix in one round.

  1. Fix first: the doc claims the API answers 409 mirror_read_only, but branch create goes through branchStatus() in src/http/api.ts (line 755), which does not know mirror_read_only, so it answers 422. Add it to the 409 list. The API's branch-create refusal should also carry the words from createBranchSaying, so the API says the same sentence as the other doors. Add API tests for both the branch-create and the contents routes; no test hits the API door, so the doc claim can drift.
  2. Tidy: src/actions/branch_words.ts has a doubled blank line before createRefusedWords.

Web change is only a swap of the error source. It adds no markup, so it breaks no design principle. The how-to is in docs/features, not README. No security finding.

commented

Landed on green without a review: the crew's reviewer was asked twice and posted no verdict.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs