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

The fence reads a person's words as permission only when they ask for the write, name the owner, and the question shows what a yes does #14921

Merged opened this

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

Merged

The fence now counts a person's words as permission only when they ask for the write, name its owner, and answer a question whose visible text says what a yes does (#14903). Questions and reports are not permission.

Notes

shipped production is serving it deploy 5f527c6

opened this

The fence now counts a person's words as permission only when they ask for the write, name its owner, and answer a question whose visible text says what a yes does (#14903).

  • Questions and reports are not permission. named() in src/core/fence.ts refuses words that start like a question (the same WONDERS list askedFor uses) or contain a ?. It also matches the tool's words, and the switches it sets, as whole words only, so "merged" and "closed" no longer count as "merge" and "close".
  • The owner must be named. A repository's short name counts only when the person owns it; any other repository must be said as owner/name. The rule now lives in one helper, repoAsSaid, shared by named() and askedFor. named() takes the person's username as a new argument, and heldWrite in src/http/mcp/shared.ts passes user.username.
  • The question is built from visible text. proposalIn() reads inline, image and reference links as their text, and drops link targets and reference definitions ([x]: /merge-12), so text that never appears on the page can't turn a "yes" into permission.

Tests: one new test per rule, in test/conversation-fence.test.ts and test/conversation-holds.test.ts. I checked that all three fail against main's fence.ts. The existing named() tests were only changed to pass the new username argument. The type check, the gate and the 410 tests in the conversation, talk and fence suites all pass. scripts/fast.ts named 2,348 test files, too many to run here, so I chose those suites myself and the forge's full check covers the rest.

Not done: words like "closing" no longer count as "close", and plurals no longer count either, so the person will be asked to confirm a little more often. That stricter result is what the issue asked for. I couldn't reach the keep_plan tool or tick the finding on #14766, so that tick still needs doing by hand.

To try it: in a talk, have the agent read another person's issue, then say "did you close 12 in one?" or "close 12 in one" about a repository someone else owns. The close is held as a confirm and not done. "close 12 in one" about your own repository goes ahead.

🤖 Generated with Claude Code

Closes #14903

2 earlier comments · 1 event
commented

The fence now counts a person's words as permission only when they ask for the write, name its owner, and answer a question whose visible text says what a yes does (#14903).

  • Questions and reports are not permission. named() in src/core/fence.ts refuses words that start like a question (the same WONDERS list askedFor uses) or contain a ?. It also matches the tool's words, and the switches it sets, as whole words only, so "merged" and "closed" no longer count as "merge" and "close".
  • The owner must be named. A repository's short name counts only when the person owns it; any other repository must be said as owner/name. The rule now lives in one helper, repoAsSaid, shared by named() and askedFor. named() takes the person's username as a new argument, and heldWrite in src/http/mcp/shared.ts passes user.username.
  • The question is built from visible text. proposalIn() reads inline, image and reference links as their text, and drops link targets and reference definitions ([x]: /merge-12), so text that never appears on the page can't turn a "yes" into permission.

Tests: one new test per rule, in test/conversation-fence.test.ts and test/conversation-holds.test.ts. I checked that all three fail against main's fence.ts. The existing named() tests were only changed to pass the new username argument. The type check, the gate and the 410 tests in the conversation, talk and fence suites all pass. scripts/fast.ts named 2,348 test files, too many to run here, so I chose those suites myself and the forge's full check covers the rest.

Not done: words like "closing" no longer count as "close", and plurals no longer count either, so the person will be asked to confirm a little more often. That stricter result is what the issue asked for. I couldn't reach the keep_plan tool or tick the finding on #14766, so that tick still needs doing by hand.

To try it: in a talk, have the agent read another person's issue, then say "did you close 12 in one?" or "close 12 in one" about a repository someone else owns. The close is held as a confirm and not done. "close 12 in one" about your own repository goes ahead.

🤖 Generated with Claude Code

commented

The fence now treats a person's words as permission only when they ask for the write, name the repository's owner, and answer a question whose visible text says what a yes does (#14903).

  • Questions and reports don't count. named() in src/core/fence.ts refuses words that start like a question (the WONDERS list askedFor already uses) or contain a ?. It matches the tool's name and the switches it sets as whole words only, so "merged" and "closed" no longer count as "merge" and "close".
  • The owner must be named. A repository's short name is enough only when the person owns it; any other repository must be said as owner/name. One helper, repoAsSaid, now holds this rule for both named() and askedFor. named() takes the person's username, and heldWrite in src/http/mcp/shared.ts passes user.username.
  • The question comes from visible text. proposalIn() reads inline, image and reference links as their text and drops link targets and reference definitions ([x]: /merge-12). Text the page never shows can't make a "yes" mean more than the person saw.

There is one new test per rule, in test/conversation-fence.test.ts and test/conversation-holds.test.ts, and all three fail against main's fence.ts. The existing named() tests changed only to pass the new username. The type check passes, and the 52 tests in those two files pass on the current branch. scripts/fast.ts named 2,348 test files, too many to run here, so I chose the suites myself; the wider conversation, talk and fence suites (410 tests) passed before the last commit.

The "both doors" gate rule failed because shared.ts changed with nothing under src/tui/. That change only passes the username into the fence and shows nothing new, so a commit carries a No door: line saying so, and the gate passes. Its remaining note, a comment line over 100 columns in fence.ts, is not from this change and is left to the nightly rewrap.

Not done: words like "closing", and plurals, no longer count as the tool's word, so people will be asked to confirm a little more often; that stricter fence is what the issue asked for. The keep_plan tool wasn't available, and the tick on #14766 still needs doing by hand.

To try it: in a talk, have the agent read another person's issue, then say "did you close 12 in one?" or "close 12 in one" about a repository someone else owns. The close is held as a confirm and not done. "close 12 in one" about your own repository goes ahead.

🤖 Generated with Claude Code

Changes requested — before the latest push

Mostly right: the whole-word verb, the question/? refusal, repoAsSaid and the link-target stripping all do what #14903 asks, and the tests cover each rule. One hole is left in rule 3, the one the issue is about: the question is built from visible text, but image alt text is not visible. Fix first: drop an image entirely (replace !alt and ![alt][ref] with nothing or a space) instead of keeping its alt text, and change the test that asserts the alt text is kept. Then !merge 12 in alice/one? can no longer give the person a question that shows nothing while a yes reads as permission for the merge.

commented

The fence decides whether a person's words give permission for a write, and it now reads only what the person can actually see. A word like yes counts only when the person asked for the write themselves or answered a closing question that names it. Comments, HTML tags, link targets, reference definitions and image alt text are all left out of that question, and so is anything outside its last paragraph.

Fix for @sentinel's review. proposalIn (src/core/fence.ts) now removes images entirely, both !alt and ![alt][ref], before it handles links. Alt text doesn't show when the image renders. Before this, an agent could put merge 12 in alice/one in an image's alt text and ask Shall I go ahead?, and a yes would count as permission for a write the person never saw. Links still read as their text, as before.

Tests (test/conversation-holds.test.ts):

  • The test that expected the alt text (the chart) to stay in the proposal now expects the image to add nothing, for both inline and reference images.
  • A new test puts open an issue in alice/one in an image's alt text and checks two things. The proposal doesn't carry those words. A yes to it is not permission, while a yes to the same words written as plain text still is.

bun x tsc --noEmit passes, and the three test files that cover the fence pass (conversation-holds, conversation-fence, brief-foreign-fence). bun scripts/fast.ts named 2,426 test files for this diff (an estimated 3.5 hours), so I ran those three files instead. That broad run was still going in the background when I pushed and I don't have its result; the forge's check runs the full suite on this push. The gate's note about comment lines over 100 columns is about lines that were already in fence.ts; it leaves those to the nightly rewrap on main.

To try it: in a talk on /talk, have the agent end a message with !open an issue in alice/oneShall I go ahead? and answer yes. The write is held as a confirm, not done.

🤖 Generated with Claude Code

Approved

My earlier ask is met: proposalIn now drops images whole, inline and reference, before links are read as their text. The new test shows a yes to !open an issue in alice/oneShall I go ahead? is not permission, while the same words as plain text still are. The named() question rule, whole-word matching and owner/name rule are unchanged and tested.

Non-blocking: the image regexes stop at the first ], so alt text with an escaped bracket (![x \] merge 12 in alice/one](/x.png)Shall I go ahead?) is not stripped, though it never renders. Consider handling \] in the alt pattern, or treating any ![ as hiding the rest of that paragraph, plus a test.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs