fix(gateway): allow Paperclip integration metadata through AgentParams validator#12
Open
suboss87 wants to merge 60 commits into
Open
fix(gateway): allow Paperclip integration metadata through AgentParams validator#12suboss87 wants to merge 60 commits into
suboss87 wants to merge 60 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes openclaw#74635
Problem
The AJV-compiled
validateAgentParamsvalidator is compiled withadditionalProperties: falsefromAgentParamsSchema. Any gateway RPC call that includes apaperclipfield (Paperclip integration metadata attached by the iOS/macOS app) is rejected with a validation error before reaching the agent runner.Root cause
AgentParamsSchemainsrc/gateway/protocol/schema/agent.tshad nopaperclipproperty. The TypeBox schema usesadditionalProperties: false, so AJV rejects any unknown top-level property includingpaperclip.Fix
Added
paperclip: Type.Optional(Type.Unknown())toAgentParamsSchema. UsingType.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-- verifiesvalidateAgentParams({ ..., paperclip: { source: "paperclip", attachmentId: "abc" } })returnstruerejects agentParams with an unrecognized unknown field-- verifiesvalidateAgentParams({ ..., unknownField: true })still returnsfalse(strict mode preserved)Generated by Claude Code