mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-28 18:33:37 +00:00
fix: include dashboard children in owner filters
This commit is contained in:
@@ -1985,6 +1985,33 @@ describe("listSessionsFromStore subagent metadata", () => {
|
||||
expect(child?.parentSessionKey).toBe("agent:main:main");
|
||||
});
|
||||
|
||||
test("returns dashboard child sessions when filtering by parentSessionKey owner", () => {
|
||||
resetSubagentRegistryForTests({ persist: false });
|
||||
const now = Date.now();
|
||||
const store: Record<string, SessionEntry> = {
|
||||
"agent:main:main": {
|
||||
sessionId: "sess-main",
|
||||
updatedAt: now,
|
||||
} as SessionEntry,
|
||||
"agent:main:dashboard:child": {
|
||||
sessionId: "sess-dashboard-child",
|
||||
updatedAt: now - 1_000,
|
||||
parentSessionKey: "agent:main:main",
|
||||
} as SessionEntry,
|
||||
};
|
||||
|
||||
const result = listSessionsFromStore({
|
||||
cfg,
|
||||
storePath: "/tmp/sessions.json",
|
||||
store,
|
||||
opts: {
|
||||
spawnedBy: "agent:main:main",
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.sessions.map((session) => session.key)).toEqual(["agent:main:dashboard:child"]);
|
||||
});
|
||||
|
||||
test("falls back to persisted subagent timing after run archival", () => {
|
||||
const now = Date.now();
|
||||
const store: Record<string, SessionEntry> = {
|
||||
|
||||
@@ -1314,7 +1314,7 @@ export function listSessionsFromStore(params: {
|
||||
latest.controllerSessionKey?.trim() || latest.requesterSessionKey?.trim();
|
||||
return latestControllerSessionKey === spawnedBy;
|
||||
}
|
||||
return entry?.spawnedBy === spawnedBy;
|
||||
return entry?.spawnedBy === spawnedBy || entry?.parentSessionKey === spawnedBy;
|
||||
})
|
||||
.filter(([, entry]) => {
|
||||
if (!label) {
|
||||
|
||||
Reference in New Issue
Block a user