Skip to content

Commit 3f4d601

Browse files
author
OpenClaw Agent
committed
fix: AgentParamsSchema must accept paperclip property in wake payload
1 parent f603785 commit 3f4d601

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { describe, expect, it } from "vitest";
2+
import { validateAgentParams } from "../index.js";
3+
4+
const minimalAgentParams = {
5+
message: "wake",
6+
idempotencyKey: "idem-1234",
7+
} as const;
8+
9+
describe("AgentParamsSchema", () => {
10+
it("accepts minimal params", () => {
11+
expect(validateAgentParams(minimalAgentParams)).toBe(true);
12+
});
13+
14+
it("accepts a paperclip context object in the payload", () => {
15+
// Paperclip ≥ 2026.416.0 includes a `paperclip` field in wake payloads.
16+
// The gateway must not reject it as an unexpected property.
17+
expect(
18+
validateAgentParams({
19+
...minimalAgentParams,
20+
paperclip: {
21+
runId: "run-abc123",
22+
companyId: "13808fb1-a29b-4465-9796-b8b200845155",
23+
agentId: "agent-xyz",
24+
issueId: "issue-001",
25+
},
26+
}),
27+
).toBe(true);
28+
});
29+
30+
it("accepts a paperclip field with arbitrary shape", () => {
31+
expect(
32+
validateAgentParams({
33+
...minimalAgentParams,
34+
paperclip: { nested: { deep: true }, list: [1, 2, 3] },
35+
}),
36+
).toBe(true);
37+
});
38+
39+
it("rejects a payload missing idempotencyKey", () => {
40+
expect(validateAgentParams({ message: "wake" })).toBe(false);
41+
});
42+
43+
it("rejects a payload missing message", () => {
44+
expect(validateAgentParams({ idempotencyKey: "idem-1234" })).toBe(false);
45+
});
46+
47+
it("rejects unknown top-level properties other than paperclip", () => {
48+
expect(validateAgentParams({ ...minimalAgentParams, notAKnownField: "value" })).toBe(false);
49+
});
50+
});

src/gateway/protocol/schema/agent.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ export const AgentParamsSchema = Type.Object(
169169
voiceWakeTrigger: Type.Optional(Type.String()),
170170
idempotencyKey: NonEmptyString,
171171
label: Type.Optional(SessionLabelString),
172+
/** Paperclip-originated wake payloads include a `paperclip` context object. */
173+
paperclip: Type.Optional(Type.Unknown()),
172174
},
173175
{ additionalProperties: false },
174176
);

0 commit comments

Comments
 (0)