openclaw - ✅(Solved) Fix Gateway AgentParamsSchema rejects adapter-injected metadata fields (paperclip case) [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#73653Fetched 2026-04-29 06:16:55
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
cross-referenced ×3commented ×2

AgentParamsSchema (in dist/protocol-*.js, e.g. protocol-Hjar_s3V.js in 2026.4.26) is closed with additionalProperties: false and only allows the 35 keys listed below. Adapters that legitimately want to attach context metadata to a wake — Paperclip's @paperclipai/adapter-openclaw-gateway is the case I hit — get every wake rejected with:

[ws] ⇄ res ✗ agent 0ms errorCode=INVALID_REQUEST errorMessage=invalid agent params: at root: unexpected property 'paperclip'

In our case, every agent wake from Paperclip has been silently failing for 12 days (651 errors in our gateway.log since 2026-04-16). It got buried under a separate WS-open-timeout regression, and only surfaced once we fixed that.

Error Message

  • The error is a hard rejection at the validation layer with no version negotiation, so any future allowlist entry that an adapter tries to use on an older gateway is a silent break.

Root Cause

AgentParamsSchema (in dist/protocol-*.js, e.g. protocol-Hjar_s3V.js in 2026.4.26) is closed with additionalProperties: false and only allows the 35 keys listed below. Adapters that legitimately want to attach context metadata to a wake — Paperclip's @paperclipai/adapter-openclaw-gateway is the case I hit — get every wake rejected with:

[ws] ⇄ res ✗ agent 0ms errorCode=INVALID_REQUEST errorMessage=invalid agent params: at root: unexpected property 'paperclip'

In our case, every agent wake from Paperclip has been silently failing for 12 days (651 errors in our gateway.log since 2026-04-16). It got buried under a separate WS-open-timeout regression, and only surfaced once we fixed that.

Fix Action

Fix / Workaround

Workaround we shipped

Two-layer local fix: schema patch (filename hash changes per build, so we discover it dynamically and re-apply via WatchPaths on package.json) plus a source-side strip in the offending adapter. Defense in depth verified — strip alone is sufficient, schema patch is the safety net. We'll retire both when this is fixed upstream.

PR fix notes

PR #69139: fix(gateway): accept Paperclip adapter root-level paperclip metadata in agent params

Description (problem / solution / changelog)

Closes #69137

The Paperclip sends a root-level object in every payload, but OpenClaw's rejected it because is . This broke the documented Paperclip integration end-to-end after onboarding/auth succeeded.

  • Add to
  • Add a test verifying the field is accepted without validation errors

Changed files

  • src/gateway/protocol/schema/agent.ts (modified, +2/-0)
  • src/gateway/server-methods/agent.test.ts (modified, +30/-3)

Code Example

[ws] ⇄ res ✗ agent 0ms errorCode=INVALID_REQUEST errorMessage=invalid agent params: at root: unexpected property 'paperclip'

---

message, agentId, provider, model, to, replyTo, sessionId, sessionKey,
thinking, deliver, attachments, channel, replyChannel, accountId,
replyAccountId, threadId, groupId, groupChannel, groupSpace, timeout,
bestEffortDeliver, lane, cleanupBundleMcpOnRunEnd, modelRun, promptMode,
extraSystemPrompt, bootstrapContextMode, bootstrapContextRunKind,
acpTurnSource, internalEvents, inputProvenance, voiceWakeTrigger,
idempotencyKey, label
RAW_BUFFERClick to expand / collapse

Summary

AgentParamsSchema (in dist/protocol-*.js, e.g. protocol-Hjar_s3V.js in 2026.4.26) is closed with additionalProperties: false and only allows the 35 keys listed below. Adapters that legitimately want to attach context metadata to a wake — Paperclip's @paperclipai/adapter-openclaw-gateway is the case I hit — get every wake rejected with:

[ws] ⇄ res ✗ agent 0ms errorCode=INVALID_REQUEST errorMessage=invalid agent params: at root: unexpected property 'paperclip'

In our case, every agent wake from Paperclip has been silently failing for 12 days (651 errors in our gateway.log since 2026-04-16). It got buried under a separate WS-open-timeout regression, and only surfaced once we fixed that.

Reproduce

  1. Run any 3rd-party adapter that adds a top-level field to agent request params (e.g. paperclipai/adapter-openclaw-gateway).
  2. Send the WS request: { kind: \"request\", method: \"agent\", params: { message, agentId, sessionKey, idempotencyKey, ...adapterMeta } }.
  3. Observe errorCode=INVALID_REQUEST: at root: unexpected property '<field>'.

Why this is a problem

  • Adapters legitimately need to ship metadata alongside agent wakes (run IDs, source-system context, workspace info). Today the schema gives them no escape hatch — they have to embed it in message text (lossy) or attachments[] (semantically wrong).
  • The error is a hard rejection at the validation layer with no version negotiation, so any future allowlist entry that an adapter tries to use on an older gateway is a silent break.
  • Today's allowlist is 35 keys curated to OpenClaw's needs. Third-party adapters can't extend it without forking the schema.

Allowlist today (35 keys)

message, agentId, provider, model, to, replyTo, sessionId, sessionKey,
thinking, deliver, attachments, channel, replyChannel, accountId,
replyAccountId, threadId, groupId, groupChannel, groupSpace, timeout,
bestEffortDeliver, lane, cleanupBundleMcpOnRunEnd, modelRun, promptMode,
extraSystemPrompt, bootstrapContextMode, bootstrapContextRunKind,
acpTurnSource, internalEvents, inputProvenance, voiceWakeTrigger,
idempotencyKey, label

(Verified by allowlist-extracting our local copy; protocol-Hjar_s3V.js line 184–227.)

Proposed fixes (any one would work; not mutually exclusive)

  1. Add a typed adapterMeta/adapterContext namespace to the schema — Type.Optional(Type.Record(Type.String(), Type.Unknown())) — so adapters have an explicit contract for shipping their own metadata without polluting the top-level keyspace.
  2. Relax to additionalProperties: true (or use .passthrough() equivalent) — simplest, lets adapters extend with anything, but loses validation safety on typos.
  3. Add paperclip (and other known integration partners) to the allowlist as Type.Optional(Type.Unknown()) — narrowest fix; keeps the rejection as a typo-catcher.

Option 1 is cleanest for long-term ecosystem health.

Workaround we shipped

Two-layer local fix: schema patch (filename hash changes per build, so we discover it dynamically and re-apply via WatchPaths on package.json) plus a source-side strip in the offending adapter. Defense in depth verified — strip alone is sufficient, schema patch is the safety net. We'll retire both when this is fixed upstream.

Environment

  • macOS 26.4.1 / arm64
  • OpenClaw 2026.4.26 (be8c246)
  • Paperclip @paperclipai/[email protected]

extent analysis

TL;DR

The most likely fix is to add a typed adapterMeta namespace to the AgentParamsSchema to allow adapters to ship their own metadata without polluting the top-level keyspace.

Guidance

  • Consider adding a typed adapterMeta/adapterContext namespace to the schema, allowing adapters to extend with their own metadata.
  • Relaxing additionalProperties to true is another option, but it may compromise validation safety.
  • Adding known integration partners like paperclip to the allowlist is a narrower fix, but may not be scalable.
  • Verifying the fix involves testing with a 3rd-party adapter that adds a top-level field to agent request params and checking for successful requests.

Example

No code snippet is provided as it is not explicitly supported by the issue, but an example of the proposed adapterMeta namespace could be:

adapterMeta: Type.Optional(Type.Record(Type.String(), Type.Unknown()))

Notes

The proposed fixes are not mutually exclusive, and the choice of fix depends on the trade-off between validation safety and flexibility for adapters.

Recommendation

Apply the first proposed fix: add a typed adapterMeta namespace to the schema, as it is the cleanest solution for long-term ecosystem health.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Gateway AgentParamsSchema rejects adapter-injected metadata fields (paperclip case) [1 pull requests, 2 comments, 2 participants]