fix(persistence): preserve subagent session origin

This commit is contained in:
imccyu
2026-08-01 09:41:52 +08:00
committed by Tianyi Cui
parent 9d77a50c23
commit d950150cdc
30 changed files with 53 additions and 36 deletions

View File

@@ -325,14 +325,15 @@ export class SessionPersistenceSqlite extends SessionPersistence implements Pers
private writeRow(meta: SessionHeader): void {
this.db.prepare(`
INSERT INTO sessions
(id, version, created_at, cwd, parent_session, seed_length, delegation_depth, incarnation, revision)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0)
(id, version, created_at, cwd, parent_session, seed_length, origin, delegation_depth, incarnation, revision)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 0)
ON CONFLICT(id) DO UPDATE SET
version = excluded.version,
created_at = excluded.created_at,
cwd = excluded.cwd,
parent_session = excluded.parent_session,
seed_length = excluded.seed_length,
origin = excluded.origin,
delegation_depth = excluded.delegation_depth
`).run(
meta.id,
@@ -341,6 +342,7 @@ export class SessionPersistenceSqlite extends SessionPersistence implements Pers
meta.cwd ?? null,
meta.parentSession ?? null,
meta.seedLength ?? null,
meta.origin ?? null,
meta.delegationDepth ?? null,
randomUUID(),
)