Skip to content

fix(tlon): add request timeout to media downloads and image uploads - #103199

Closed
wangmiao0668000666 wants to merge 1 commit into
openclaw:mainfrom
wangmiao0668000666:fix/tlon-media-fetch-timeout
Closed

wangmiao0668000666 wants to merge 1 commit into
openclaw:mainfrom
wangmiao0668000666:fix/tlon-media-fetch-timeout

Conversation

@wangmiao0668000666

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Tlon media download helpers (downloadMedia, uploadImageFromUrl) already time out idle chunks via readIdleTimeoutMs (30s) but have no overall request timeout. A remote server that accepts the TCP connection then hangs without sending any data will hold the download open indefinitely.

This is the same gap Alix-007 is systematically fixing across channel extensions (telegram #103020, nodes-camera #103019, qqbot #103018).

Why This Change Was Made

saveRemoteMedia and readRemoteMediaBuffer already support timeoutMs in their options. The helpers just weren't passing it through.

User Impact

Prevents indefinite hangs on Tlon media downloads/uploads when the remote server never responds.

Evidence

  • extensions/tlon/src/monitor/media.ts: downloadMedia() calls saveRemoteMedia/readRemoteMediaBuffer — added timeoutMs: 120_000
  • extensions/tlon/src/urbit/upload.ts: uploadImageFromUrl() calls readRemoteMediaBuffer — added timeoutMs: 120_000
  • Both timeoutMs and readIdleTimeoutMs parallel the structure used by Alix-007's telegram PR fix(telegram): recover when media downloads stall #103020

Change: 8 insertions, 0 deletions across 2 files.

@openclaw-barnacle openclaw-barnacle Bot added channel: tlon Channel integration: tlon size: XS labels Jul 10, 2026
@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 10, 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.

@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@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. labels Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 5:10 AM ET / 09:10 UTC.

Summary
Adds 120-second overall request deadlines to Tlon remote media downloads and URL-backed image uploads.

PR surface: Source +8. Total +8 across 2 files.

Reproducibility: yes. from source with high confidence: both current Tlon fetch paths omit the explicit guarded-request deadline, so their body-idle timeout cannot bound a server that never begins or completes the response.

Review metrics: 1 noteworthy metric.

  • Request deadlines: 2 added. Both Tlon remote-fetch entry points gain a new hard total-duration failure condition that maintainers should calibrate before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until 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:

  • Post redacted controlled stalled-endpoint output showing both Tlon paths reach their established fallback behavior.
  • Obtain owner confirmation for the 120-second total cap or adjust it to the accepted transfer envelope.

Proof guidance:

  • [P1] Needs real behavior proof before merge: No after-fix Tlon run or controlled stalled-endpoint transcript is present; the contributor should post redacted terminal output or logs for both paths, update the PR body to trigger review, and ask a maintainer for @clawsweeper re-review if it does not refresh automatically.

Risk before merge

  • [P1] The shared contract makes timeoutMs a hard deadline for completion of the whole guarded request, so valid slow-but-progressing media transfers can newly fail after 120 seconds.
  • [P2] The PR provides no Tlon-specific after-fix runtime evidence showing that a stalled endpoint terminates through downloadMedia's null result and uploadImageFromUrl's original-URL fallback.

Maintainer options:

  1. Prove and retain 120 seconds (recommended)
    Add Tlon-specific after-fix evidence and obtain owner confirmation that two minutes is the intended maximum total request duration.
  2. Tune the deadline
    Select and prove a longer finite duration that accommodates expected Tlon transfers while still bounding indefinite requests.
  3. Pause for a narrower primitive
    Hold this approach if maintainers want to bound only connection or response-header inactivity without limiting progressing transfers.

Next step before merge

  • [P1] A Tlon owner must confirm the hard total-duration behavior, and the contributor must provide real after-fix proof before merge.

Maintainer decision needed

  • Question: Should Tlon impose a hard 120-second total deadline on remote media fetches, including transfers that are still making progress?
  • Rationale: The shared runtime confirms this setting caps the entire guarded request rather than only connection or response-header inactivity, while the PR does not establish Tlon's acceptable transfer-duration envelope.
  • Likely owner: steipete — This person introduced both affected Tlon paths and is the strongest history-backed owner for their intended request envelope.
  • Options:
    • Keep 120 seconds (recommended): Accept that any Tlon remote-media request still incomplete after two minutes follows its existing failure or fallback path.
    • Choose a longer deadline: Set a finite duration based on expected Tlon media sizes and network conditions while retaining protection from indefinite stalls.
    • Wait for a narrower timeout: Avoid a total transfer cap if the intended product behavior is to bound only connection or response-header inactivity.

Security
Cleared: The patch only passes an existing media-runtime option and introduces no dependency, permission, secret-handling, downloaded-code, or supply-chain execution change.

Review details

Best possible solution:

Keep the finite deadline at these Tlon-owned call sites, but merge only after a Tlon owner confirms the total-duration envelope and redacted controlled-stall evidence demonstrates both established failure/fallback outcomes.

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

Yes, from source with high confidence: both current Tlon fetch paths omit the explicit guarded-request deadline, so their body-idle timeout cannot bound a server that never begins or completes the response.

Is this the best way to solve the issue?

The Tlon call sites are the narrowest maintainable ownership boundary, but the hard two-minute duration is not yet proven to be the safest policy for legitimate transfers.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: The PR addresses a bounded Tlon channel reliability bug without evidence of an urgent widespread outage.
  • add merge-risk: 🚨 compatibility: The shared runtime confirms the new setting caps the complete request, so existing slow-but-progressing transfers can newly fail after 120 seconds.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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: No after-fix Tlon run or controlled stalled-endpoint transcript is present; the contributor should post redacted terminal output or logs for both paths, update the PR body to trigger review, and ask a maintainer for @clawsweeper re-review if it does not refresh automatically.

Label justifications:

  • P2: The PR addresses a bounded Tlon channel reliability bug without evidence of an urgent widespread outage.
  • merge-risk: 🚨 compatibility: The shared runtime confirms the new setting caps the complete request, so existing slow-but-progressing transfers can newly fail after 120 seconds.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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: No after-fix Tlon run or controlled stalled-endpoint transcript is present; the contributor should post redacted terminal output or logs for both paths, update the PR body to trigger review, and ask a maintainer for @clawsweeper re-review if it does not refresh automatically.
Evidence reviewed

PR surface:

Source +8. Total +8 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 8 0 +8
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 2 8 0 +8

What I checked:

  • Download path lacks request deadline: Current main passes a 30-second response-body idle timeout to both saveRemoteMedia and readRemoteMediaBuffer, but no overall timeoutMs. (extensions/tlon/src/monitor/media.ts:70, 6f01c23e712d)
  • Upload path lacks request deadline: Current main likewise fetches URL-backed upload images with only the body-idle timeout and preserves an original-URL fallback on failure. (extensions/tlon/src/urbit/upload.ts:24, 6f01c23e712d)
  • Shared timeout contract: The shared media options define timeoutMs as the deadline for completion of the guarded fetch request, separately from readIdleTimeoutMs, which only protects stalled response-body reads. (src/media/fetch.ts:71, 6f01c23e712d)
  • Patch placement: The PR head adds the existing shared deadline option to the common download options object and the URL-upload fetch call without changing their established error or fallback paths. (extensions/tlon/src/monitor/media.ts:73, 100f8f989e12)
  • Feature provenance: Blame ties the affected current Tlon media helpers to commit 20bc552, authored by Peter Steinberger, making that history the strongest signal for intended transfer behavior. (extensions/tlon/src/urbit/upload.ts:1, 20bc552590b2)
  • No canonical replacement: Live title/body search found no separate Tlon media-timeout PR that supersedes this branch; the referenced QQBot, Telegram, and nodes-camera PRs affect distinct call paths.

Likely related people:

  • steipete: Peter Steinberger authored commit 20bc552, which introduced both affected Tlon media helper paths, and has the strongest contribution history in this plugin area. (role: introduced behavior; confidence: high; commits: 20bc552590b2; files: extensions/tlon/src/monitor/media.ts, extensions/tlon/src/urbit/upload.ts)
  • Vincent Koc: Repository shortlog shows substantial historical contribution to extensions/tlon, making this person a secondary routing candidate for the channel's expected media behavior. (role: adjacent owner; confidence: medium; files: extensions/tlon)
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.

@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

Closing in favor of the canonical PR #103206, which absorbs this branch's Tlon changes.

Decision: close as a subset duplicate.

Why: This branch's two Tlon changes (extensions/tlon/src/monitor/media.ts, extensions/tlon/src/urbit/upload.ts) are byte-identical to the Tlon part of #103206, which ClawSweeper identified as the canonical shared-API candidate for this stall class. #103206 now carries those Tlon changes with:

  • the total deadline aligned to 15 * 60_000 (canonical bounded-media ceiling, matching merged fix(cli): bound node camera URL downloads #103266) instead of 120 s;
  • the two stale exact-match Tlon option assertions fixed (objectContaining + assert the timeoutMs value);
  • a controlled stalled-endpoint test proving the timeout aborts a never-responding fetch and both Tlon fallback paths (downloadMedia -> null, uploadImageFromUrl -> original URL) are reached.

Keeping this separate PR open would only conflict with #103206 on the same two files.

Supported alternative: the agent-tools caller wiring continues in #103209 (rebased to agent-tool-only plus the shared seam, stacked on #103206).

What would change the decision: none expected - the Tlon work is fully covered by #103206. Reopen only if a maintainer wants the Tlon deadline landed independently of the shared seam.

steipete pushed a commit to wangmiao0668000666/openclaw that referenced this pull request Jul 21, 2026
Apply the shared bounded-media ceiling (15 min, matching the canonical precedent
in PR openclaw#103266) to the three agent-tool remote-media callers (image, image-generate,
pdf) via the new REMOTE_MEDIA_TIMEOUT_MS constant, forwarded through loadWebMedia /
loadWebMediaRaw's timeoutMs seam. Bounds endpoints that never respond while
REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS keeps protecting slow-but-progressing transfers.

This branch includes the WebMediaOptions.timeoutMs seam so it typechecks and stays
green as a standalone fork PR; it reduces to agent-tool-only once the canonical
seam+Tlon PR openclaw#103206 lands. The Tlon caller changes live in openclaw#103206 (the earlier
openclaw#103199 is closed as a subset).

- src/agents/tools/media-tool-shared.ts: export REMOTE_MEDIA_TIMEOUT_MS = 15*60_000.
- image-tool / image-generate-tool / pdf-tool: pass timeoutMs on remote (http) loads.
- src/media/web-media.ts: forward timeoutMs (shared seam; see openclaw#103206).
- tests: assert timeoutMs forwarding for all three agent tools.

Co-Authored-By: Claude <[email protected]>
steipete added a commit that referenced this pull request Jul 21, 2026
* fix(agent-tools): bound remote media fetches with a 15-min total timeout

Apply the shared bounded-media ceiling (15 min, matching the canonical precedent
in PR #103266) to the three agent-tool remote-media callers (image, image-generate,
pdf) via the new REMOTE_MEDIA_TIMEOUT_MS constant, forwarded through loadWebMedia /
loadWebMediaRaw's timeoutMs seam. Bounds endpoints that never respond while
REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS keeps protecting slow-but-progressing transfers.

This branch includes the WebMediaOptions.timeoutMs seam so it typechecks and stays
green as a standalone fork PR; it reduces to agent-tool-only once the canonical
seam+Tlon PR #103206 lands. The Tlon caller changes live in #103206 (the earlier
#103199 is closed as a subset).

- src/agents/tools/media-tool-shared.ts: export REMOTE_MEDIA_TIMEOUT_MS = 15*60_000.
- image-tool / image-generate-tool / pdf-tool: pass timeoutMs on remote (http) loads.
- src/media/web-media.ts: forward timeoutMs (shared seam; see #103206).
- tests: assert timeoutMs forwarding for all three agent tools.

Co-Authored-By: Claude <[email protected]>

* fix(agent-tools): adopt canonical responseHeaderTimeoutMs seam from main

* test(agent-tools): cover media header deadlines

Lock the existing image, image-generation, and PDF remote-media call sites to the proposed header-only deadline and remove the PR-only proof script.\n\nCo-authored-by: wangmiao0668000666 <[email protected]>

* style: oxfmt

* fix(media): default stalled header deadline

Co-authored-by: wangmiao0668000666 <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 22, 2026
* fix(agent-tools): bound remote media fetches with a 15-min total timeout

Apply the shared bounded-media ceiling (15 min, matching the canonical precedent
in PR openclaw#103266) to the three agent-tool remote-media callers (image, image-generate,
pdf) via the new REMOTE_MEDIA_TIMEOUT_MS constant, forwarded through loadWebMedia /
loadWebMediaRaw's timeoutMs seam. Bounds endpoints that never respond while
REMOTE_MEDIA_READ_IDLE_TIMEOUT_MS keeps protecting slow-but-progressing transfers.

This branch includes the WebMediaOptions.timeoutMs seam so it typechecks and stays
green as a standalone fork PR; it reduces to agent-tool-only once the canonical
seam+Tlon PR openclaw#103206 lands. The Tlon caller changes live in openclaw#103206 (the earlier
openclaw#103199 is closed as a subset).

- src/agents/tools/media-tool-shared.ts: export REMOTE_MEDIA_TIMEOUT_MS = 15*60_000.
- image-tool / image-generate-tool / pdf-tool: pass timeoutMs on remote (http) loads.
- src/media/web-media.ts: forward timeoutMs (shared seam; see openclaw#103206).
- tests: assert timeoutMs forwarding for all three agent tools.

Co-Authored-By: Claude <[email protected]>

* fix(agent-tools): adopt canonical responseHeaderTimeoutMs seam from main

* test(agent-tools): cover media header deadlines

Lock the existing image, image-generation, and PDF remote-media call sites to the proposed header-only deadline and remove the PR-only proof script.\n\nCo-authored-by: wangmiao0668000666 <[email protected]>

* style: oxfmt

* fix(media): default stalled header deadline

Co-authored-by: wangmiao0668000666 <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
@wangmiao0668000666
wangmiao0668000666 deleted the fix/tlon-media-fetch-timeout branch October 28, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: tlon Channel integration: tlon merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant