fix(regression): preserve transcript session ownership metadata

This commit is contained in:
Tak Hoffman
2026-03-27 20:43:56 -05:00
parent 9a57bdfdf1
commit a265c59418
2 changed files with 20 additions and 0 deletions

View File

@@ -949,6 +949,11 @@ export async function startGatewayServer(
chatType: sessionRow.chatType,
origin: sessionRow.origin,
spawnedBy: sessionRow.spawnedBy,
spawnedWorkspaceDir: sessionRow.spawnedWorkspaceDir,
forkedFromParent: sessionRow.forkedFromParent,
spawnDepth: sessionRow.spawnDepth,
subagentRole: sessionRow.subagentRole,
subagentControlScope: sessionRow.subagentControlScope,
label: sessionRow.label,
displayName: sessionRow.displayName,
deliveryContext: sessionRow.deliveryContext,

View File

@@ -310,6 +310,11 @@ describe("session.message websocket events", () => {
sessionFile: transcriptPath,
updatedAt: Date.now(),
spawnedBy: "agent:main:main",
spawnedWorkspaceDir: "/tmp/subagent-workspace",
forkedFromParent: true,
spawnDepth: 2,
subagentRole: "orchestrator",
subagentControlScope: "children",
parentSessionKey: "agent:main:main",
},
},
@@ -369,12 +374,22 @@ describe("session.message websocket events", () => {
expect(messageEvent.payload).toMatchObject({
sessionKey: "agent:main:child",
spawnedBy: "agent:main:main",
spawnedWorkspaceDir: "/tmp/subagent-workspace",
forkedFromParent: true,
spawnDepth: 2,
subagentRole: "orchestrator",
subagentControlScope: "children",
parentSessionKey: "agent:main:main",
});
expect(changedEvent.payload).toMatchObject({
sessionKey: "agent:main:child",
phase: "message",
spawnedBy: "agent:main:main",
spawnedWorkspaceDir: "/tmp/subagent-workspace",
forkedFromParent: true,
spawnDepth: 2,
subagentRole: "orchestrator",
subagentControlScope: "children",
parentSessionKey: "agent:main:main",
});
} finally {