Skip to content

fix(a2a): bound outbound JSON response bodies - #132273

Merged
obviyus merged 3 commits into
openclaw:mainfrom
RileyJJY:sunlit/fix/a2a-response-boundary
Aug 30, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
RileyJJY:sunlit/fix/a2a-response-boundary

Conversation

@RileyJJY

@RileyJJY RileyJJY commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

An A2A peer controls its successful HTTP response body. The outbound channel parsed that body with Response.json(), so it could buffer and accept JSON larger than OpenClaw's shared 16 MiB response limit.

Root cause

sendA2aChannelText used the Server-Side Request Forgery guard for the request, but bypassed OpenClaw's bounded reader when it consumed the successful response.

Fix

  • Read successful peer JSON through the public Plugin SDK readProviderJsonResponse helper.
  • Pass the active request headers so malformed reflected data cannot survive in parser causes.
  • Keep A2A schema validation and the one-time legacy method retry unchanged.

Evidence

The same production send path called a real loopback A2A peer at both revisions.

Scenario Exact main aace96c6720e Exact head 9592e1cd6fdd
Valid 1,048,653-byte JSON Accepted as normal-control-task Accepted as normal-control-task
Valid 17,825,873-byte JSON Accepted as oversized-boundary-task Rejected at the 16,777,216-byte shared limit
Malformed JSON reflecting the outbound credential Rejected Rejected with the bounded-reader error and no retained credential or cause

The peer recorded SendMessage for every probe, which proves the real A2A request reached the loopback server.

Tests

  • The two regression cases fail against exact pre-fix production for the intended reasons.
  • extensions/a2a/src/outbound.test.ts: 8 passed.
  • Scoped format, lint, max-lines, assertion-safety, test-temp, and plugin doctor-contract checks passed.
  • Hosted CI owns type checking because this Falc0n host does not run OpenClaw type checks.

AI-assisted: built with Codex.

@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 3:20 AM ET / 07:20 UTC.

ClawSweeper review

What this changes

The PR routes outbound A2A peer JSON replies through OpenClaw’s bounded Plugin SDK response reader and adds regression coverage for oversized and credential-reflecting malformed replies.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The PR remains necessary: current main still parses successful A2A peer replies with unbounded Response.json(), while this branch adopts the existing bounded, credential-safe shared reader. No blocking correctness or security finding remains after the prior header-context finding was addressed.

Priority: P2
Reviewed head: 9592e1cd6fdd5a6e4996297b339d0b9611b8fd78

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, canonical repair with concrete before-and-after loopback proof and no remaining actionable review finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The changed production owner is outbound A2A delivery; the PR body supplies a real loopback-peer run through that sender at both revisions, showing normal replies still succeed, oversized replies now fail at 16 MiB, and reflected credentials do not survive malformed-JSON errors.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The changed production owner is outbound A2A delivery; the PR body supplies a real loopback-peer run through that sender at both revisions, showing normal replies still succeed, oversized replies now fail at 16 MiB, and reflected credentials do not survive malformed-JSON errors.
Evidence reviewed 7 items Current main still has the defect: At fetched main SHA 41dccab, successful A2A replies are consumed with Response.json(), without the shared byte-limited reader.
Introduced repair uses the canonical boundary: The introduced hunk replaces that direct parse with the public provider-http reader and passes the active headers into its error-sanitization path.
Shared reader contract: The shared reader consumes JSON via the bounded response reader, whose default cap is 16 MiB, and omits parser causes when request headers are supplied.
Findings None None.
Security None None.

How this fits together

A2A outbound delivery sends a JSON-RPC request to a configured peer and parses the successful peer reply before returning a delivery receipt to the channel layer. The shared Plugin SDK response reader is the boundary that limits peer-controlled bodies and prevents request credentials from surviving parser errors.

flowchart LR
  A[Outgoing A2A message] --> B[Outbound A2A delivery]
  B --> C[Protected peer request]
  C --> D[Peer HTTP response]
  D --> E[Bounded shared JSON reader]
  E --> F[A2A response validation]
  F --> G[Delivery receipt]
Loading

Before merge

  • Resolve merge risk (P1) - Production code is net +5 lines for this bug fix; the added import and labeled shared-reader call are the smallest direct reuse of the existing bounded and credential-safe contract, so no local net-neutral refactor preserves both properties.
  • Complete next step (P2) - No repair job is needed because the branch already contains the focused owner-boundary fix and has no actionable review finding.
Agent review details

Security

None.

PR surface

Source +5, Tests +47. Total +52 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 1 +5
Tests 1 48 1 +47
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 54 2 +52

Review metrics

Metric Value Why it matters
Production versus test delta production +5 (6 added, 1 removed); tests +47 (48 added, 1 removed) The small production increase delegates to an existing safety boundary; the test increase covers the two previously unbounded or credential-retaining cases.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the direct reuse of the existing Plugin SDK response-reader contract so every successful outbound A2A peer reply is bounded and parser failures cannot retain active outbound credentials.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the direct reuse of the existing Plugin SDK response-reader contract so every successful outbound A2A peer reply is bounded and parser failures cannot retain active outbound credentials.

Do we have a high-confidence way to reproduce the issue?

Yes. The supplied real loopback A2A run exercises the production sender before and after the change, and current main source still uses the unbounded parse path.

Is this the best way to solve the issue?

Yes. Reusing the existing public bounded reader at the peer-response owner fixes both body growth and parser-cause retention without changing A2A request, schema-validation, or retry policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 41dccabf1796.

Labels

Label justifications:

  • P2: This is a focused fix for bounded-resource handling and credential-safe errors in an optional outbound channel path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The changed production owner is outbound A2A delivery; the PR body supplies a real loopback-peer run through that sender at both revisions, showing normal replies still succeed, oversized replies now fail at 16 MiB, and reflected credentials do not survive malformed-JSON errors.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is outbound A2A delivery; the PR body supplies a real loopback-peer run through that sender at both revisions, showing normal replies still succeed, oversized replies now fail at 16 MiB, and reflected credentials do not survive malformed-JSON errors.

Evidence

What I checked:

  • Current main still has the defect: At fetched main SHA 41dccab, successful A2A replies are consumed with Response.json(), without the shared byte-limited reader. (extensions/a2a/src/outbound.ts:99, 41dccabf1796)
  • Introduced repair uses the canonical boundary: The introduced hunk replaces that direct parse with the public provider-http reader and passes the active headers into its error-sanitization path. (extensions/a2a/src/outbound.ts:100, 9592e1cd6fdd)
  • Shared reader contract: The shared reader consumes JSON via the bounded response reader, whose default cap is 16 MiB, and omits parser causes when request headers are supplied. (src/agents/provider-http-errors.ts:430, d2cf05c35c1a)
  • Caller and preserved behavior: Both ordinary channel sends and attached outbound results call the repaired owner; the existing tests retain coverage for canonical send, one-time legacy retry, error handling, and generated task IDs. (extensions/a2a/src/channel.ts:27, 9592e1cd6fdd)
  • Focused regression coverage: The added tests assert rejection above the 16 MiB limit and that a malformed peer reply reflecting the outbound token exposes neither the token nor a parser cause. (extensions/a2a/src/outbound.test.ts:236, 9592e1cd6fdd)
  • Real behavior proof: The supplied PR body records the production send path against a real loopback A2A peer at pre-fix and head revisions: a normal 1,048,653-byte reply succeeds, a 17,825,873-byte reply is rejected at the shared limit, and a reflected credential is absent from the post-fix error. (9592e1cd6fdd)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-29T02:00:41.368Z sha a729df3 :: needs changes before merge. :: [P1] Pass authorization headers to the bounded JSON reader
  • reviewed 2026-08-29T05:08:15.432Z sha 9592e1c :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 30, 2026
@obviyus

obviyus commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Maintainer gate review:

  • The +5 production-line item is advisory. The public Plugin SDK import and labeled reader call with request-header context are required to reuse the existing byte-limit and credential-redaction owner. A net-neutral local rewrite would hide or duplicate that contract.
  • The “no repair job needed” item is complete. Exact-head loopback proof, focused tests, local ClawSweeper, and openclaw/ci-gate are green with no code change after review.

@obviyus
obviyus merged commit ef8fc68 into openclaw:main Aug 30, 2026
127 of 130 checks passed
@obviyus

obviyus commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Thanks @RileyJJY!

Proof: A real loopback A2A peer returned the same normal and oversized valid JSON replies to the production send path. The 1,048,653-byte reply still succeeded, while the 17,825,873-byte reply now stopped at OpenClaw's shared 16,777,216-byte limit. A malformed reply that reflected the outbound credential retained neither the credential nor a parser cause.

  • Bug: A configured A2A peer could make outbound delivery buffer and accept an unbounded successful JSON response.
  • Fix: A2A now consumes successful peer JSON through the shared bounded reader with the active request headers as redaction context.

Example

Before After
A valid 17,825,873-byte peer response was accepted. The same response is rejected at the shared 16 MiB boundary; normal replies still succeed.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
Route successful A2A peer JSON through OpenClaw's shared bounded response reader.

This rejects oversized peer responses at the existing 16 MiB limit and prevents malformed reflected data from retaining active outbound credentials. Normal replies, schema validation, and the one-time legacy method retry remain unchanged.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: a2a P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants