Skip to content

fix(gateway): allow Paperclip integration metadata through AgentParams validator#12

Open
suboss87 wants to merge 60 commits into
mainfrom
fix/74635-agent-params-paperclip
Open

fix(gateway): allow Paperclip integration metadata through AgentParams validator#12
suboss87 wants to merge 60 commits into
mainfrom
fix/74635-agent-params-paperclip

Conversation

@suboss87
Copy link
Copy Markdown
Owner

@suboss87 suboss87 commented Apr 30, 2026

Closes openclaw#74635

Problem

The AJV-compiled validateAgentParams validator is compiled with additionalProperties: false from AgentParamsSchema. Any gateway RPC call that includes a paperclip field (Paperclip integration metadata attached by the iOS/macOS app) is rejected with a validation error before reaching the agent runner.

Root cause

AgentParamsSchema in src/gateway/protocol/schema/agent.ts had no paperclip property. The TypeBox schema uses additionalProperties: false, so AJV rejects any unknown top-level property including paperclip.

Fix

Added paperclip: Type.Optional(Type.Unknown()) to AgentParamsSchema. Using Type.Unknown() keeps it maximally permissive -- Paperclip metadata is opaque to the gateway and only consumed downstream by Paperclip-aware agents.

Tests

Added two regression tests to src/gateway/protocol/index.test.ts:

  • accepts agentParams with paperclip metadata -- verifies validateAgentParams({ ..., paperclip: { source: "paperclip", attachmentId: "abc" } }) returns true
  • rejects agentParams with an unrecognized unknown field -- verifies validateAgentParams({ ..., unknownField: true }) still returns false (strict mode preserved)

Generated by Claude Code


Open in Devin Review

claude added 30 commits April 1, 2026 15:34
claude and others added 28 commits April 20, 2026 03:42
Paperclip injects a `paperclip` property into the root of its agent
invocation payload when calling the openclaw_gateway adapter. Because
AgentParamsSchema has additionalProperties: false, the gateway was
rejecting every Paperclip-triggered invocation with:

  invalid agent params: at root: unexpected property 'paperclip'

Add paperclip as Type.Optional(Type.Unknown()) so the gateway accepts
and ignores the passthrough metadata without constraining its shape.

Regression test added in index.test.ts: verifies validateAgentParams
accepts a payload carrying a paperclip object.

Fixes openclaw#74635
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: openclaw_gateway rejects Paperclip agent heartbeats — "unexpected property 'paperclip'"

2 participants