Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Let Change agent read resumed Claude sessions (#1473)

0xken15a435614ba18b
diff --git a/cli/src/engines/claude/sessionStore.ts b/cli/src/engines/claude/sessionStore.ts
index b2d6dbca3..cf3c8fe4c 100644
--- a/cli/src/engines/claude/sessionStore.ts
+++ b/cli/src/engines/claude/sessionStore.ts
@@ -46,7 +46,10 @@ export const sessionStore: SessionStoreContract = {
},
}
-/** Control reads the first identity-bearing opening, after Claude's bookkeeping. */
+/** Control reads the first identity-bearing opening, after Claude's bookkeeping. The byte limit is the bound:
+ * a resumed Claude Code 2.1.30x session opens with its title, name and modes and then one
+ * `file-history-snapshot` per earlier checkpoint, and two live transcripts measured on 2026-10-21 named their
+ * first `cwd` at records 48 and 60. A 20-record limit held them, and Change agent waited on them forever. */
export const controlIdentity = {
- maxBytes: 1024 * 1024, maxRecords: 20, id: ['sessionId'], cwd: ['cwd'], sidechain: 'isSidechain',
+ maxBytes: 1024 * 1024, maxRecords: 10_000, id: ['sessionId'], cwd: ['cwd'], sidechain: 'isSidechain',
} as const satisfies import('../kit/controlIdentity.js').ControlIdentityRule
diff --git a/cli/src/engines/kit/controlIdentity.spec.ts b/cli/src/engines/kit/controlIdentity.spec.ts
index b5fc855be..78c43e86f 100644
--- a/cli/src/engines/kit/controlIdentity.spec.ts
+++ b/cli/src/engines/kit/controlIdentity.spec.ts
@@ -20,10 +20,16 @@ it('reads identity after bookkeeping and ignores sidechain body records after th
expect(controlIdentity(Buffer.from(line({ ...opening, isSidechain: true })), claude).delegated).toBe(true)
})
+it('reads identity after a resumed session\'s long run of bookkeeping', () => {
+ const prefix = line({ type: 'ai-title', sessionId: opening.sessionId }) + line({ type: 'file-history-snapshot' }).repeat(60)
+ expect(controlIdentity(Buffer.from(prefix + line(opening)), claude)).toEqual({ id: opening.sessionId, cwd: opening.cwd,
+ delegated: false, bytes: Buffer.byteLength(prefix + line(opening)) })
+})
+
it.each([
'', '{partial', line(null), line([]), line({ ...opening, sessionId: 8 }), line({ ...opening, sessionId: '' }),
line({ ...opening, cwd: 'relative' }), line({ ...opening, cwd: 9 }), line({ ...opening, isSidechain: 'false' }),
- line({ type: 'bookkeeping' }).repeat(20) + line(opening),
+ line({ type: 'bookkeeping', padding: 'x'.repeat(1000) }).repeat(1100) + line(opening),
line({ sessionId: 'first' }) + line(opening), line({ cwd: '/other' }) + line(opening),
line({ sessionId: 'native-conversation', isSidechain: false }) + line({ cwd: '/fixture/work', isSidechain: true }),
line({ sessionId: 'native-conversation', isSidechain: false }) + line({ cwd: '/fixture/work', isSidechain: 'false' }),