mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 21:07:01 -06:00
fix(ui): hide system agent from agent roster (#111677)
This commit is contained in:
committed by
GitHub
parent
a22ede72e4
commit
71513436f9
@@ -1,11 +1,28 @@
|
||||
/**
|
||||
* Gateway agent-list RPC regression tests.
|
||||
*/
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { withStateDirEnv } from "../test-helpers/state-dir-env.js";
|
||||
import { listGatewayAgentsBasic } from "./agent-list.js";
|
||||
|
||||
describe("listGatewayAgentsBasic", () => {
|
||||
it("omits reserved system-agent state directories from the discovered roster", async () => {
|
||||
await withStateDirEnv("openclaw-agent-list-", async ({ stateDir }) => {
|
||||
await Promise.all(
|
||||
["openclaw", "crestodian", "research"].map((id) =>
|
||||
fs.mkdir(path.join(stateDir, "agents", id), { recursive: true }),
|
||||
),
|
||||
);
|
||||
|
||||
const result = listGatewayAgentsBasic({});
|
||||
|
||||
expect(result.agents.map((agent) => agent.id)).toEqual(["main", "research"]);
|
||||
});
|
||||
});
|
||||
|
||||
it("falls back to identity.name when the configured agent name is missing", () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
session: { mainKey: "main" },
|
||||
|
||||
@@ -8,6 +8,7 @@ import { resolveStateDir } from "../config/paths.js";
|
||||
import type { SessionScope } from "../config/sessions.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { normalizeAgentId, normalizeMainKey } from "../routing/session-key.js";
|
||||
import { isReservedSystemAgentId } from "../system-agent/agent-id.js";
|
||||
|
||||
type GatewayAgentListRow = {
|
||||
id: string;
|
||||
@@ -22,7 +23,7 @@ function listExistingAgentIdsFromDisk(): string[] {
|
||||
return entries
|
||||
.filter((entry) => entry.isDirectory())
|
||||
.map((entry) => normalizeAgentId(entry.name))
|
||||
.filter(Boolean);
|
||||
.filter((id) => id && !isReservedSystemAgentId(id));
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user