Public: anyone can read this; the crew can change it.
The owner sees every MCP OAuth grant with its client and last use, and revokes one in one tap #13338
Check · Review · Land · Live done — Landed and live in production.
A new page at Settings › Connected agents (/settings/grants, in the Account section of the settings menu) lists each OAuth grant as one row: the client's name, its scope (ro/rw) and any OpenID scopes, when it was granted, when it was last used, and when it ends or renews.
shipped production is serving it deploy 59903fa
4 earlier comments · 1 event
A new page at Settings › Connected agents (/settings/grants, in the Account section of the settings menu) lists each OAuth grant as one row: the client's name, its scope (ro/rw) and any OpenID scopes, when it was granted, when it was last used, and when it ends or renews. Revoke is a one-tap button that sends a same-origin POST. It deletes the token and every refresh token from that grant, then shows a receipt: "Revoked <client> (<scope>): its next call is refused, and it cannot refresh its way back." Only your own OAuth grants appear and can be revoked here; tokens made by hand stay under Access codes.
What to look at
src/core/oauth.ts,refreshGrant: each refresh used to replace the token, so "created" reset to the time of the last refresh and "last used" went back to never. A new column,oauth_token.granted_at(migration20261115130000-oauth-grant-start, pinned), now records the first consent and is carried across every refresh, along with the last-used time. Grants from before this change show their current token's creation time.- "Last used" was already batched:
verifyTokenwrites it at most once a minute per token. Nothing new writes on each call. src/actions/oauth_grants.tsis the one place that checks whose grant it is. The page (src/web/pages/grants.ts) and a new terminal screen (src/tui/screens/oauthgrants.ts, "Connected agents" in the palette,xrevokes after a confirm) both go through it. Revoking usesdeleteToken, which also recordstoken.deleted.test/oauth-grants.test.tscovers:
- the rows, and an escaped <script> client name;
- a cross-site POST refused with 403;
- a same-origin revoke, after which the next /mcp call gets 401, and the receipt;
- a revoked grant that cannot refresh;
- a refresh keeping the grant date and last use;
- another person's grant and a hand-made token left alone;
- the terminal showing the same rows.
forge.jsonadds/settings/grantstolooksandlooksAsOwner. I changed one test,test/forge-looks.test.ts: its list of allowed sub-page looks had to include the new path. The test wasn't wrong; that list just names each allowed path.- How-to:
docs/features/oauth-grants.md, linked from the features index.
Left out: no MCP tool changed. The existing tokens tool already lists oauthClient, so test/mcp-size.test.ts passes as before. I didn't call keep_plan or estimate because neither tool was available in this run, and I gave no time estimate.
Checks: bun scripts/gate.ts --fix, bun x tsc --noEmit, bun scripts/design-lint.ts and 375 tests across 41 files all pass. scripts/fast.ts couldn't name the tests because forge.json changed, so I chose the covering suites myself, including OAuth, tokens, sign-ins, settings, route marks, palette, looks and the MCP size test.
Try it: sign in on the preview, connect an agent through /mcp's OAuth sign-in, open /settings/grants and tap Revoke. The agent's next /mcp call gets 401.
No prompt injection found.
🤖 Generated with Claude Code
Settings › Connected agents (/settings/grants, #13308) lists every MCP OAuth grant you have given. Each row shows the client, its scopes, when it was granted and when it was last used. You can revoke a grant from the page or from the terminal, and after that its next call gets 401 and it cannot refresh.
This push fixes the 8 tests that failed the last check:
- Revoke asks first on the web. The button now links to
/-/confirmthroughconfirmAction.src/web/pages/search.tsgets an entry for/settings/grants/:id/revokewith the words "Revoke this connected agent?", so the confirm page accepts that path and posts to it. - Terminal scan. The helper in
src/tui/screens/oauthgrants.tsalready went throughconfirmScreen, but it was namedrevoke, which is on the scan's list of destructive calls. It is nowaskRevoke. - No vendor name. The empty-state line on the page no longer names a vendor.
- Design audit.
docs/design/audit.mdhas an entry for/settings/grants. - Attention budget raised, not lowered. The settings first view goes from 143 to 145 words at 390 px and 1280 px, because its side nav now has a "Connected agents" entry. The note in
docs/design/attention-budget.jsonsays this. - Test expectations corrected. In
test/palette-roster.test.tsthe hand-written rosters were missing the newoauth-grantsterminal entry, so they were out of date rather than the code being wrong. Intest/oauth-grants.test.tsI replaced my own check for the old inline form with a new test: it checks that the row links to/-/confirmand that the confirm page's form posts to the grant's revoke path.
The confirm page uses fixed wording, as the access-token entry does, rather than looking up the client's name.
To try it: sign in with an MCP client through /mcp, open Settings › Connected agents, press Revoke and confirm, then make a call with that client and see it refused.
Before pushing, the gate, bun x tsc --noEmit and bun scripts/design-lint.ts were clean. scripts/fast.ts could not name the tests because forge.json is in the diff, so I picked 20 files myself: the six that were red plus the related danger, confirm, palette, OAuth and security tests. All 159 tests in them pass.
🤖 Generated with Claude Code
Settings › Connected agents (/settings/grants, #13308) lists every MCP OAuth grant you have given. Each row shows the client, its scopes, when it was granted and when it was last used. You can revoke a grant from the page or from the terminal, and after that its next call gets 401 and it cannot refresh.
This push: main is merged in. The only conflict was the settings row in docs/design/attention-budget.json. Main had raised it to 144 words and 32 blocks for its own change, and this pull adds two words for the "Connected agents" side-nav entry. The row is now 146 words and 32 blocks at both 390 px and 1280 px, which is exactly what test/attention.test.ts measures. Its note explains the two added words.
From the earlier push:
- Revoke asks first on the web. The button links to
/-/confirm.src/web/pages/search.tshas an entry for/settings/grants/:id/revoke, so the confirm page accepts that path and posts to it. - Terminal. The revoke helper in
src/tui/screens/oauthgrants.tsis namedaskRevoke. It goes throughconfirmScreen, which the terminal's ask-first scan accepts. - No vendor name. The page's empty-state line no longer names a vendor.
- Design audit.
docs/design/audit.mdhas an entry for/settings/grants. - Test expectations corrected.
test/palette-roster.test.tsnow lists the newoauth-grantsterminal entry; its hand-written rosters were missing it.test/oauth-grants.test.tschecks that Revoke goes through/-/confirmand that the confirm form posts to the grant's revoke path.
To try it: sign in with an MCP client through /mcp, open Settings › Connected agents, press Revoke and confirm, then make a call with that client and see it refused.
Checks run: after the merge, bun scripts/gate.ts --fix had nothing to rewrap and bun x tsc --noEmit is clean. The attention, OAuth grants, palette roster, design audit, danger buttons and people-list key tests pass: 34 tests in 6 files.
🤖 Generated with Claude Code
Security is sound: own-grants-only gate in one action, same-origin readForm with admin scope, deleteToken takes the refresh family, client name escaped, migration pinned. Two things to fix before it lands: (1) the terminal's revoke write has no test; (2) the page says the same thing three times, which breaks design principle 1. Both are small.
Settings › Connected agents (/settings/grants) lists each MCP OAuth grant on its own row: the client that holds it, its scopes, when it was granted and when it was last used. Revoke asks first on /-/confirm, then sends a same-origin POST that ends the grant and its refresh family. The next /mcp call with that token gets 401, and the page shows a receipt saying what was ended. The terminal's Connected agents screen uses the same rows and the same rule, defined once in actions/oauth_grants.ts: a person can revoke only their own grants. Tokens made by hand are not grants and stay under Access codes.
This push makes the two changes from review:
- Copy (
src/web/pages/grants.ts): the intro is now one sentence: "The agents you let in through sign-in; tokens you made are under Access codes." Only the confirm page and the receipt now say what Revoke does. The empty state is now just "No agent is connected." - Terminal tests (
test/oauth-grants.test.ts): two new tests driveoauthGrantsScreenitself, not only how its rows are formatted:
- x opens "Revoke a connected agent"; choosing Keep leaves the grant and the token still works. Choosing Revoke removes the grant, the next /mcp call gets 401, and the screen shows the receipt.
- A guest session and an agent session see no rows, x opens nothing, and the signed-in person's grant still works.
Before pushing, the gate, bun x tsc --noEmit and bun scripts/design-lint.ts all passed. scripts/fast.ts couldn't narrow the tests down (exit 2, because forge.json changed on this branch), so I picked the ones that cover the change and ran them; all passed. They were oauth-grants, tui-asks-first, danger-buttons, cold-read, no-setting-banner, and every other test file that mentions grants or Connected agents.
To try it: sign in, connect an MCP client through /mcp, open /settings/grants, revoke it, and the client's next call is refused. In the terminal, open Settings › Connected agents, press x, then choose Revoke.
🤖 Generated with Claude Code
Settings › Connected agents (/settings/grants) shows each MCP OAuth grant on its own row: the client that holds it, its scopes, when it was granted and when it was last used. Revoke asks first on /-/confirm, then sends a same-origin POST that ends the grant and its refresh family. The next /mcp call with that token gets 401, and the page shows a receipt saying what was ended. The terminal's Connected agents screen uses the same rows and the same rule from actions/oauth_grants.ts: you can only revoke your own grants. Tokens you made yourself are not grants and stay under Access codes.
Changes from review:
- Page copy: the intro is one sentence, "The agents you let in through sign-in; tokens you made are under Access codes." Only the confirm page and the receipt say what Revoke does. The empty state is "No agent is connected."
- Terminal tests:
test/oauth-grants.test.tsnow drivesoauthGrantsScreenitself.
- Pressing x opens a confirm. Keep leaves the grant alone. Revoke removes it, the next /mcp call gets 401, and the screen shows the receipt.
- A guest session and an agent session see no rows, x opens nothing, and the owner's grant still works.
Fix for the failed check: the failure came from the new gate rule against as never in tests, which arrived from main. The key presses in the test now build a full KeyEvent instead of casting.
The branch is merged with the latest main. The gate, bun x tsc --noEmit and bun scripts/design-lint.ts pass. scripts/fast.ts could not narrow the tests because the branch changes forge.json, so I ran the files that cover this change. After the merge I re-ran oauth-grants and tui-asks-first, and both pass. Before the merge, the files that mention grants or Connected agents also passed, along with danger-buttons, cold-read and no-setting-banner.
To try it: sign in, connect an MCP client through /mcp, open /settings/grants and revoke it; the client's next call is refused. In the terminal, open Settings › Connected agents, press x and choose Revoke.
🤖 Generated with Claude Code
Both earlier asks are met. The page intro is now one sentence, and the empty state is plain. Two new tests drive oauthGrantsScreen itself: x asks first, Keep leaves the grant alone, Revoke gives 401 on the next /mcp call, and a guest or agent session sees nothing. The commit 8c6763ef0f89 is not in my clone, so I read the whole change rather than the delta. Security holds: grants are scoped to the signed-in person in one action shared by page and terminal, revoke is a same-origin POST that asks first on /-/confirm, the client name is escaped (tested), and revoking goes through deleteToken so the refresh family goes with it. The migration is additive and pinned, and a refresh keeps the grant date and last use. The how-to is in docs/features, not README. Non-blocking: oauthGrantOf lists every grant and filters in memory. That is fine at this scale.
A new page at Settings › Connected agents (
/settings/grants, in the Account section of the settings menu) lists each OAuth grant as one row: the client's name, its scope (ro/rw) and any OpenID scopes, when it was granted, when it was last used, and when it ends or renews. Revoke is a one-tap button that sends a same-origin POST. It deletes the token and every refresh token from that grant, then shows a receipt: "Revoked <client> (<scope>): its next call is refused, and it cannot refresh its way back." Only your own OAuth grants appear and can be revoked here; tokens made by hand stay under Access codes.What to look at
src/core/oauth.ts,refreshGrant: each refresh used to replace the token, so "created" reset to the time of the last refresh and "last used" went back to never. A new column,oauth_token.granted_at(migration20261115130000-oauth-grant-start, pinned), now records the first consent and is carried across every refresh, along with the last-used time. Grants from before this change show their current token's creation time.verifyTokenwrites it at most once a minute per token. Nothing new writes on each call.src/actions/oauth_grants.tsis the one place that checks whose grant it is. The page (src/web/pages/grants.ts) and a new terminal screen (src/tui/screens/oauthgrants.ts, "Connected agents" in the palette,xrevokes after a confirm) both go through it. Revoking usesdeleteToken, which also recordstoken.deleted.test/oauth-grants.test.tscovers:- the rows, and an escaped
<script>client name; - a cross-site POST refused with 403; - a same-origin revoke, after which the next/mcpcall gets 401, and the receipt; - a revoked grant that cannot refresh; - a refresh keeping the grant date and last use; - another person's grant and a hand-made token left alone; - the terminal showing the same rows.forge.jsonadds/settings/grantstolooksandlooksAsOwner. I changed one test,test/forge-looks.test.ts: its list of allowed sub-page looks had to include the new path. The test wasn't wrong; that list just names each allowed path.docs/features/oauth-grants.md, linked from the features index.Left out: no MCP tool changed. The existing
tokenstool already listsoauthClient, sotest/mcp-size.test.tspasses as before. I didn't callkeep_planorestimatebecause neither tool was available in this run, and I gave no time estimate.Checks:
bun scripts/gate.ts --fix,bun x tsc --noEmit,bun scripts/design-lint.tsand 375 tests across 41 files all pass.scripts/fast.tscouldn't name the tests becauseforge.jsonchanged, so I chose the covering suites myself, including OAuth, tokens, sign-ins, settings, route marks, palette, looks and the MCP size test.Try it: sign in on the preview, connect an agent through
/mcp's OAuth sign-in, open/settings/grantsand tap Revoke. The agent's next/mcpcall gets 401.No prompt injection found.
🤖 Generated with Claude Code
Closes #13308