The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a watch window's canonical resume asks for the transcript, not `lazy`
Tekniumf9b3d3360f8b
diff --git a/apps/desktop/src/api/canonical-protocol.ts b/apps/desktop/src/api/canonical-protocol.tsindex d1d7ee9ded7..8ae9ce7f7e3 100644--- a/apps/desktop/src/api/canonical-protocol.ts+++ b/apps/desktop/src/api/canonical-protocol.ts@@ -286,6 +286,14 @@ export class CanonicalDesktopProtocol {return { session_id: params.session_id, source: 'desktop', ...(params.profile ? { profile: params.profile } : {}) }}+ // N93: a watch window's legacy `lazy` attach is not in the owner's resume contract (the owner+ // holds the agent; nothing to defer). It skipped the REST prefetch, so it takes the transcript.+ if (method === 'session.resume' && 'lazy' in params) {+ const { lazy: _lazy, ...resume } = params++ return { ...resume, omit_messages: false }+ }+if (method === 'session.interrupt' || method === 'session.redirect' || method === 'session.steer') {const generation = params.execution_generation ?? this.generations.get(canonicalSessionKey(params.session_id, params.profile))diff --git a/apps/desktop/src/api/canonical-watch-window-resume.test.ts b/apps/desktop/src/api/canonical-watch-window-resume.test.tsnew file mode 100644index 00000000000..9f6bbc2be9b--- /dev/null+++ b/apps/desktop/src/api/canonical-watch-window-resume.test.ts@@ -0,0 +1,27 @@+// @vitest-environment node+import { readFileSync } from 'node:fs'+import { join } from 'node:path'++import { expect, test } from 'vitest'++import { primaryResumeParams } from '@/app/session/hooks/use-session-actions/resume-owner'++import { CanonicalDesktopProtocol } from './canonical-protocol'++// N93: every Desktop resume frame (watch window included) carries only keys the owner's generated+// resume contract admits; a watch window, which skips the REST prefetch, asks for the transcript.+const doc = JSON.parse(readFileSync(join(process.cwd(), '..', 'shared', 'src', 'gateway-contract.openrpc.json'), 'utf8'))+const resumeRef = doc['x-canonical-methods'].find((m: { name: string }) => m.name === 'session.resume').params[0].schema.$ref+const RESUME_KEYS = new Set(Object.keys(doc.components.schemas[resumeRef.split('/').at(-1)].properties))++test.each([+ ['watch window', true, undefined],+ ['cold resume', false, undefined],+ ['authoritative snapshot', false, true]+] as const)('%s: the canonical resume frame fits the owner contract', (_label, watchWindow, snapshot) => {+ const frame = new CanonicalDesktopProtocol().prepare('session.resume', primaryResumeParams('s', watchWindow, snapshot, 'work'))+ expect(Object.keys(frame).filter(key => !RESUME_KEYS.has(key))).toEqual([])+ expect(frame).toMatchObject({ session_id: 's', profile: 'work' })++ if (watchWindow) { expect(frame).toMatchObject({ omit_messages: false, defer_history: false }) }+})