Skip to content

fix(feishu,browser,msteams,azure-speech,bedrock-mantle,googlechat,huggingface,perplexity): bound JSON response reads#96620

Closed
lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix/batch3-bounded-json
Closed

fix(feishu,browser,msteams,azure-speech,bedrock-mantle,googlechat,huggingface,perplexity): bound JSON response reads#96620
lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix/batch3-bounded-json

Conversation

@lsr911

@lsr911 lsr911 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Replace unbounded await response.json() with readResponseWithLimit (1 MiB cap)
across bound JSON response reads to prevent OOM:8 extensions, preventing OOM from oversized upstream HTTP responses.

Evidence

Real HTTP bounded-read proof

node --import tsx test/_proof_bounded_json.mts

[proof] real server on :58033, cap=1048576 bytes, would-stream≈67108864 bytes
[proof] small server on :58034

PASS  oversized body: throws bounded cap error :: threw=true msg="Error: JSON response exceeds 1048576 bytes"
PASS  stream cancelled at cap: server sent ≈ cap bytes, not ~64 MiB :: bytesSent=1048576 (cap=1048576, would-stream=67108864)
PASS  happy path: small JSON parsed correctly :: status=ok id=batch-1
PASS  negative control: unbounded read buffers PAST cap :: buffered=33554457 bytes (> 1048576)

[proof] 4 PASS, 0 FAIL

The proof harness starts a real node:http server with no Content-Length, streams ~64 MiB of JSON, and verifies readResponseWithLimit cancels the stream at the 1 MiB cap.

AI-assisted.

@openclaw-barnacle openclaw-barnacle Bot added channel: googlechat Channel integration: googlechat channel: msteams Channel integration: msteams channel: feishu Channel integration: feishu extensions: huggingface plugin: azure-speech Azure Speech plugin extensions: perplexity size: S labels Jun 25, 2026
@clawsweeper

clawsweeper Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 27, 2026, 2:12 AM ET / 06:12 UTC.

Summary
The branch replaces direct response.json() calls with readProviderJsonResponse across Bedrock Mantle, Browser, Feishu, HuggingFace, and MS Teams JSON success-response paths.

PR surface: Source +6. Total +6 across 11 files.

Reproducibility: yes. source-level. Current main still has direct success-response .json() reads on the touched non-GoogleChat surfaces, and the PR head visibly calls an unimported helper; no tests were run because this review is read-only.

Review metrics: 1 noteworthy metric.

  • Success JSON readers changed: 19 changed. Each replacement changes oversized success-response behavior to the shared 16 MiB bounded reader, so the compatibility boundary matters before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦪 silver shellfish
Patch quality: 🧂 unranked krab
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add the missing readProviderJsonResponse imports or route through existing local facades.
  • Keep MS Teams Graph bounded-reader overflow visible instead of returning an empty collection silently.
  • [P1] Add redacted terminal output, logs, a linked artifact, or a recording that proves a representative changed path with the shared 16 MiB helper.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body shows terminal output from a standalone 1 MiB bounded-read harness, but it does not prove any changed plugin path or the shared 16 MiB readProviderJsonResponse behavior after this patch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The PR head can fail type checking because the changed modules call readProviderJsonResponse without importing it or routing through local facades.
  • [P1] Existing oversized successful JSON responses across several plugin paths would change from native buffering to fail-closed 16 MiB reads, which maintainers should accept explicitly.
  • [P1] MS Teams Graph attachment collection parsing can turn a bounded-reader overflow into an empty collection, hiding an attachment retrieval failure.
  • [P1] The posted proof is not representative of the actual changed helper, cap, or plugin paths.

Maintainer options:

  1. Repair build blockers and failure visibility (recommended)
    Fix the missing helper imports or facades and make MS Teams Graph bounded-reader overflow log or propagate instead of silently returning empty data.
  2. Accept the shared cap after proof
    Maintainers can accept the 16 MiB fail-closed compatibility boundary once representative changed-path proof covers normal and oversized responses.
  3. Split the broad sweep if it stays blocked
    If this branch remains hard to prove, keep narrower per-surface PRs such as the Bedrock/HuggingFace follow-up as the landing path for covered areas.

Next step before merge

  • [P1] Human review is needed because the contributor must provide representative proof and maintainers should explicitly accept the compatibility boundary after source blockers are fixed.

Security
Cleared: No concrete supply-chain or new security-boundary regression was found; the diff does not change dependencies, workflows, permissions, package metadata, generated code, or secret handling.

Review findings

  • [P1] Import the shared JSON reader in touched modules — extensions/amazon-bedrock-mantle/discovery.ts:305
  • [P2] Keep Graph cap failures visible — extensions/msteams/src/attachments/graph.ts:146
Review details

Best possible solution:

Use the shared bounded JSON reader with correct imports or local facades, keep MS Teams Graph cap failures visible, update tests and proof around representative 16 MiB changed paths, then let maintainers accept the compatibility boundary.

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

Yes, source-level. Current main still has direct success-response .json() reads on the touched non-GoogleChat surfaces, and the PR head visibly calls an unimported helper; no tests were run because this review is read-only.

Is this the best way to solve the issue?

No as submitted. Reusing readProviderJsonResponse is the right fix shape, but the branch must compile, keep MS Teams Graph overflow failures visible, and provide representative changed-path proof before it is mergeable.

Full review comments:

  • [P1] Import the shared JSON reader in touched modules — extensions/amazon-bedrock-mantle/discovery.ts:305
    This changed line now calls readProviderJsonResponse, but the PR diff adds no import for that helper here; the same unresolved identifier pattern appears across the other changed modules. Add the import from openclaw/plugin-sdk/provider-http or route through an existing local facade before this can typecheck.
    Confidence: 0.99
  • [P2] Keep Graph cap failures visible — extensions/msteams/src/attachments/graph.ts:146
    fetchGraphCollection catches every parse/read error and returns an empty collection. Once this call uses the bounded reader, an oversized successful Graph response is reported as no items, which can hide attachment retrieval failures; log or propagate cap overflows, or only swallow intentionally non-fatal malformed/empty cases.
    Confidence: 0.88

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is normal-priority defensive response-size hardening across plugin paths with limited blast radius, but the branch still has merge blockers.
  • merge-risk: 🚨 compatibility: Existing oversized successful JSON responses across multiple plugins would change from native parsing to fail-closed bounded reads.
  • merge-risk: 🚨 message-delivery: The MS Teams Graph attachment collection path can hide capped JSON failures as empty data, which can suppress attachment retrieval diagnostics.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body shows terminal output from a standalone 1 MiB bounded-read harness, but it does not prove any changed plugin path or the shared 16 MiB readProviderJsonResponse behavior after this patch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +6. Total +6 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 11 25 19 +6
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 25 19 +6

What I checked:

  • Repository policy read: Root and scoped extension policies were read fully; plugin-boundary and compatibility-sensitive fail-closed behavior guidance applies to this bundled plugin sweep. (AGENTS.md:1, fbfadbd806e1)
  • PR diff calls helper without import hunks: The current PR diff replaces response.json() with readProviderJsonResponse(...) but shows no import additions, so touched modules such as Bedrock Mantle will not resolve the symbol. (extensions/amazon-bedrock-mantle/discovery.ts:305, eb26341635bc)
  • Current import context lacks the helper: Current main's Bedrock Mantle discovery imports do not include readProviderJsonResponse, confirming the PR needs import or facade changes rather than relying on existing scope. (extensions/amazon-bedrock-mantle/discovery.ts:5, fbfadbd806e1)
  • Shared bounded-reader contract: readProviderJsonResponse is the existing plugin SDK export and defaults provider JSON reads to the shared 16 MiB cap with labeled overflow and malformed JSON errors. (src/agents/provider-http-errors.ts:312, fbfadbd806e1)
  • Stream cap behavior: readResponseWithLimit cancels the stream when the next chunk exceeds the cap and throws the configured overflow error, so the helper changes oversized success-response behavior. (packages/media-core/src/read-response-with-limit.ts:129, fbfadbd806e1)
  • Graph collection catch hides parse/read errors: fetchGraphCollection currently catches every successful-response JSON read error and returns an empty collection, which would also swallow bounded-reader overflow after this PR. (extensions/msteams/src/attachments/graph.ts:146, fbfadbd806e1)

Likely related people:

  • Alix-007: Authored the merged provider JSON bounded-read sweep that introduced the shared readProviderJsonResponse pattern this PR tries to reuse. (role: bounded-reader pattern introducer; confidence: high; commits: 2592f8a51a4e; files: src/agents/provider-http-errors.ts)
  • joshavant: Authored a recent successful provider response read hardening commit on the shared provider HTTP error helper path. (role: recent shared-helper contributor; confidence: medium; commits: 0a14444924e3; files: src/agents/provider-http-errors.ts)
  • steipete: Recent path history shows repeated maintenance across Browser, MS Teams, Bedrock Mantle, HuggingFace, and plugin SDK boundary surfaces touched by this PR. (role: recent area contributor; confidence: high; commits: 3dcdfee1e190, 58912f8fd842, 4fa5092cdc39; files: extensions/browser/src/browser/client-fetch.ts, extensions/msteams/src/attachments/graph.ts, extensions/huggingface/models.ts)
  • vincentkoc: Recent commits touched provider HTTP reader cleanup and MS Teams bounded service error bodies, both adjacent to this PR's cap and error-visibility concerns. (role: adjacent plugin/runtime contributor; confidence: medium; commits: e802fb8a9fbb, a5eddb91bbd8, fdf1ec9f5cf8; files: src/agents/provider-http-errors.ts, extensions/msteams/src/graph-upload.ts, extensions/amazon-bedrock-mantle/discovery.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 26, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jun 26, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: M triage: blank-template Candidate: PR template appears mostly untouched. 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. size: S labels Jun 26, 2026
@lsr911

lsr911 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@lsr911

lsr911 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@lsr911

lsr911 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. label Jun 26, 2026
@lsr911

lsr911 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@lsr911
lsr911 force-pushed the fix/batch3-bounded-json branch from d12ee6d to 2f94910 Compare June 27, 2026 01:24
@lsr911

lsr911 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@lsr911

lsr911 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

…und JSON via shared provider helpers

Use readProviderJsonResponse (shared 16 MiB default cap) for HTTP JSON reads.

Co-Authored-By: Claude <[email protected]>
Signed-off-by: lsr911 <[email protected]>
@lsr911
lsr911 force-pushed the fix/batch3-bounded-json branch from 2f94910 to eb26341 Compare June 27, 2026 06:03
@openclaw-barnacle openclaw-barnacle Bot removed the channel: googlechat Channel integration: googlechat label Jun 27, 2026
@lsr911

lsr911 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@lsr911

lsr911 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Closed: not viable to repair. Superseded by cleaner approaches or outside current focus area.

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

Labels

channel: feishu Channel integration: feishu channel: msteams Channel integration: msteams extensions: huggingface merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: blank-template Candidate: PR template appears mostly untouched.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant