Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): bump owner generation on same-owner projection repair
Yuewei-LLefa1fce9b948
diff --git a/apps/desktop/src/main/appSessionState.ts b/apps/desktop/src/main/appSessionState.tsindex fba955fead..33a35ca3c4 100644--- a/apps/desktop/src/main/appSessionState.ts+++ b/apps/desktop/src/main/appSessionState.ts@@ -160,6 +160,7 @@ export function isAppSessionBoundaryLocallyPending(): boolean {export function commitActiveAppSession(mode: AppSessionMode,cloudOwnerId?: string | null,+ forceBumpGeneration = false,): ActiveAppSession {const previous = ensureLoaded();let dataOwnerId: string | null = null;@@ -171,7 +172,11 @@ export function commitActiveAppSession(dataOwnerId = normalized;}- if (previous.mode === mode && previous.dataOwnerId === dataOwnerId) {+ if (+ previous.mode === mode+ && previous.dataOwnerId === dataOwnerId+ && !forceBumpGeneration+ ) {return { ...previous };}diff --git a/apps/desktop/src/main/authManager.ts b/apps/desktop/src/main/authManager.tsindex 1997c5a0c1..f1d4c59864 100644--- a/apps/desktop/src/main/authManager.ts+++ b/apps/desktop/src/main/authManager.ts@@ -817,6 +817,12 @@ async function withCloudOwnerCommit<T>(opts: {return withGhostSkillProjectionReadOnlyOwner(opts.nextOwnerId, opts.commit);}let releaseBoundary: (() => void) | null = null;+ // A same-owner projection repair tears down the owner-bound Ghost runtime but+ // keeps the same mode/owner, so commitActiveAppSession's same-owner early+ // return would NOT advance the owner generation — stale async work that+ // captured the pre-repair scope key would then pass the post-release guard.+ // Force a generation bump so the scope key changes across the teardown.+ let forceBumpGeneration = false;try {return await withGhostSkillProjectionOwnerCommit({previousOwnerId: opts.previousOwnerId,@@ -830,11 +836,21 @@ async function withCloudOwnerCommit<T>(opts: {if (!projectionRepairTeardown) {throw new Error('Ghost projection repair requires a teardown hook');}+ forceBumpGeneration = true;await projectionRepairTeardown('same-owner-projection-recovery');}},prepareCommit: opts.prepareCommit,- commit: opts.commit,+ commit: async () => {+ const result = await opts.commit();+ // Same-owner repair: advance the owner generation after the real commit+ // so activeOwnerScopeKey() changes and stale captured scopes are rejected.+ if (forceBumpGeneration) {+ const session = getActiveAppSession();+ commitActiveAppSession(session.mode, session.dataOwnerId ?? undefined, true);+ }+ return result;+ },});} finally {const release = releaseBoundary as (() => void) | null;diff --git a/docs/dev-rules/plugin-approval-main-merge-2026-08-10.md b/docs/dev-rules/plugin-approval-main-merge-2026-08-10.mdindex 03585c472f..5c734de646 100644--- a/docs/dev-rules/plugin-approval-main-merge-2026-08-10.md+++ b/docs/dev-rules/plugin-approval-main-merge-2026-08-10.md@@ -153,6 +153,21 @@ This round fixed two Linux CI failures plus one Codex review P1:surface. The affected suites (runnerModelSelection, model-route-guard-live,orcaProviderRoutingSnapshotWiring) pass.+## Codex P1: same-owner projection repair must bump the owner generation++`withCloudOwnerCommit`'s same-owner repair branch (durable Ghost projection+missing/quarantined while the app session is already committed to the same+owner) tears down the owner-bound Ghost runtime but keeps the same mode/owner,+so `commitActiveAppSession` early-returned without advancing the owner+generation. Async work that captured the pre-repair `activeOwnerScopeKey()`+would then pass the stale-scope guard after the boundary was released.++Fix: `commitActiveAppSession` gains an optional `forceBumpGeneration` flag that+also advances generation on the same-owner early-return path; `withCloudOwnerCommit`+sets it when it runs a same-owner projection repair and re-commits with the flag+after the real commit. This makes `activeOwnerScopeKey()` change across the+teardown so stale captured scopes are rejected.+## Post-merge gateAfter all conflicts are resolved: inspect the complete diff, verify no unmerged