Skip to content

Commit ebc70fa

Browse files
authored
fix(usage): retain explicit owner for global sessions (#129011)
Co-authored-by: roboclaw-bot <[email protected]>
1 parent b454497 commit ebc70fa

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎src/gateway/server-methods/usage.sessions-usage.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,12 +583,13 @@ describe("sessions.usage", () => {
583583
});
584584
});
585585

586-
it("keeps global session entries in requested-agent usage lookups", async () => {
586+
it("keeps legacy global session entries in explicitly scoped agent usage lookups", async () => {
587587
const config: OpenClawConfig = {
588588
agents: {
589-
list: [{ id: "main", default: true }, { id: "opus" }],
589+
ownership: "explicit",
590+
list: [{ id: "main" }, { id: "opus" }],
590591
},
591-
session: { scope: "global" },
592+
session: {},
592593
};
593594

594595
await withUsageState(async (writeSessionFile) => {

‎src/gateway/server-methods/usage.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ function filterSessionStoreByAgent(params: {
733733
const scopedAgentId = normalizeAgentId(params.agentId);
734734
const scopedStore: Record<string, SessionEntry> = {};
735735
for (const [key, entry] of Object.entries(params.store)) {
736-
if (params.config.session?.scope === "global" && key.trim().toLowerCase() === "global") {
736+
if (key.trim().toLowerCase() === "global") {
737737
scopedStore[key] = entry;
738738
continue;
739739
}

0 commit comments

Comments
 (0)