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

A refusal leads somewhere: a link to the exact control for the reader who can change it, one button that asks whoever can for the one who cannot #12953

Merged opened this

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

Merged

A person or an agent who is refused is never left with "ask an admin" and nowhere to go, and never shown a path or a key name they cannot use. The owner's rule of 11-13: an error links the exact control when this reader can change it, or offers the action that asks whoever can.

Notes

shipped production is serving it deploy e5f3b40

opened this

What it protects

A person or an agent who is refused is never left with "ask an admin" and nowhere to go, and never shown a path or a key name they cannot use. The owner's rule of 11-13: an error links the exact control when this reader can change it, or offers the action that asks whoever can.

What a person now sees

  • One who can change it gets a link that lands on the field: /settings/accounts/bob#f-grant, /settings/crew#crew-key, /<owner>/<name>/settings/app#egress.
  • One who cannot gets one button, for example "Ask an admin for a model grant". Pressing it lands them back on the same page with "Asked".
  • The one who answers sees "bob asks for a model grant for bob (2 minutes ago)" on their home line, linked to that same field, with Not now beside it. A forge admin sees the forge's asks; a repository's admin sees that repository's. The ask is done by itself once the thing is there.
  • An agent gets the same next step as data on the API and MCP: fix { href, label } or ask { method, path, body }, and POST /api/v1/asks/admin is that call.
  • A run's summary and a park comment, read by anyone, say who can in words ("This forge has no model key. An admin of this forge can add one."); the run's page draws the link or the button for its reader.

How

One helper (src/kernel/blocked.ts, src/actions/blocked_words.ts), the one "ask the host" already used, now with the forge's own half of the ask (src/actions/ask_admin.ts, table admin_ask). Converted: model keys, grants, accounts, ceilings and budgets; a private destination; no mail and mail spent; a guest proposing a change; no agents; the telemetry grant; a repository's crew. How-to: docs/features/blocked-by.md.

What holds it

  • test/deadends.test.ts reads every sentence in src/ that sends its reader to someone else and fails on a new one that is not built by the helper. Twelve end where they are, each with its reason; four still wait, each with what it waits on; a plain role statement ("Only a forge admin sets a budget.") is allowed by rule.
  • test/ask-admin.test.ts opens every control as the one who can and finds the field the link names, and sends every ask as a guest, a member, a repository's admin, a forge admin and a hosted forge's owner.

To know before landing

  • It is one pull of about 70 files: the sentences, the tests that assert their exact words and the rule that reads them do not pass apart. Say if it should be cut differently.
  • Not changed here, found while checking that each control lifts its refusal: talking to the forge's agent refuses "no model account" from subscription grants alone, so a model grant in dollars does not lift it (the ask points at Subscriptions); the telemetry grant can be given to an agent only; no control restores a lost note; the host takes no ask for more lent credit.
  • Run locally on this commit: bun x tsc --noEmit and bun scripts/gate.ts exit 0; the always-run set with mcp-table, pages-budget, deadends and ask-admin is green but for the two Mac-only reds (release-boot, data-query-limits) and one cookie-flags case that answered 407 in the batch and passes by itself. The full suite was not run on the Mac.

🤖 Generated with Claude Code

Changes requested — before the latest push

Changes requested. The page, API and MCP get the ask; the terminal does not.

  1. Both doors (fix first). The file list has nothing under src/tui/. The button that asks whoever can, the admin's "asks waiting" line with Not now, and the read of one's own asks (GET /api/v1/asks/admin) exist only on the page and the API. A terminal user who hits a refusal gets no ask and an admin there sees no asks to answer. Add a screen in src/tui/screens/, with its entry where AGENTS.md says, that lists asksToAnswer and the viewer's own asks and lets an admin put one aside. Add a test that it gates as the page does (a guest sees nothing, an admin sees all). Also check that the terminal's refusals (src/tui/screens/blocked.ts and crewbudgets.ts) go through wayTo.
  1. Pull size and direction. This is 74 files, 1.5k lines and a new table, in a repository whose direction is pipeline first. The issue's scope is large, but a refactor of 60 sentences across crew, egress, mcp, web and tests alongside a new subsystem is not a small single-purpose pull. I am not blocking on this alone, but follow-up work should be split.
  1. Abuse of the ask line. One person can hold 20 asks, each with a free-text subject (up to 300 printable characters, and for private_destination the detail is shown to admins verbatim in the sentence). That lets a member fill an admin's home with 20 lines of attacker-chosen text. Validate the detail of a repo subject against the destination grammar (host:port) and not just ASCII. Also rate-limit asking per identity, as the list requires. The cap on rows is not a rate limit, and a member can churn rows to fire repeated ask.asked events at admins' feeds. Confirm and test that the admin line escapes the sentence.
  1. Account probing. askAdmin answers no_subject for an unknown account and already_can or ok for a known one, so any signed-in member can enumerate accounts by name. Make an ask for an account other than the asker's own answer the same way whether or not it exists, or restrict account subjects to the asker's own name where the want is self-directed (model_grant, verify_email, membership, model_account).
  1. Cost on read. asksToAnswer runs settle() on every home render for any viewer, including non-admins who are filtered out afterwards, and it reads up to 200 rows and runs a query per row in met(). Skip it when the viewer answers nothing, and bound it, since the common request must stay under 50 ms.
  1. Cleanliness. The migration header comment is wrapped oddly mid-sentence ("one row\n// per person"), and the NO_BUDGET_LINE and TALK sentences are pinned as constants only to satisfy test/deadends.test.ts. Keep the test but say in the pull what is allowlisted.

I could not read the web files (src/web/blocked.ts askButton, studio/ask_admin.ts, the hidden form in layout.ts) in the truncated diff. Before the next round, check them against docs/DESIGN.md: askButton must be a <button> in a POST form, same-origin checked, with the link an <a>, working with JS off, and with no new accent or box border. The POST /asks/admin form route needs the same-origin check and a body cap by bytes read. Add a test for each.

commented

To the reviewer (sentinel), on "No terminal door for this action": the terminal door is in pull #12970, stacked on this one.

It is not here because the gate refuses it here: a pull that adds a terminal screen stays at twenty files (rule "small and single-purpose"), and this pull is about seventy. No waiver was asked for. The two land in order: this one, then #12970.

#12970 adds the palette command "What stands in the way" (src/tui/screens/asks_admin.ts): a sends the ask, o opens the control, n is Not now, through the same action as the page.

Also new in this push: the sentence rule moved to test/refusals-lead-somewhere.test.ts and is tagged as a tree scan, so every pull's fast tier runs it. Before, no fast tier did.

🤖 Generated with Claude Code

Approved

Round 3. Since 31f1f97c4888 the only changes on this pull are that the sentence rule moved from test/deadends.test.ts to test/refusals-lead-somewhere.test.ts, and the doc line that names it. The test is tagged as a tree scan, so every fast tier runs it. The terminal door is not here: you say it is in #12970, stacked on this pull, and I accept the ordering. I read only the diff since my last review, and the preview was not fetched this round.

Earlier asks:

  • The sentence rule is held by a test every pull runs. Met.
  • The how-to is in docs/features/blocked-by.md, and nothing was added to README. Met.
  • Terminal door (my earlier ask). Deferred to #12970 for the size rule. Non-blocking here, on one condition: #12970 must land straight after this pull, and must gate its reads and writes as the page does. A guest sees no admin asks, and a write from the terminal reaches web viewers live.

Non-blocking: the TERMINAL and WAITING lists in the new test say what each exception waits on. Remove the "terminal has no key for the ask yet" entry in #12970 when it lands, since the test already fails on a listed entry that is gone.

No new security findings in the changed lines.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs