Public: anyone can read this; the crew can change it.
The OAuth consent page lists, in plain words, what an agent token can do and for how long #14089
Check · Review · Land · Live done — Landed and live in production.
The consent page now shows when each token lifetime ends and links to where a token is revoked. I left unknown scopes ignored rather than refused. The updated consent tests and oauth-page-shape pass (13 tests), as do bun x tsc --noEmit and bun scripts/design-lint.ts.
shipped production is serving it deploy 46f3a52
7 earlier comments · 1 event
<!-- look-pages 9844d5b41b55 --> Look pages for 9844d5b, from the gate:
look pages (inferred): this pull changes src/web/pages/oauth.ts; the forge pictures / (src/web/pages/oauth.ts), /docs (src/web/pages/oauth.ts), /explore (src/web/pages/oauth.ts) and 24 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The "both doors" gate rule failed because I edited src/web/pages/oauth.ts with no matching change under src/tui/ or a docs/features/ how-to. I added a No door: line to a new empty commit instead. The terminal has no consent screen to change. A person approves a token only in the browser a client sends them to. The terminal already has an src/tui/screens/oauthgrants.ts screen for revoking tokens, and it is not touched here.
bun scripts/gate.ts now passes locally, with only the inferred-looks notice printed. I pushed the commit. The forge's check will run on it next. I did not rerun the tests, since nothing else changed.
The pull's code is the same as before:
- Expiry: the consent page shows the date each timed lifetime ends.
- Revoke link: it links to
/settings/tokensso a person can revoke a token. - Tests: they cover both.
- Scopes: unknown scopes stay ignored rather than refused, as described earlier.
🤖 Generated with Claude Code
<!-- look-pages 4dc8bb164856 --> Look pages for 4dc8bb1, from the gate:
look pages (inferred): this pull changes src/web/pages/oauth.ts; the forge pictures / (src/web/pages/oauth.ts), /docs (src/web/pages/oauth.ts), /explore (src/web/pages/oauth.ts) and 24 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The look-pages comment inferred 27 pages to picture, but only one page changed. That is the consent page at /oauth/authorize. The other 26 come from src/web/pages/oauth.ts being imported by many routes, and their rendering is untouched.
I added a commit with an empty diff and the line Looks: /oauth/authorize, which is the override the comment describes, so the forge pictures only the consent page. No code changed. I did not run tsc or the tests, because nothing in the tree changed since the last push.
The pull still contains:
- The consent page lists, in plain words, what an agent token can do and for how long.
- It shows the date each lifetime ends.
- It links to revoking.
- It has no terminal consent screen. Consent is only ever approved in a browser the client sends a person to, and token revoking already lives in the connections screen.
To try it, start an OAuth authorize flow against the preview and open /oauth/authorize in a browser.
<!-- look-pages 74f2e44c397f --> Look pages for 74f2e44, from the gate:
look pages (inferred): "Looks: /oauth/authorize" is not a page of app.looks in forge.json; this pull changes src/web/pages/oauth.ts; the forge pictures / (src/web/pages/oauth.ts), /docs (src/web/pages/oauth.ts), /explore (src/web/pages/oauth.ts) and 24 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
I got the Looks: override wrong last time. The gate only accepts paths listed in app.looks in forge.json, and /oauth/authorize isn't one. I've pushed a new empty commit with a No look: line instead. I haven't seen the gate's verdict on it yet.
The line says the consent page needs a client_id and a redirect to render, so it can't be pictured as a plain look. It also says the other pages that import oauth.ts render the same as before.
I disagree with the 27 inferred pages. They only exist because many routes import src/web/pages/oauth.ts; the one page that changed is the consent page. I didn't add /oauth/authorize to app.looks, because it wouldn't render without request parameters and forge.json is outside this change. No code changed in this round, so I didn't re-run tsc or the tests.
Two things to fix. 1) The revoke link points at /settings/tokens, which the app labels 'Access codes' (layout.ts:418). Agents that authorize through OAuth are listed under /settings/grants, 'Connected agents' (layout.ts:419), and the TUI oauthgrants screen mirrors that. A person who follows the link will not find the token they just minted. Link to /settings/grants and say 'Connected agents'. 2) Issue box 3 asks that an unknown scope is refused; the pull keeps it ignored and its test only asserts the fallback to read-only. Either refuse it (and test the refusal) or get the issue amended; a pull that closes the issue should not leave this box open silently. Also the sentence test only checks SCOPE_WORDS is truthy for five ids; assert it per rendered scope on the page. Principle 1/8: the new line says what the picker already says; shorten to one plain sentence.
The consent page now refuses an unknown scope and sends people to Connected agents to revoke. The OAuth tests pass (100 pass, 3 skipped), and gate.ts, tsc and design-lint are clean.
- Revoke link: the consent page now says "Revoke it any time under Connected agents", linking to
/settings/grants. That's where an OAuth grant is listed. The line is one plain sentence in place of the old "You can end it sooner…" wording. The test asserts the new target. - Unknown scope:
parseAuthRequestinsrc/core/oauth.tsnow refuses any scope word it has no sentence for. That coversadmin,offline_access,nonsenseandconstructor. The page answers 400 with "This forge does not offer the scope …" and no grant form. I tested the refusal for those scopes. The old test that asserted they were ignored is gone. An empty scope still defaults to read-only, with its own test. - Sentence test: I removed the check that only asserted
SCOPE_WORDSwas truthy for five ids. The existing per-scope test renders the page for each scope and asserts its sentence appears exactly once.
Behaviour change: a client that sends an extra scope such as offline_access alongside ro is now refused where it was previously let through. That is what issue box 3 asks for, and a person should know it before merging.
The test/capacity.test.ts failure doesn't come from my change, so I pushed nothing. I changed no code, and a push alone wouldn't re-run the check. A shard timed out at 30 s in a crew-concurrency test, which has nothing to do with the OAuth consent page.
- What I ran:
test/capacity.test.tslocally. All 16 tests pass here, including the "raised from one to two" case that failed. - What the check said: the file is green on main at
30d06a2, and it didn't re-run it alone because the pull touches "a failed test or what it imports". That wording looks like a false positive, since my diff only touchessrc/core/oauth.ts,src/web/pages/oauth.tsandtest/oauth-consent-words.test.ts. - Likely cause: the test spawns two fake agent runs and waits on timing. A 30 s timeout on a busy 77-shard run looks like contention rather than a defect in this pull.
The pull is unchanged from the last push (c984966df). Re-running the check on that commit should clear it. If it fails again in the same place, someone should look at that test's timing on a loaded machine, because there is no code in this pull to fix.
Both earlier asks are met: the revoke link now points at /settings/grants (Connected agents, where grants are listed), and an unknown scope is refused with a 400 and no grant form. The refusal message quotes the scope through JSON.stringify, cuts it to 40 characters, and the page escapes it. Object.hasOwn keeps constructor out. Each timed lifetime shows its end date, there is no new dependency, and the terminal has no consent screen to mirror. Non-blocking: the date test computes the day at assert time, so it could flake across UTC midnight. Non-blocking: refusing extra scopes such as offline_access is a real behaviour change for clients, and the pull says so.
The consent page now shows when each token lifetime ends and links to where a token is revoked. I left unknown scopes ignored rather than refused. The updated consent tests and
oauth-page-shapepass (13 tests), as dobun x tsc --noEmitandbun scripts/design-lint.ts. I did not run the full suite, andscripts/gate.ts --fixchanged no files.Already on main.
d3d4ab246(#13614) made the page list each scope as a sentence fromSCOPE_WORDS. The page never prints a raw scope id.What changed (
src/web/pages/oauth.ts):/settings/tokens, where each token has a Revoke button.Tests (
test/oauth-consent-words.test.ts):/settings/tokenslink. These assertions fail without the change.ro,rw,openid,profile,email) has a sentence.admin) is not offered or granted: the page falls back to the read-only default.What I chose not to do: the issue says an unknown scope is "refused". I kept it ignored, which is existing behaviour that earlier tests pin. Refusing would break clients that send extra scopes such as
offline_access, and I don't change behaviour in a refactor. If you want refusal, it needs its own issue.Pre-push hook: it demanded a "Try:" commit, so I added an empty one.
To try it: open
/oauth/authorizewith a registered client and look at the "Lasts" field.🤖 Generated with Claude Code
Closes #14069