mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
fix(ui): retain scoped global session metadata
This commit is contained in:
@@ -78,10 +78,19 @@ export function selectedChatSessionRow(state: ChatPageHost) {
|
||||
return row;
|
||||
}
|
||||
const selectedAgentId = resolveUiSelectedGlobalAgentId(state);
|
||||
const mismatchedOwner = [state.sessionsResultAgentId, row.observerDigest?.agentId].some(
|
||||
(agentId) => agentId && normalizeAgentId(agentId) !== selectedAgentId,
|
||||
);
|
||||
return mismatchedOwner ? undefined : row;
|
||||
if (
|
||||
state.sessionsResultAgentId &&
|
||||
normalizeAgentId(state.sessionsResultAgentId) !== selectedAgentId
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
if (
|
||||
row.observerDigest?.agentId &&
|
||||
normalizeAgentId(row.observerDigest.agentId) !== selectedAgentId
|
||||
) {
|
||||
return { ...row, observerDigest: undefined };
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
function saveChatQueueForSession(state: ChatPageHost, sessionKey: string) {
|
||||
|
||||
@@ -239,6 +239,15 @@ describe("ChatStateController render lifecycle", () => {
|
||||
expect(state.observerDigest?.headline).toBe("Reconnected live status");
|
||||
expect(requestUpdate).toHaveBeenCalledOnce();
|
||||
|
||||
const projectedRow = state.sessionsResult?.sessions[0];
|
||||
if (projectedRow?.observerDigest) {
|
||||
projectedRow.observerDigest.agentId = "main";
|
||||
}
|
||||
const sanitized = selectedChatSessionRow(state);
|
||||
expect(sanitized?.key).toBe("global");
|
||||
expect(sanitized?.activeRunIds).toEqual(["run-work"]);
|
||||
expect(sanitized?.observerDigest).toBeUndefined();
|
||||
|
||||
state.sessionsResultAgentId = "main";
|
||||
expect(selectedChatSessionRow(state)).toBeUndefined();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user