Skip to content

fix(sms): retry stalled MMS response bodies - #119002

Merged
vincentkoc merged 1 commit into
mainfrom
fix/pr-118994-network-parity
Aug 3, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/pr-118994-network-parity

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

Related: #118994

What Problem This Solves

Fixes an issue where an inbound Twilio MMS could still lose its attachment when the remote media server sent response headers and then stalled. The default response-body timeout was emitted as a plain Error, so the transient retry policy added by #118994 did not recognize the failure and the durable sender lane treated it as permanent.

Why This Change Was Made

The default response-body idle and overall deadlines now identify themselves as TimeoutError, and media retries use the same nested transient-network classifier as the gateway process boundary. SMS keeps an explicit fail-closed SSRF veto over the complete wrapper and aggregate error graph before applying that shared policy.

The generic classifier moved into the lightweight retry runtime rather than pulling process-level fatal-handler dependencies into plugin code. Existing imports from the old owner remain supported.

SDK Contract Decision

plugin-sdk/retry-runtime remains a private-local subpath for bundled and official plugins. This change reuses that existing internal seam; it does not promote isTransientNetworkError to the documented public plugin SDK or create an external compatibility promise. The public SDK surface baseline remains unchanged.

User Impact

Operators can expect stalled or temporarily unreachable Twilio MMS downloads to stay in the existing durable retry lane instead of permanently degrading an acknowledged callback. Permanent HTTP, size, storage, and SSRF failures remain non-retryable and visible.

Evidence

  • node scripts/run-vitest.mjs src/infra/errors.test.ts src/infra/http-body.response.test.ts src/media/fetch.test.ts extensions/sms/src/media.test.ts extensions/sms/src/ingress-spool.test.ts
    • 5 files, 254 tests passed across four repository shards.
  • node scripts/run-vitest.mjs src/infra/errors.test.ts src/infra/unhandled-rejections.test.ts src/infra/http-body.response.test.ts src/media/fetch.test.ts
    • 180 shared infra/media tests passed.
  • node scripts/run-vitest.mjs extensions/sms/src/media.test.ts extensions/sms/src/ingress-spool.test.ts
    • 128 SMS tests passed.
  • pnpm plugin-sdk:surface:check
    • 322 entrypoints checked; public API baseline passed.
  • Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/30860707915
    • openclaw/ci-gate, build, SDK/API, import-topology, lint, type, and focused channel lanes passed for 9e0517295e619cdc7e77cebc15126fa4b6365317.
  • Isolated publishable SMS runtime import profile against the exact CI-built host artifact
    • SMS descriptor import passed.
    • Full channel-plugin-api import passed.
    • Five alternating parent/head runs produced median peak RSS of 446.69 MB at parent 6194cfdfb2fa and 444.41 MB at head 9e0517295e61; the private retry-runtime seam adds no observable import-graph cost.
  • git diff --check
    • passed.
  • Repository autoreview on origin/main..HEAD
    • clean, no accepted/actionable findings; confidence 0.98.

AI-assisted: yes. The maintainer reviewed the implementation and validation evidence.

@vincentkoc vincentkoc self-assigned this Aug 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: sms Channel integration: sms size: L maintainer Maintainer-authored PR labels Aug 3, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 3, 2026 22:59
@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 7:06 PM ET / 23:06 UTC.

ClawSweeper review

What this changes

The PR labels default stalled response-body errors as timeouts and reuses the shared transient-network classifier so Twilio MMS downloads return to the durable retry lane.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. This active maintainer PR fixes a real remaining MMS retry gap on current main; no blocking correctness defect was found, but the added retry-runtime export needs explicit SDK-contract confirmation before merge.

Priority: P2
Reviewed head: 9e0517295e619cdc7e77cebc15126fa4b6365317
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The repair is coherent and covered at the affected layers; a maintainer API-contract decision is the remaining merge-risk reducer.
Proof confidence 🌊 off-meta tidepool Not applicable: This repository-member PR is exempt from the external-contributor real-behavior-proof gate; its stated focused validation is consistent with the inspected coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This repository-member PR is exempt from the external-contributor real-behavior-proof gate; its stated focused validation is consistent with the inspected coverage.
Evidence reviewed 5 items Current-main gap: Current main still creates default idle and overall response-body timeouts as plain Error values, while SMS only recognizes timeout names or narrow error codes.
SMS owner boundary: The branch assigns the timeout identity at its producer, retains the SMS full-graph SSRF veto, and only then applies the shared transient classifier before durable adoption.
Focused regression coverage: Branch tests cover default idle and overall timeout identities, retry after a stalled body, nested and aggregate network failures, and nested SSRF vetoes.
Findings None None.
Security None None.

How this fits together

Inbound Twilio MMS media is fetched before the SMS event is durably adopted. The SMS plugin classifies fetch failures to either show an unavailable-attachment notice or let the durable sender retry the callback.

flowchart LR
  A[Twilio MMS callback] --> B[SMS media fetch]
  B --> C[Response body read]
  C --> D[Transient error classifier]
  D --> E{SSRF or permanent failure?}
  E -->|yes| F[Attachment unavailable notice]
  E -->|no| G[Durable sender retry]
  G --> H[Attachment delivered]
Loading

Decision needed

Question Recommendation
Should isTransientNetworkError be a documented supported export from plugin-sdk/retry-runtime, or remain private-local to bundled plugins? Document the supported classifier contract: Accept the generic export and clarify its intended retry semantics and support scope in the SDK subpath documentation.

Why: This is an additive public SDK symbol whose long-term support scope cannot be safely inferred from the implementation alone.

Before merge

  • Resolve merge risk (P1) - Merging adds isTransientNetworkError to the existing plugin SDK retry-runtime surface; external plugins could begin relying on its broad retry semantics unless maintainers confirm and document that contract.
Agent review details

Security

None.

PR surface

Source +13, Tests +163. Total +176 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 7 179 166 +13
Tests 4 163 0 +163
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 342 166 +176

Review metrics

Metric Value Why it matters
Production versus tests production +179/-166, tests +163/-0 The small net production increase centralizes an existing process-level classifier while adding focused timeout, media, and SMS regression coverage.

Merge-risk options

Maintainer options:

  1. Confirm and document the SDK contract (recommended)
    Before merge, state whether external plugins may depend on the new classifier and align the retry-runtime documentation with that decision.
  2. Keep the helper bundle-private
    If the classifier should not become a supported plugin API, replace the export with an appropriate internal mechanism and preserve the SMS behavior.

Technical review

Best possible solution:

Keep timeout identity at the response-body owner, retain the SMS SSRF veto at the SMS owner, and explicitly define the retry-runtime classifier’s supported plugin-contract scope.

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

Yes: current main emits a plain default response-body Error at the timeout producer, and the current SMS retry predicate cannot recognize that error as transient; the branch supplies focused stalling-stream coverage.

Is this the best way to solve the issue?

Yes for the bug boundary: timeout identity belongs at the response-body owner and SMS retains its SSRF decision; the remaining question is the intended public SDK scope of the shared classifier.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The change repairs a bounded but user-visible SMS MMS attachment reliability failure.
  • add merge-risk: 🚨 compatibility: The branch adds a new generic export to the existing plugin SDK retry-runtime surface.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This repository-member PR is exempt from the external-contributor real-behavior-proof gate; its stated focused validation is consistent with the inspected coverage.

Label justifications:

  • P2: The change repairs a bounded but user-visible SMS MMS attachment reliability failure.
  • merge-risk: 🚨 compatibility: The branch adds a new generic export to the existing plugin SDK retry-runtime surface.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This repository-member PR is exempt from the external-contributor real-behavior-proof gate; its stated focused validation is consistent with the inspected coverage.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Introduced the Twilio MMS feature and authored this follow-up repair. (role: SMS feature author and recent area contributor; confidence: high; commits: 554a6f3bbf6d, 9e0517295e61; files: extensions/sms/src/media.ts, extensions/sms/src/media.test.ts)
  • steipete: Authored the merged SMS durable-media retry repair that this PR extends. (role: durable retry predecessor author; confidence: high; commits: 6194cfdfb2fa; files: extensions/sms/src/media.ts, extensions/sms/src/ingress-spool.ts)
  • Peter Lee: Earlier history ties this person to transient-network retry alignment used by the extracted shared classifier. (role: shared retry-policy contributor; confidence: medium; commits: fee89ff4cb0b; files: src/infra/retryable-network-errors.ts, src/infra/unhandled-rejections.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm and document the intended support scope of the new retry-runtime export.

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.

@vincentkoc
vincentkoc merged commit d38f680 into main Aug 3, 2026
197 of 207 checks passed
@vincentkoc
vincentkoc deleted the fix/pr-118994-network-parity branch August 3, 2026 23:29
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit to clawSean/openclaw that referenced this pull request Aug 3, 2026
* origin/main: (1301 commits)
  fix(sms): align MMS retries with network timeouts (openclaw#119002)
  test(qa): cover composed tool result consumption (openclaw#118991)
  test(cron): cover delivery outcomes (openclaw#118993)
  test(qa): cover guarded media fetch boundaries (openclaw#118857)
  test(qa): cover music generation controls (openclaw#118901)
  test(qa): cover core vision routing (openclaw#118861)
  test(qa): cover Gateway usage and memory APIs (openclaw#118995)
  fix(docker): use authenticated gateway health command (openclaw#118996)
  test(plugins): align tool fixtures with owner policy (openclaw#118959)
  test(qa): cover managed gateway service lifecycle (openclaw#118855)
  test(qa): cover audio proxy and limit handling (openclaw#118863)
  test(qa): cover PDF extraction dispatch (openclaw#118860)
  test(ui): add service-worker update primary QA proof (openclaw#118805)
  test(qa): cover CLI onboarding and plugin install sources (openclaw#118882)
  test(qa): cover remote logging boundaries (openclaw#118951)
  fix(sms): retry transient MMS failures before durable adoption (openclaw#118994)
  test(qa): cover video generation invocation (openclaw#118864)
  test(qa): cover media reference intake (openclaw#118858)
  test(qa): cover image generation task lifecycle (openclaw#118915)
  feat(sms): track Twilio delivery status (openclaw#118665)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: sms Channel integration: sms maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

1 participant