mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 15:08:25 +00:00
fix(tui): normalize session key to lowercase to match gateway canonicalization (#34013)
Merged via squash.
Prepared head SHA: cfe06ca131
Co-authored-by: lynnzc <6257996+lynnzc@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
@@ -74,6 +74,27 @@ describe("resolveTuiSessionKey", () => {
|
||||
}),
|
||||
).toBe("agent:ops:incident");
|
||||
});
|
||||
|
||||
it("lowercases session keys with uppercase characters", () => {
|
||||
// Uppercase in agent-prefixed form
|
||||
expect(
|
||||
resolveTuiSessionKey({
|
||||
raw: "agent:main:Test1",
|
||||
sessionScope: "global",
|
||||
currentAgentId: "main",
|
||||
sessionMainKey: "agent:main:main",
|
||||
}),
|
||||
).toBe("agent:main:test1");
|
||||
// Uppercase in bare form (prefixed by currentAgentId)
|
||||
expect(
|
||||
resolveTuiSessionKey({
|
||||
raw: "Test1",
|
||||
sessionScope: "global",
|
||||
currentAgentId: "main",
|
||||
sessionMainKey: "agent:main:main",
|
||||
}),
|
||||
).toBe("agent:main:test1");
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveGatewayDisconnectState", () => {
|
||||
|
||||
@@ -203,9 +203,9 @@ export function resolveTuiSessionKey(params: {
|
||||
return trimmed;
|
||||
}
|
||||
if (trimmed.startsWith("agent:")) {
|
||||
return trimmed;
|
||||
return trimmed.toLowerCase();
|
||||
}
|
||||
return `agent:${params.currentAgentId}:${trimmed}`;
|
||||
return `agent:${params.currentAgentId}:${trimmed.toLowerCase()}`;
|
||||
}
|
||||
|
||||
export function resolveGatewayDisconnectState(reason?: string): {
|
||||
|
||||
Reference in New Issue
Block a user