Skip to content

The open-source app everyone uses to manage agents at work

Fix CI typecheck and default OpenClaw sessions to issue scope

Dotta5fae7d4de72c
diff --git a/cli/src/commands/client/agent.ts b/cli/src/commands/client/agent.ts
index c98ca15884..36eb04e648 100644
--- a/cli/src/commands/client/agent.ts
+++ b/cli/src/commands/client/agent.ts
@@ -197,10 +197,16 @@ export function registerAgentCommands(program: Command): void {
const agentRow = await ctx.api.get<Agent>(
`/api/agents/${encodeURIComponent(agentRef)}?${query.toString()}`,
);
+ if (!agentRow) {
+ throw new Error(`Agent not found: ${agentRef}`);
+ }
const now = new Date().toISOString().replaceAll(":", "-");
const keyName = opts.keyName?.trim() ? opts.keyName.trim() : `local-cli-${now}`;
const key = await ctx.api.post<CreatedAgentKey>(`/api/agents/${agentRow.id}/keys`, { name: keyName });
+ if (!key) {
+ throw new Error("Failed to create API key");
+ }
const installSummaries: SkillsInstallSummary[] = [];
if (opts.installSkills !== false) {
diff --git a/packages/adapters/cursor-local/package.json b/packages/adapters/cursor-local/package.json
index 575f9e1bcd..4ef660521d 100644
--- a/packages/adapters/cursor-local/package.json
+++ b/packages/adapters/cursor-local/package.json
@@ -45,6 +45,7 @@
"picocolors": "^1.1.1"
},
"devDependencies": {
+ "@types/node": "^24.6.0",
"typescript": "^5.7.3"
}
}
diff --git a/packages/adapters/cursor-local/tsconfig.json b/packages/adapters/cursor-local/tsconfig.json
index 2f355cfeeb..90314411a4 100644
--- a/packages/adapters/cursor-local/tsconfig.json
+++ b/packages/adapters/cursor-local/tsconfig.json
@@ -2,7 +2,8 @@
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
- "rootDir": "src"
+ "rootDir": "src",
+ "types": ["node"]
},
"include": ["src"]
}
diff --git a/packages/adapters/openclaw-gateway/README.md b/packages/adapters/openclaw-gateway/README.md
index cadc8198f9..ba3edde24e 100644
--- a/packages/adapters/openclaw-gateway/README.md
+++ b/packages/adapters/openclaw-gateway/README.md
@@ -38,7 +38,7 @@ By default the adapter sends a signed `device` payload in `connect` params.
The adapter supports the same session routing model as HTTP OpenClaw mode:
-- `sessionKeyStrategy=fixed|issue|run`
+- `sessionKeyStrategy=issue|fixed|run`
- `sessionKey` is used when strategy is `fixed`
Resolved session key is sent as `agent.sessionKey`.
diff --git a/packages/adapters/openclaw-gateway/doc/ONBOARDING_AND_TEST_PLAN.md b/packages/adapters/openclaw-gateway/doc/ONBOARDING_AND_TEST_PLAN.md
index f8cacedbe0..61c9b3313d 100644
--- a/packages/adapters/openclaw-gateway/doc/ONBOARDING_AND_TEST_PLAN.md
+++ b/packages/adapters/openclaw-gateway/doc/ONBOARDING_AND_TEST_PLAN.md
@@ -250,8 +250,7 @@ POST /api/companies/$CLA_COMPANY_ID/invites
"headers": { "x-openclaw-token": "<gateway-token>" },
"role": "operator",
"scopes": ["operator.admin"],
- "sessionKeyStrategy": "fixed",
- "sessionKey": "paperclip",
+ "sessionKeyStrategy": "issue",
"waitTimeoutMs": 120000
}
}
diff --git a/packages/adapters/openclaw-gateway/src/index.ts b/packages/adapters/openclaw-gateway/src/index.ts
index 34f7201d5b..e15ca45c9e 100644
--- a/packages/adapters/openclaw-gateway/src/index.ts
+++ b/packages/adapters/openclaw-gateway/src/index.ts
@@ -37,6 +37,6 @@ Request behavior fields:
- paperclipApiUrl (string, optional): absolute Paperclip base URL advertised in wake text
Session routing fields:
-- sessionKeyStrategy (string, optional): fixed (default), issue, or run
+- sessionKeyStrategy (string, optional): issue (default), fixed, or run
- sessionKey (string, optional): fixed session key when strategy=fixed (default paperclip)
`;
diff --git a/packages/adapters/openclaw-gateway/src/server/execute.ts b/packages/adapters/openclaw-gateway/src/server/execute.ts
index b92dccfa8b..c8de510dc1 100644
--- a/packages/adapters/openclaw-gateway/src/server/execute.ts
+++ b/packages/adapters/openclaw-gateway/src/server/execute.ts
@@ -117,9 +117,9 @@ function parseBoolean(value: unknown, fallback = false): boolean {
}
function normalizeSessionKeyStrategy(value: unknown): SessionKeyStrategy {
- const normalized = asString(value, "fixed").trim().toLowerCase();
- if (normalized === "issue" || normalized === "run") return normalized;
- return "fixed";
+ const normalized = asString(value, "issue").trim().toLowerCase();
+ if (normalized === "fixed" || normalized === "run") return normalized;
+ return "issue";
}
function resolveSessionKey(input: {
diff --git a/packages/adapters/openclaw-gateway/src/ui/build-config.ts b/packages/adapters/openclaw-gateway/src/ui/build-config.ts
index fcbbbf4ec7..6a749f8401 100644
--- a/packages/adapters/openclaw-gateway/src/ui/build-config.ts
+++ b/packages/adapters/openclaw-gateway/src/ui/build-config.ts
@@ -5,8 +5,7 @@ export function buildOpenClawGatewayConfig(v: CreateConfigValues): Record<string
if (v.url) ac.url = v.url;
ac.timeoutSec = 120;
ac.waitTimeoutMs = 120000;
- ac.sessionKeyStrategy = "fixed";
- ac.sessionKey = "paperclip";
+ ac.sessionKeyStrategy = "issue";
ac.role = "operator";
ac.scopes = ["operator.admin"];
return ac;
diff --git a/packages/adapters/openclaw/README.md b/packages/adapters/openclaw/README.md
index 10b7d4c173..01dbc661da 100644
--- a/packages/adapters/openclaw/README.md
+++ b/packages/adapters/openclaw/README.md
@@ -72,7 +72,7 @@ When used directly (SSE mode or webhook fallback), payload uses OpenResponses sh
"model": "openclaw",
"input": "...",
"metadata": {
- "paperclip_session_key": "paperclip"
+ "paperclip_session_key": "paperclip:issue:ISSUE_ID"
}
}
```
@@ -91,7 +91,7 @@ You can provide auth either explicitly or via token headers:
Session keys are resolved from:
-- `sessionKeyStrategy`: `fixed` (default), `issue`, `run`
+- `sessionKeyStrategy`: `issue` (default), `fixed`, `run`
- `sessionKey`: used when strategy is `fixed` (default value `paperclip`)
Where session keys are applied:
diff --git a/packages/adapters/openclaw/src/index.ts b/packages/adapters/openclaw/src/index.ts
index 2d939d9290..940dbbc65e 100644
--- a/packages/adapters/openclaw/src/index.ts
+++ b/packages/adapters/openclaw/src/index.ts
@@ -28,7 +28,7 @@ Core fields:
- hookIncludeSessionKey (boolean, optional): when true, include derived \`sessionKey\` in \`/hooks/agent\` webhook payloads (default false)
Session routing fields:
-- sessionKeyStrategy (string, optional): \`fixed\` (default), \`issue\`, or \`run\`
+- sessionKeyStrategy (string, optional): \`issue\` (default), \`fixed\`, or \`run\`
- sessionKey (string, optional): fixed session key value when strategy is \`fixed\` (default \`paperclip\`)
Operational fields:
diff --git a/packages/adapters/openclaw/src/server/execute-common.ts b/packages/adapters/openclaw/src/server/execute-common.ts
index 63deee6e30..427a6c864a 100644
--- a/packages/adapters/openclaw/src/server/execute-common.ts
+++ b/packages/adapters/openclaw/src/server/execute-common.ts
@@ -57,9 +57,9 @@ export function resolvePaperclipApiUrlOverride(value: unknown): string | null {
}
export function normalizeSessionKeyStrategy(value: unknown): SessionKeyStrategy {
- const normalized = asString(value, "fixed").trim().toLowerCase();
- if (normalized === "issue" || normalized === "run") return normalized;
- return "fixed";
+ const normalized = asString(value, "issue").trim().toLowerCase();
+ if (normalized === "fixed" || normalized === "run") return normalized;
+ return "issue";
}
export function resolveSessionKey(input: {
diff --git a/packages/adapters/openclaw/src/ui/build-config.ts b/packages/adapters/openclaw/src/ui/build-config.ts
index f1386780ee..ca8c98e325 100644
--- a/packages/adapters/openclaw/src/ui/build-config.ts
+++ b/packages/adapters/openclaw/src/ui/build-config.ts
@@ -6,7 +6,6 @@ export function buildOpenClawConfig(v: CreateConfigValues): Record<string, unkno
ac.method = "POST";
ac.timeoutSec = 0;
ac.streamTransport = "sse";
- ac.sessionKeyStrategy = "fixed";
- ac.sessionKey = "paperclip";
+ ac.sessionKeyStrategy = "issue";
return ac;
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f46a192d43..ff4f3e35ef 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -132,6 +132,9 @@ importers:
specifier: ^1.1.1
version: 1.1.1
devDependencies:
+ '@types/node':
+ specifier: ^24.6.0
+ version: 24.12.0
typescript:
specifier: ^5.7.3
version: 5.9.3
diff --git a/server/src/__tests__/openclaw-adapter.test.ts b/server/src/__tests__/openclaw-adapter.test.ts
index f3e5dd5980..a77b21bb0f 100644
--- a/server/src/__tests__/openclaw-adapter.test.ts
+++ b/server/src/__tests__/openclaw-adapter.test.ts
@@ -181,10 +181,10 @@ describe("openclaw adapter execute", () => {
const body = JSON.parse(String(fetchMock.mock.calls[0]?.[1]?.body ?? "{}")) as Record<string, unknown>;
expect(body.foo).toBe("bar");
expect(body.stream).toBe(true);
- expect(body.sessionKey).toBe("paperclip");
+ expect(body.sessionKey).toBe("paperclip:issue:issue-123");
expect((body.paperclip as Record<string, unknown>).streamTransport).toBe("sse");
expect((body.paperclip as Record<string, unknown>).runId).toBe("run-123");
- expect((body.paperclip as Record<string, unknown>).sessionKey).toBe("paperclip");
+ expect((body.paperclip as Record<string, unknown>).sessionKey).toBe("paperclip:issue:issue-123");
expect(
((body.paperclip as Record<string, unknown>).env as Record<string, unknown>).PAPERCLIP_RUN_ID,
).toBe("run-123");
@@ -414,7 +414,7 @@ describe("openclaw adapter execute", () => {
expect(body.sessionKey).toBeUndefined();
const headers = (fetchMock.mock.calls[0]?.[1]?.headers ?? {}) as Record<string, string>;
- expect(headers["x-openclaw-session-key"]).toBe("paperclip");
+ expect(headers["x-openclaw-session-key"]).toBe("paperclip:issue:issue-123");
});
it("does not treat response.output_text.done as a terminal OpenResponses event", async () => {
@@ -584,7 +584,7 @@ describe("openclaw adapter execute", () => {
const body = JSON.parse(String(fetchMock.mock.calls[0]?.[1]?.body ?? "{}")) as Record<string, unknown>;
expect(body.foo).toBe("bar");
expect(body.stream).toBe(false);
- expect(body.sessionKey).toBe("paperclip");
+ expect(body.sessionKey).toBe("paperclip:issue:issue-123");
expect(String(body.text ?? "")).toContain("PAPERCLIP_RUN_ID=run-123");
expect((body.paperclip as Record<string, unknown>).streamTransport).toBe("webhook");
});
@@ -668,7 +668,7 @@ describe("openclaw adapter execute", () => {
expect(String(secondBody.input ?? "")).toContain("PAPERCLIP_RUN_ID=run-123");
const secondHeaders = (fetchMock.mock.calls[1]?.[1]?.headers ?? {}) as Record<string, string>;
- expect(secondHeaders["x-openclaw-session-key"]).toBe("paperclip");
+ expect(secondHeaders["x-openclaw-session-key"]).toBe("paperclip:issue:issue-123");
expect(result.resultJson).toEqual(
expect.objectContaining({
usedLegacyResponsesFallback: true,
@@ -766,7 +766,7 @@ describe("openclaw adapter execute", () => {
expect(result.exitCode).toBe(0);
expect(fetchMock).toHaveBeenCalledTimes(1);
const body = JSON.parse(String(fetchMock.mock.calls[0]?.[1]?.body ?? "{}")) as Record<string, unknown>;
- expect(body.sessionKey).toBe("paperclip");
+ expect(body.sessionKey).toBe("paperclip:issue:issue-123");
});
it("retries webhook payloads with wake compatibility format on text-required errors", async () => {
diff --git a/server/src/__tests__/openclaw-gateway-adapter.test.ts b/server/src/__tests__/openclaw-gateway-adapter.test.ts
index 3a4ac10e57..364f5a97f5 100644
--- a/server/src/__tests__/openclaw-gateway-adapter.test.ts
+++ b/server/src/__tests__/openclaw-gateway-adapter.test.ts
@@ -424,7 +424,7 @@ describe("openclaw gateway adapter execute", () => {
const payload = gateway.getAgentPayload();
expect(payload).toBeTruthy();
expect(payload?.idempotencyKey).toBe("run-123");
- expect(payload?.sessionKey).toBe("paperclip");
+ expect(payload?.sessionKey).toBe("paperclip:issue:issue-123");
expect(String(payload?.message ?? "")).toContain("wake now");
expect(String(payload?.message ?? "")).toContain("PAPERCLIP_RUN_ID=run-123");
expect(String(payload?.message ?? "")).toContain("PAPERCLIP_TASK_ID=task-123");
diff --git a/server/src/routes/access.ts b/server/src/routes/access.ts
index 3e2ba5276c..9eaacf71ac 100644
--- a/server/src/routes/access.ts
+++ b/server/src/routes/access.ts
@@ -1484,8 +1484,7 @@ export function buildInviteOnboardingTextDocument(
paperclipApiUrl: "http://host.docker.internal:3100",
headers: { "x-openclaw-token": token },
waitTimeoutMs: 120000,
- sessionKeyStrategy: "fixed",
- sessionKey: "paperclip",
+ sessionKeyStrategy: "issue",
role: "operator",
scopes: ["operator.admin"]
}
@@ -1518,8 +1517,7 @@ export function buildInviteOnboardingTextDocument(
"paperclipApiUrl": "https://paperclip-hostname-your-agent-can-reach:3100",
"headers": { "x-openclaw-token": "replace-me" },
"waitTimeoutMs": 120000,
- "sessionKeyStrategy": "fixed",
- "sessionKey": "paperclip",
+ "sessionKeyStrategy": "issue",
"role": "operator",
"scopes": ["operator.admin"]
}