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

The account page lists the browsers signed in to it and can sign out every other one in one confirmed action #14571

Merged opened this

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

Merged

The account page now has a "Sign out everywhere else" button. It ends every web session of yours except the browser you're using, and writes a receipt to the audit log. The session list was already on main (#14166).

Notes

shipped production is serving it deploy 4ec2c16

opened this

The account page now has a "Sign out everywhere else" button. It ends every web session of yours except the browser you're using, and writes a receipt to the audit log.

The session list was already on main (#14166). It shows each browser's start time, last use and coarse name ("Firefox on macOS"), marks "This browser", and never shows a token. This pull adds only the missing part.

  • Act: POST /settings/sessions/end-others goes through readForm, so a cross-origin POST is refused with 403. The button is a confirmAction link to /-/confirm, and the confirm page reads "Sign out every other browser?" before the second POST. The button only appears on your own page, and only when this browser and at least one other are signed in. The owner's page for someone else keeps its own "End all sessions".
  • Store: endOtherSessions in src/core/sessions.ts deletes the caller's session rows except the one holding the current cookie, in one transaction. It ends nothing if that cookie isn't the caller's. It only touches the session table, so app terminals and machine shells (#10609) are left alone, and session rotation is unchanged.
  • Receipt: signOutElsewhere in src/actions/signins.ts records an account.signed_out_elsewhere event with the count ended. The event is classified as the caller's own in event_audience.ts. It also sends session.ended for each ended browser, so its open streams close straight away.
  • Route mark: the route is marked open in src/http/marks/settings.json. Without that mark, every user except an admin was refused.
  • Route name: I used end-others rather than others/delete so it can't collide with /settings/sessions/:id/delete in the router or the confirm table.

test/account-sessions.test.ts checks that:

  • the list shows only the caller's browsers, with no token or token prefix on the page;
  • the confirm page wording is right;
  • a cross-origin POST returns 403 and ends nothing;
  • a same-origin POST ends the others, keeps this browser and another account's sessions, and writes one receipt;
  • a token from another account, or an unknown token, ends nothing.

Type check, gate and design lint are clean. scripts/fast.ts named 2,557 test files, too many to run here, so I ran the closest 89 instead (49 session, account, settings, route-mark and audience files, plus 40 confirm-page files): all pass. I wasn't given a keep_plan tool, so no plan was kept on the issue.

To try it: sign in on two browsers, open /settings/tokens on one, press "Sign out everywhere else" and confirm. The other browser is signed out and this one stays signed in.

🤖 Generated with Claude Code

Closes #14559

5 earlier comments · 1 event
commented

The account page now has a "Sign out everywhere else" button. It ends every web session of yours except the browser you're using, and writes a receipt to the audit log.

The session list was already on main (#14166). It shows each browser's start time, last use and coarse name ("Firefox on macOS"), marks "This browser", and never shows a token. This pull adds only the missing part.

  • Act: POST /settings/sessions/end-others goes through readForm, so a cross-origin POST is refused with 403. The button is a confirmAction link to /-/confirm, and the confirm page reads "Sign out every other browser?" before the second POST. The button only appears on your own page, and only when this browser and at least one other are signed in. The owner's page for someone else keeps its own "End all sessions".
  • Store: endOtherSessions in src/core/sessions.ts deletes the caller's session rows except the one holding the current cookie, in one transaction. It ends nothing if that cookie isn't the caller's. It only touches the session table, so app terminals and machine shells (#10609) are left alone, and session rotation is unchanged.
  • Receipt: signOutElsewhere in src/actions/signins.ts records an account.signed_out_elsewhere event with the count ended. The event is classified as the caller's own in event_audience.ts. It also sends session.ended for each ended browser, so its open streams close straight away.
  • Route mark: the route is marked open in src/http/marks/settings.json. Without that mark, every user except an admin was refused.
  • Route name: I used end-others rather than others/delete so it can't collide with /settings/sessions/:id/delete in the router or the confirm table.

test/account-sessions.test.ts checks that:

  • the list shows only the caller's browsers, with no token or token prefix on the page;
  • the confirm page wording is right;
  • a cross-origin POST returns 403 and ends nothing;
  • a same-origin POST ends the others, keeps this browser and another account's sessions, and writes one receipt;
  • a token from another account, or an unknown token, ends nothing.

Type check, gate and design lint are clean. scripts/fast.ts named 2,557 test files, too many to run here, so I ran the closest 89 instead (49 session, account, settings, route-mark and audience files, plus 40 confirm-page files): all pass. I wasn't given a keep_plan tool, so no plan was kept on the issue.

To try it: sign in on two browsers, open /settings/tokens on one, press "Sign out everywhere else" and confirm. The other browser is signed out and this one stays signed in.

🤖 Generated with Claude Code

commented

<!-- look-pages 999eed00cf4c --> Look pages for 999eed0, from the gate:

  • look pages (none): this pull changes src/web/pages/account.ts, src/web/pages/search.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
commented

The account page now signs out every browser of yours except the one you're using, in one confirmed act (#14559). The terminal can do the same.

On the web. Under Signed-in browsers on /settings/tokens, a Sign out everywhere else button appears only on your own page, and only when another browser is signed in besides this one. It leads to the confirm page (src/web/pages/search.ts). From there a same-origin POST to /settings/sessions/end-others does the following:

  • Ends every web session of yours except the current one, and the open streams of the browsers it ends.
  • Writes one account.signed_out_elsewhere event for you, saying how many browsers were signed out.
  • Leaves app terminals, machine shells and tokens alone.

A request without a browser session of its own (a token, for example) is refused, because there is no "this one" to keep.

In the terminal. The palette's Signed in screen has a new key, o, which signs out every browser after a confirm; Keep is the default. A terminal is held by its key and has no browser of its own, so every browser counts as "elsewhere" and all of them end. It goes through a new action, signOutEveryBrowser, which shares its event-writing helper with the web path. The core function behind it is endAllSessions. The screen's top line was shortened so it still fits at 140 columns.

Docs. docs/features/sign-out-elsewhere.md explains how to use both. The head commit message carries a No look: line, because /settings/tokens is not one of the pages listed in forge.json app.looks. It also carries a Direction: line, because the gate asks for one when a feature lands with no pipeline change.

Checks. bun scripts/gate.ts, bun x tsc --noEmit and bun scripts/design-lint.ts all pass. bun scripts/fast.ts named 2562 test files (about 216 minutes), so instead I ran the files that cover this change: tui-signins*, account-sessions, signins, palette-roster, account-access, confirms-language, event-audience* and the feature*/features* doc tests. All 153 tests pass. The new test in test/tui-signins.test.ts covers the following:

  • o with Keep ends nothing.
  • o with Sign out ends both of dave's browsers and none of bob's.
  • It writes exactly one account.signed_out_elsewhere event.
  • A second o reads "No browser is signed in."

To try it: sign in on two browsers, open /settings/tokens on one and press Sign out everywhere else; the other browser is signed out on its next page. Or, in the terminal, open the palette, choose Signed in and press o.

🤖 Generated with Claude Code

commented

You can now sign out of every other browser from the account page and from the terminal (#14559). This branch has been brought up to date with main.

  • Account page: /settings/tokens has a confirmed Sign out everywhere else action. It ends every web session on the account except the one making the request.
  • Terminal: on the Signed in screen, pressing o signs out every browser. A terminal has no browser of its own, so "everywhere else" there means all of them.
  • Sessions: src/core/sessions.ts adds endOtherSessions, which does nothing if the session to keep doesn't belong to the account, and endAllSessions. Both end only web sessions; app terminal and machine shell sessions are left alone.

Merge with main: src/core/sessions.ts conflicted. The resolution keeps both new functions and main's updated pruneSessions, which now also removes idle sessions, along with its doc comment.

Checks run: bun scripts/gate.ts --fix, bun x tsc --noEmit, and 29 tests across test/account-sessions, tui-signins, sessions-idle, session-reap and own-session, all passing. The gate reports one comment line over 100 columns in src/tui/screens/signins.ts; it changes nothing, and the nightly rewrap on main will fix it.

Not done: there's no way to sign out a single browser from its row; this only covers signing out all the others.

To try it: sign in on two browsers, open /settings/tokens on one and press Sign out everywhere else; the other browser is signed out on its next request. In the terminal, open Signed in and press o.

[{"go":"/settings/tokens","look":"Sign out everywhere else button","expect":"After confirming, every other browser is signed out and this one stays signed in"}]

🤖 Generated with Claude Code

Changes requested — before the latest push

The feature works and is well tested: same-origin POST via readForm, confirm page, a core function that only touches the caller's own sessions, and a TUI door with a confirm and Keep as the default. One thing to fix before it lands: the receipt is written even when nothing was ended. Two smaller points are in the line comments.

commented

The account page's Signed-in browsers list now has a confirmed Sign out everywhere else action, which ends every web session on the account except the browser asking. The terminal's Signed in screen gets the same thing on o. This push answers the review:

  • No receipt when nothing ended: signedOut in src/actions/signins.ts now writes no account.signed_out_elsewhere event, and no session.ended events, when no browser was signed out. A replayed confirm POST, or o with no browser signed in, writes nothing. test/account-sessions.test.ts checks both paths, and both checks fail without the fix. docs/features/sign-out-elsewhere.md says so too.
  • Spacing: the button sits in a .form-actions row (docs/design/areas/forms.md) instead of a <p class="mt">. bun scripts/design-lint.ts is clean.
  • Terminal wording: the o help line and the screen's help sentence now say "o signs out all browsers (this key stays)". The confirm body says every browser goes, including any you are using now, and this terminal's key stays. The file's header comment is rewrapped and says plainly that this differs from the page's button.

Disagreement on the long comment line: the gate's remaining note is about src/tui/screens/signins.ts:130. That comment came from main, not this pull. Rewrapping it trips the gate's "the diff is the change" rule, which refuses rewrapping comments a pull didn't write. So the line is left for the nightly rewrap, and the gate has no refusals. Every comment this pull wrote is within 100 columns.

Checks run: bun scripts/gate.ts --fix, bun x tsc --noEmit, and test/account-sessions.test.ts plus test/tui-signins.test.ts all pass. The full suite was not run here; the forge runs it on push.

Not done: there's no way to keep one chosen browser other than the current one.

To try it: sign in on two browsers, open /settings/tokens on one, press Sign out everywhere else and confirm; the other browser is signed out on its next request. Press it again and no second receipt is written. In the terminal, open Signed in and press o.

[{"go":"/settings/tokens","look":"Sign out everywhere else under Signed-in browsers","expect":"The button sits in a form-actions row; after confirming, every other browser is signed out and this one stays"}]

🤖 Generated with Claude Code

commented

In the terminal, the Signed in screen now lists all its keys: d signs out one browser or revokes one token, o signs out every browser after a confirm, m makes an access code and p changes your password. The web account page's browser list is unchanged. Signing out every browser writes an account.signed_out_elsewhere event, and only when at least one browser was actually signed out. The key this terminal is signed in with keeps working. The o binding and the screen's top line both say so ("this key stays").

The top line is truncated to the terminal's width. In a 140-column terminal the full line for a person ran past the edge, so "p changes your password" was cut off and test/tui-signins-password.test.ts failed. The line now says "d ends one" instead of "d signs out or revokes one", which makes it fit; the key list at the bottom of the screen still spells out what d does. No test was changed.

test/tui-signins-password.test.ts, test/tui-signins.test.ts and test/tui-signins-token.test.ts pass, and bun x tsc --noEmit is clean. The gate notes one comment line over 100 columns in src/tui/screens/signins.ts. That line is main's own wording, put back in an earlier commit so this diff stays limited to the change, and the nightly rewrap on main handles it.

To try it: open the palette in the terminal, choose Signed in, press o, and keep the default (Keep) or confirm.

🤖 Generated with Claude Code

Approved

Earlier asks are met: no receipt or session.ended events when nothing ended (tested for both doors), the button sits in a form-actions row, and the terminal wording says plainly that o ends all browsers and the key stays. The act is a same-origin POST through readForm, ends only web sessions, keeps the current one, and refuses a caller with no browser session. The token is never shown and the tests cover that. The terminal has the same door, and the how-to is in docs/features, not the README. Non-blocking: the one over-long comment line from main is left for the nightly rewrap. I could not diff against ca97ce8e067d (not in the clone), so I read the change as given.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs