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(main): refuse a browser ownership claim with no owning project
Claude Codeb7d0be5e129c
diff --git a/src/main/browser-control-ledger.test.ts b/src/main/browser-control-ledger.test.tsindex 2d5619e73..e0adf17d1 100644--- a/src/main/browser-control-ledger.test.ts+++ b/src/main/browser-control-ledger.test.ts@@ -48,6 +48,15 @@ describe('BrowserControlLedger', () => {expect(l.get('browser-3', '')).toBe(null)})+ it('claim refuses a blank projectId — a project-less entry is meaningless and would poison releaseByProject(\'\')', () => {+ // Belt to main's wiring guard: if a future open-browser reply ever drops the project id, no+ // ownership is recorded rather than an entry that releaseByProject('') would sweep.+ const l = new BrowserControlLedger()+ expect(l.claim('browser-3', entry({ projectId: '' }))).toBe(false)+ expect(l.get('browser-3', 'claude-1')).toBe(null)+ expect(l.releaseByProject('')).toEqual([])+ })+it('release drops ownership — a released id is undrivable and re-claimable', () => {const l = new BrowserControlLedger()l.claim('browser-3', entry({ ownerNodeId: 'claude-1' }))diff --git a/src/main/browser-control-ledger.ts b/src/main/browser-control-ledger.tsindex 223655657..c82e5e887 100644--- a/src/main/browser-control-ledger.ts+++ b/src/main/browser-control-ledger.ts@@ -48,10 +48,12 @@ export class BrowserControlLedger {* Record ownership of a freshly opened browser node. Returns false — and changes NOTHING — if the* id is already claimed: there is NO handoff, claim or transfer (S8's `claimUserTab` is dropped),* so a live browser node's owner never changes and the user's own browsing never becomes an- * agent's. A blank `browserNodeId` or `ownerNodeId` is refused (there is no anonymous owner).+ * agent's. A blank `browserNodeId`, `ownerNodeId` or `projectId` is refused: there is no anonymous+ * owner, and a project-less entry is meaningless (it would also make `releaseByProject('')` match+ * it) — the belt to main's wiring guard against a future reply-shape that drops the project id.*/claim(browserNodeId: string, e: AgentBrowserEntry): boolean {- if (!browserNodeId || !e.ownerNodeId) return false+ if (!browserNodeId || !e.ownerNodeId || !e.projectId) return falseif (this.entries.has(browserNodeId)) return falsethis.entries.set(browserNodeId, { ...e })return truediff --git a/src/main/index.ts b/src/main/index.tsindex 3c71f55de..69c6c8635 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -2360,10 +2360,14 @@ app.whenReady().then(async () => {// browser-ownership-source.test.ts (ownership is NEVER read from Project.ropes).if (verb === 'open-browser' && verified && result.ok) {const opened = result.result as { id?: string; projectId?: string; partition?: string } | undefined- if (opened?.id && opened.partition) {+ // Refuse to record an entry with no owning project: `releaseByProject('')` would match it, and+ // a project-less ownership record is meaningless. Fail-closed against future reply-shape drift+ // — today `partition` is present only when agentBrowserPartition(projectId) succeeded, so a+ // non-empty safe projectId always rides with it.+ if (opened?.id && opened.partition && opened.projectId) {browserLedger.claim(opened.id, {ownerNodeId: nodeId,- projectId: opened.projectId ?? '',+ projectId: opened.projectId,partition: opened.partition,navGeneration: 0,leaseActiveUntil: 0,