Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(pairing): make the revoke copy true, and say when the phone loses Pro
enesaf26f19f052c
diff --git a/src/renderer/components/settings/sections/PhoneSection.revoke.test.tsx b/src/renderer/components/settings/sections/PhoneSection.revoke.test.tsxindex da9b53336..ccc8c9df7 100644--- a/src/renderer/components/settings/sections/PhoneSection.revoke.test.tsx+++ b/src/renderer/components/settings/sections/PhoneSection.revoke.test.tsx@@ -1,9 +1,15 @@// @vitest-environment jsdom//-// Settings → Phone, the Revoke button: which of the three revoke outcomes the user is TOLD about.-// The rule is asymmetric on purpose — 'skipped' is a normal state (a free-tier desktop holds no-// entitlement to revoke with, and a phone paired before we recorded its relay id has no row we can-// name), so warning there would tell a free user their phone's Pro is stuck when it never had any.+// Settings → Phone, the Revoke button: which of the three revoke outcomes the user is TOLD about,+// and in which voice.+// 'skipped' → nothing. It is a normal state: a free-tier desktop holds no entitlement to revoke+// with, or there was no device left to name. Warning there would tell a free user+// their phone's Pro is stuck when it never had any of ours. (A phone paired before+// we recorded its relay id is NOT this case — the revoke falls back to our own+// pairing id and the server leg does run.)+// 'ok' → a receipt, not silence: the phone keeps the pass it already holds for up to 7+// days, and users who were told nothing filed that as "removal didn't work".+// 'failed' → a warning that does not prescribe waiting, because a 403 never clears by waiting.// Only a leg that actually failed may warn, and a failed one always must.import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'import { act } from 'react'@@ -102,16 +108,22 @@ describe('PhoneSection revoke feedback', () => {expect(revokeDevice).toHaveBeenCalledWith('dev-a')expect(text).not.toMatch(/Pro access/i)expect(text).not.toMatch(/try again/i)+ // Nor the 7-day receipt: there was no Pro of ours on that phone, so there is nothing that+ // ends in 7 days. An implementation that prints the receipt for every non-failure passes the+ // two assertions above.+ expect(text).not.toMatch(/7 days/i)})- it('says nothing on a clean revoke', async () => {+ it('says WHEN the phone actually loses Pro on a clean revoke — removal is not instant', async () => {stubBridge({ local: true, server: 'ok' })mount()await act(async () => undefined)const text = await revokeFlow()- expect(text).not.toMatch(/Pro access/i)+ expect(text).toMatch(/within 7 days/i)+ // A receipt, not a warning: nothing here asks the user to do anything.expect(text).not.toMatch(/try again/i)+ expect(text).not.toMatch(/Couldn’t/i)})it('warns that the phone kept its Pro when the server leg failed', async () => {@@ -121,7 +133,12 @@ describe('PhoneSection revoke feedback', () => {const text = await revokeFlow()expect(text).toMatch(/Pro access/i)- expect(text).toMatch(/try again/i)+ // 'failed' also covers a 403 ("not your row") and a 401, which no amount of waiting fixes —+ // so the copy must not promise that being back online is the fix.+ expect(text).not.toMatch(/back online/i)+ // And the retry it does offer must disclose its cost: pairing the phone again RESTORES its Pro.+ expect(text).toMatch(/pairing restores its Pro/i)+ expect(text).toMatch(/get in touch/i)})it('warns about the local removal when that is the leg that failed', async () => {diff --git a/src/renderer/components/settings/sections/PhoneSection.tsx b/src/renderer/components/settings/sections/PhoneSection.tsxindex 634d98e5b..62429db79 100644--- a/src/renderer/components/settings/sections/PhoneSection.tsx+++ b/src/renderer/components/settings/sections/PhoneSection.tsx@@ -41,7 +41,10 @@ const isMac = /Mac/i.test(navigator.platform || navigator.userAgent)export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Element {const [devices, setDevices] = useState<PairedDevice[]>([])const [pendingRevoke, setPendingRevoke] = useState<PairedDevice | null>(null)- const [revokeNote, setRevokeNote] = useState('')+ // What the last revoke has to say, and whether it is a WARNING or a receipt. A successful+ // removal owes the user a sentence too (the phone keeps Pro for a few days), and printing that+ // in the warning colour would read as a failure.+ const [revokeNote, setRevokeNote] = useState<{ text: string; warn: boolean } | null>(null)const phoneAccessEnabled = useSettings((s) => s.settings.phoneAccessEnabled)const updateSettings = useSettings((s) => s.update)@@ -55,9 +58,13 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele}, [])// The shared pairing machine (also behind the top-right quick-pair popover); a completed- // pairing refreshes the device list below.+ // pairing refreshes the device list below — and drops the last revoke note, which names a device+ // by name and would otherwise outlive the very phone it warns about being re-paired.const { phase, qr, sshOpen, sshHealed, relayResult, relayPlan, error, busy, start, stop, reset } = usePhonePairing(- () => void refreshDevices()+ () => {+ setRevokeNote(null)+ void refreshDevices()+ })const togglePhoneAccess = (next: boolean): void => {@@ -78,12 +85,21 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele// Removing local access and taking the phone's Pro back are DIFFERENT facts, and the second one// used to be missing entirely — Remove unpinned the key here while the server kept minting Pro- // for that phone forever. So both legs are surfaced, and only a leg that actually FAILED warns:- // 'skipped' means we had nothing to revoke (a free-tier desktop, or a device paired before we- // recorded the phone's relay id), and warning there would tell a free user their phone is stuck.+ // for that phone forever. So both legs are surfaced:+ // - 'skipped' says nothing. It means we had nothing of ours to revoke — a free-tier desktop+ // holds no entitlement to sign the request with, or the device was already gone from the+ // registry — and warning there would tell a free user their phone's Pro is stuck when it+ // never had any of ours. (A device paired before we recorded the phone's relay id does NOT+ // land here: it falls back to our own pairing id, which is the row's key in that case, so the+ // server leg really does run — see `revokeDevice` in main/pairing-service.ts.)+ // - 'ok' still owes a sentence: the phone keeps the entitlement it already holds until that+ // expires, so Pro does not stop the instant the row goes. Saying nothing produced exactly the+ // support mail this branch exists to end ("I removed it and it still has Pro").+ // - 'failed' warns — and does not prescribe waiting. It collapses a 403 (not our row), a 401,+ // a 5xx and an unreachable server, and only the last of those clears by itself.const revokeDevice = async (device: PairedDevice): Promise<void> => {setPendingRevoke(null)- setRevokeNote('')+ setRevokeNote(null)try {const result = await window.nodeTerminal.pairing.revokeDevice(device.id)// Additive, not exclusive: both legs can fail at once (an unwritable ~/.ssh while offline),@@ -93,20 +109,30 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Elenotes.push(`Couldn’t remove “${device.name}” from this machine — try again.`)}if (result.server === 'failed') {- // Not a bare "try again": on a successful local removal the row is already gone from the- // list, so there is no button left to press. Name the one thing that does re-run the- // server leg — the phone sends the same stable device id every time it pairs, and the- // backend upserts the row on that id, so pairing again makes the next Revoke land.+ // Deliberately not "pair it and remove it again": that used to be the whole advice, and it+ // is wrong twice over — a 403 will never clear however long you wait, and pairing RESTORES+ // the phone's Pro (the mint upserts its row) before the second removal tries again. It is+ // offered as what it is — a retry that costs something — with support as the reliable path.notes.push((result.local ? `Removed “${device.name}” from this machine, but its` : 'Its') +- ' Pro access couldn’t be revoked, so that phone may keep Pro. Once this machine is' +- ' back online, pair it and remove it again to try again.'+ ' Pro access couldn’t be revoked — we were refused or couldn’t reach the server — so' ++ ' that phone may keep Pro. Pairing it again and removing it retries the revoke, though' ++ ' pairing restores its Pro in the meantime. Get in touch if it keeps failing.')}- setRevokeNote(notes.join(' '))+ if (notes.length) {+ setRevokeNote({ text: notes.join(' '), warn: true })+ } else if (result.server === 'ok') {+ // Not instant, and we say so. The phone holds a signed entitlement minted for up to seven+ // days; revoking the row stops the NEXT one, it cannot reach into the phone.+ setRevokeNote({+ text: `Removed “${device.name}”. Its Pro ends when the pass it already holds expires — within 7 days.`,+ warn: false+ })+ }} catch {// The call itself never got an answer (main is gone, or the surface doesn't support it).- setRevokeNote(`Couldn’t remove “${device.name}” — try again.`)+ setRevokeNote({ text: `Couldn’t remove “${device.name}” — try again.`, warn: true })} finally {void refreshDevices()}@@ -289,8 +315,11 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele</ul>)}{revokeNote ? (- <p className="text-sm" style={{ color: '#ff9f0a' }}>- {revokeNote}+ <p+ className={revokeNote.warn ? 'text-sm' : 'text-sm text-muted'}+ style={revokeNote.warn ? { color: '#ff9f0a' } : undefined}+ >+ {revokeNote.text}</p>) : null}</div>@@ -298,7 +327,10 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele{pendingRevoke ? (<ConfirmDialog- message={`Revoke “${pendingRevoke.name}”? Its key is removed from this machine and it will no longer be able to connect.`}+ // Both legs, and the timing of the one that is not instant. "If" rather than a flat+ // claim: a free-tier desktop has no Pro of ours on that phone to take back, and this+ // dialog cannot tell — the server leg reports that only after the fact ('skipped').+ message={`Revoke “${pendingRevoke.name}”? Its key is removed from this machine and it will no longer be able to connect. If its Pro comes from this Mac’s license, that is revoked too — the phone loses Pro within 7 days.`}confirmLabel="Revoke"onConfirm={() => void revokeDevice(pendingRevoke)}onCancel={() => setPendingRevoke(null)}diff --git a/src/shared/types.ts b/src/shared/types.tsindex 49a96249f..8c3aa27ae 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -2307,8 +2307,11 @@ export interface PairedDevice {lastSeenAt: number/*** The phone's OWN device id — what the relay backend keys its device row on, as opposed to- * `id`, which is ours. Absent for devices paired before this field existed, i.e. "there is no- * server row we can name". An id, not a secret, which is why it may cross to the renderer.+ * `id`, which is ours. Absent for devices paired before this field existed; that is NOT "there+ * is no server row we can name", because a revoke then falls back to `id`, which is the value+ * the mint sent as the row's key whenever the phone supplied no id of its own (see+ * `revokeDevice` in main/pairing-service.ts, including the residual case it cannot name). An id,+ * not a secret, which is why it may cross to the renderer.*/relayDeviceId?: string}