Skip to content

fix(apns): cancel redirect relay response body before returning - #109728

Merged
steipete merged 2 commits into
openclaw:mainfrom
Monkey-wusky:fix/apns-cancel-redirect-body
Jul 17, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
Monkey-wusky:fix/apns-cancel-redirect-body

Conversation

@Monkey-wusky

Copy link
Copy Markdown
Contributor

What Problem This Solves

sendApnsRelayRequest returns early when the relay responds with a 3xx redirect (relay redirects are not followed — grants and signatures are scoped to the configured relay origin). The response body was left unconsumed, keeping the underlying connection open until GC.

Why This Change Was Made

Follows the same pattern as #109519 (Google Chat), #109508 (docs), #109525 (ClawRouter), and #109701 (MS Teams file consent) — cancel the response body before returning on non-OK paths.

User Impact

No user-facing change. Prevents a minor resource leak when the APNs relay returns an unexpected redirect response.

Evidence

$ npx vitest run src/infra/push-apns.relay.test.ts

 Test Files  1 passed (1)
      Tests  23 passed (23)

New test ("cancels a redirect relay response body before returning"):

  • A real Response with status 307 is returned by the fetch stub
  • response.body.cancel() is verified to be called exactly once before returning
  • The result still carries the correct status and reason

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 2:54 AM ET / 06:54 UTC.

Summary
The PR cancels an APNs relay redirect response body before returning the existing redirect-denied result and adds a focused regression test.

PR surface: Source +1, Tests +14. Total +15 across 2 files.

Reproducibility: no. there is not yet a high-confidence live reproduction. Source inspection and the mocked-fetch test establish the unread redirect-body path, but they do not exercise a real HTTP connection.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup 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 redacted terminal or log evidence from repeated requests to a real local relay that returns 307, showing the redirect result and stable connection/resource behavior.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Only mocked-fetch unit output is provided; add redacted terminal or log proof from a real local HTTP relay returning 307, then update the PR body to trigger review or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] The mocked test proves the cancellation call but not the claimed real Undici connection or resource behavior across an actual HTTP redirect response.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the cleanup in the APNs relay request owner, retain the focused regression test, and add redacted terminal proof from a real local relay returning redirects repeatedly without accumulating open resources.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Keep merge blocked for contributor-supplied real network proof; there is no concrete code repair for ClawSweeper to perform.

Security
Cleared: The patch preserves the fail-closed relay redirect policy and only releases an unread response stream; it adds no credential, permission, dependency, or supply-chain exposure.

Review details

Best possible solution:

Keep the cleanup in the APNs relay request owner, retain the focused regression test, and add redacted terminal proof from a real local relay returning redirects repeatedly without accumulating open resources.

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

No, there is not yet a high-confidence live reproduction. Source inspection and the mocked-fetch test establish the unread redirect-body path, but they do not exercise a real HTTP connection.

Is this the best way to solve the issue?

Yes, this is the narrowest maintainable fix: the APNs relay owner should release the redirect response before its existing early return, rather than introducing a broader fetch wrapper or changing redirect policy.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P3: This is a narrow, low-risk resource-lifecycle cleanup for an unexpected redirect path with no reported user-visible failure.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only mocked-fetch unit output is provided; add redacted terminal or log proof from a real local HTTP relay returning 307, then update the PR body to trigger review or ask a maintainer to comment @clawsweeper re-review.

Label justifications:

  • P3: This is a narrow, low-risk resource-lifecycle cleanup for an unexpected redirect path with no reported user-visible failure.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only mocked-fetch unit output is provided; add redacted terminal or log proof from a real local HTTP relay returning 307, then update the PR body to trigger review or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +1, Tests +14. Total +15 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 0 +1
Tests 1 14 0 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 15 0 +15

What I checked:

Likely related people:

  • Monkey-wusky: They authored the merged docs, Google Chat, and ClawRouter response-body cleanup changes that establish the same current-main lifecycle invariant beyond this proposed APNs patch. (role: recent sibling-surface contributor; confidence: high; commits: a8fd558d6210, b98b8e7313ff, ea6ed38e20b9)
  • steipete: Recent repository history and documentation connect them to the gateway and iOS APNs relay feature surface, making them a useful routing candidate for relay-specific behavior. (role: adjacent feature owner; confidence: medium; files: docs/gateway/configuration.md, docs/platforms/ios.md, src/infra/push-apns.relay.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.

@steipete
steipete merged commit 065223c into openclaw:main Jul 17, 2026
111 of 112 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 18, 2026
…claw#109728)

* fix(apns): cancel redirect relay response body before returning

* test: fold APNS redirect body cleanup proof

Co-authored-by: 毛宇豪0668001457 <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
@Monkey-wusky
Monkey-wusky deleted the fix/apns-cancel-redirect-body branch July 30, 2026 05:44
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…claw#109728)

* fix(apns): cancel redirect relay response body before returning

* test: fold APNS redirect body cleanup proof

Co-authored-by: 毛宇豪0668001457 <[email protected]>

---------

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

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants