mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 10:50:58 +00:00
fix: preserve reset spawn depth
This commit is contained in:
@@ -1013,6 +1013,7 @@ describe("gateway server sessions", () => {
|
||||
updatedAt: Date.now(),
|
||||
spawnedBy: "agent:main:main",
|
||||
parentSessionKey: "agent:main:main",
|
||||
spawnDepth: 2,
|
||||
label: "owned child",
|
||||
},
|
||||
},
|
||||
@@ -1022,20 +1023,22 @@ describe("gateway server sessions", () => {
|
||||
const reset = await rpcReq<{
|
||||
ok: true;
|
||||
key: string;
|
||||
entry: { spawnedBy?: string; parentSessionKey?: string; label?: string };
|
||||
entry: { spawnedBy?: string; parentSessionKey?: string; spawnDepth?: number; label?: string };
|
||||
}>(ws, "sessions.reset", { key: "subagent:child" });
|
||||
|
||||
expect(reset.ok).toBe(true);
|
||||
expect(reset.payload?.entry.spawnedBy).toBe("agent:main:main");
|
||||
expect(reset.payload?.entry.parentSessionKey).toBe("agent:main:main");
|
||||
expect(reset.payload?.entry.spawnDepth).toBe(2);
|
||||
expect(reset.payload?.entry.label).toBe("owned child");
|
||||
|
||||
const store = JSON.parse(await fs.readFile(storePath, "utf-8")) as Record<
|
||||
string,
|
||||
{ spawnedBy?: string; parentSessionKey?: string; label?: string }
|
||||
{ spawnedBy?: string; parentSessionKey?: string; spawnDepth?: number; label?: string }
|
||||
>;
|
||||
expect(store["agent:main:subagent:child"]?.spawnedBy).toBe("agent:main:main");
|
||||
expect(store["agent:main:subagent:child"]?.parentSessionKey).toBe("agent:main:main");
|
||||
expect(store["agent:main:subagent:child"]?.spawnDepth).toBe(2);
|
||||
expect(store["agent:main:subagent:child"]?.label).toBe("owned child");
|
||||
|
||||
ws.close();
|
||||
|
||||
@@ -322,6 +322,7 @@ export async function performGatewaySessionReset(params: {
|
||||
sendPolicy: currentEntry?.sendPolicy,
|
||||
spawnedBy: currentEntry?.spawnedBy,
|
||||
parentSessionKey: currentEntry?.parentSessionKey,
|
||||
spawnDepth: currentEntry?.spawnDepth,
|
||||
label: currentEntry?.label,
|
||||
origin: snapshotSessionOrigin(currentEntry),
|
||||
lastChannel: currentEntry?.lastChannel,
|
||||
|
||||
Reference in New Issue
Block a user