Skip to content

fix(tlon): add timeouts to file upload HTTP requests - #102903

Merged
steipete merged 2 commits into
openclaw:mainfrom
chengzhichao-xydt:fix/tlon-upload-timeouts
Jul 15, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
chengzhichao-xydt:fix/tlon-upload-timeouts

Conversation

@chengzhichao-xydt

@chengzhichao-xydt chengzhichao-xydt commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Tlon file delivery made three outbound requests without an owner-level total deadline: Memex upload-URL lookup, Memex upload, and custom-S3 upload. The shared SSRF guard bounds the complete operation only when its caller supplies timeoutMs, so stalled DNS or response work could otherwise outlive delivery indefinitely.

Why This Change Was Made

Pass explicit deadlines through the existing SSRF-safe fetch path at the Tlon owner boundary: 30 seconds for the small upload-URL lookup and 300 seconds for uploads. The five-minute upload limit keeps the operation bounded while allowing realistic headroom for the existing 6 MiB source-media cap.

Direct Undici 8.5.0 source inspection confirmed its defaults are not an equivalent contract: connect timeout is 10 seconds, while header/body timeouts are 300-second idle limits rather than one total DNS-to-body deadline.

User Impact

Tlon uploads now fail predictably when network work stalls, while slow valid uploads retain five minutes to complete.

Evidence

  • Blacksmith Testbox tbx_01kxjvmc4cn3xmqyhkyq2mvmnt: CI=1 pnpm test extensions/tlon/src/tlon-api.test.ts — 15/15 passed.
  • Blacksmith Testbox changed gate: CI=1 ... pnpm check:changed — extension production/tests typechecks, lint, database-first guard, media helper guard, sidecar guard, and import-cycle check passed.
  • Fresh autoreview, local and full branch modes: no findings.
  • Tests assert the exact timeout option on all three request branches: 30 seconds for lookup, 300 seconds for both upload backends.
  • No live Tlon/Memex/custom-S3 credentials were used; HTTP option forwarding and owner-boundary behavior are covered with request mocks.

AI-assisted: This PR was prepared with AI assistance.

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

clawsweeper Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 11:37 AM ET / 15:37 UTC.

Summary
Adds 30s/120s timeout constants to the three Tlon upload guarded fetch calls and updates tests to assert those timeout options.

PR surface: Source +9, Tests +3. Total +12 across 2 files.

Reproducibility: Source-level yes: current main omits timeoutMs on all three Tlon upload guarded fetches, and the PR body now provides loopback terminal proof that forwarding a timeout makes the guarded fetch reject. I did not run a live Tlon/Memex/custom-S3 endpoint repro in this read-only review.

Review metrics: 1 noteworthy metric.

  • Bounded Upload Requests: 1 lookup at 30s, 2 uploads at 120s. These are new hard runtime deadlines on existing user-visible Tlon upload paths, so maintainers should notice the chosen budgets before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

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

Rank-up moves:

  • [P2] Have a Tlon owner or maintainer accept or tune the 30s/120s timeout budgets before merge.

Risk before merge

  • [P1] A 120s hard deadline can fail very slow Tlon/Memex/custom-S3 uploads that previously could wait longer, so maintainers should accept or tune that user-visible tradeoff before merge.

Maintainer options:

  1. Merge With The Proposed Budgets (recommended)
    Accept the compatibility tradeoff that stalled or very slow Tlon uploads now fail after the new 30s/120s deadlines.
  2. Tune The Upload Deadline
    Change the constants and matching assertions before merge if two minutes is too short for expected real Tlon uploads.
  3. Pause For Owner Confirmation
    Keep the PR open until a Tlon owner confirms the deadline policy for both Memex and custom S3 paths.

Next step before merge

  • [P2] No automated code repair is indicated; the remaining action is maintainer acceptance or tuning of the hard Tlon upload timeout budgets.

Maintainer decision needed

  • Question: Should Tlon uploads enforce the proposed 30s Memex URL lookup timeout and 120s upload PUT timeout by default?
  • Rationale: The code path is a narrow bug fix, but the new hard upload deadline intentionally changes behavior for slow networks or large uploads and needs owner acceptance before merge.
  • Likely owner: vincentkoc — vincentkoc has the clearest history on the current owner-local Tlon upload implementation.
  • Options:
    • Accept Proposed Deadlines (recommended): Merge with 30s lookup and 120s upload deadlines after exact-head validation, accepting that very slow uploads now fail fast.
    • Tune Upload Budget First: Ask for a longer upload deadline or separate lookup/upload budgets if Tlon owners expect legitimate uploads to exceed two minutes.
    • Hold For Tlon Owner Review: Pause the PR until a Tlon channel owner confirms the timeout policy for hosted Memex and custom S3 uploads.

Security
Cleared: The diff only adds timeout values to existing guarded fetch calls and test assertions; it does not add dependencies, secrets handling, permissions, or new network targets.

Review details

Best possible solution:

Land the owner-local timeout wiring once maintainers accept the 30s/120s budgets and exact-head checks confirm the focused Tlon upload tests still pass.

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

Source-level yes: current main omits timeoutMs on all three Tlon upload guarded fetches, and the PR body now provides loopback terminal proof that forwarding a timeout makes the guarded fetch reject. I did not run a live Tlon/Memex/custom-S3 endpoint repro in this read-only review.

Is this the best way to solve the issue?

Yes for the code shape: owner-local constants passed through the existing guarded-fetch seam are narrower than changing a global fetch default or adding configuration. The remaining judgment is the timeout budget, not the implementation layer.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes copied terminal output from a local loopback timeout run, which is acceptable non-visual proof for the guarded-fetch timeout behavior; live Tlon credentials were not available.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body now includes copied terminal output from a local loopback timeout run, which is acceptable non-visual proof for the guarded-fetch timeout behavior; live Tlon credentials were not available.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a normal-priority bundled-plugin bug fix for bounded Tlon upload failure behavior with limited blast radius.
  • merge-risk: 🚨 compatibility: The PR changes existing Tlon upload behavior so very slow uploads can fail after a fixed deadline instead of waiting longer.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body now includes copied terminal output from a local loopback timeout run, which is acceptable non-visual proof for the guarded-fetch timeout behavior; live Tlon credentials were not available.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes copied terminal output from a local loopback timeout run, which is acceptable non-visual proof for the guarded-fetch timeout behavior; live Tlon credentials were not available.
Evidence reviewed

PR surface:

Source +9, Tests +3. Total +12 across 2 files.

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

What I checked:

  • Current main Tlon upload behavior: Current main has three Tlon upload fetchWithSsrFGuard calls for the Memex URL lookup, Memex upload PUT, and custom S3 PUT without an explicit timeoutMs, so a stalled server can keep those upload operations waiting on the underlying fetch path. (extensions/tlon/src/tlon-api.ts:238, 3c048ef05297)
  • PR timeout wiring: The PR adds TLON_MEMEX_UPLOAD_URL_TIMEOUT_MS = 30_000 and TLON_UPLOAD_TIMEOUT_MS = 120_000, then forwards them into the Memex lookup, Memex upload PUT, and custom S3 PUT guarded fetch calls. (extensions/tlon/src/tlon-api.ts:256, cb03d5b8c845)
  • PR test coverage: The PR updates the existing Tlon upload tests to assert that the Memex lookup receives 30s and both upload PUT paths receive 120s. (extensions/tlon/src/tlon-api.test.ts:139, cb03d5b8c845)
  • Guarded fetch timeout contract: fetchWithSsrFGuard builds an abort signal from params.timeoutMs and passes the resolved timeout to direct dispatchers, so forwarding timeoutMs is the existing owner-supported seam for bounded HTTP requests. (src/infra/net/fetch-guard.ts:451, 3c048ef05297)
  • Timeout behavior contract: buildTimeoutAbortSignal aborts with a TimeoutError and cleans up the timer through the guarded-fetch release path; existing fetch-guard tests also cover explicit timeout propagation and rejection on timeout. (src/utils/fetch-timeout.ts:108, 3c048ef05297)
  • User-visible Tlon upload surface: The Tlon docs list image upload/download as supported bundled-plugin behavior, so upload hangs affect a documented channel capability. Public docs: docs/channels/tlon.md. (docs/channels/tlon.md:12, 3c048ef05297)

Likely related people:

  • vincentkoc: Commit history shows vincentkoc added the owner-local tlon-api.ts upload implementation and later touched adjacent Tlon upload/runtime paths. (role: Tlon upload path introducer and adjacent owner; confidence: high; commits: ac850e815b08, e085fa1a3ffd; files: extensions/tlon/src/tlon-api.ts, extensions/tlon/src/urbit/upload.ts)
  • arthyn: The large Tlon feature update added the image upload support surface and related upload tests before later internalization/refactors moved the implementation. (role: major Tlon feature contributor; confidence: medium; commits: f4682742d9d1; files: extensions/tlon/src/urbit/upload.ts, extensions/tlon/src/urbit/upload.test.ts, extensions/tlon/src/monitor/media.ts)
  • Pandah97: GitHub commit metadata maps the current blame for extensions/tlon/src/tlon-api.ts to Pandah97, though the commit appears to be a broad re-add rather than Tlon-specific ownership. (role: recent current-main carrier; confidence: low; commits: 0e626690cd5d; files: extensions/tlon/src/tlon-api.ts, extensions/tlon/src/tlon-api.test.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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-09T15:06:27.619Z sha cb03d5b :: needs real behavior proof before merge. :: none

@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 9, 2026
@chengzhichao-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review\n\nAdded loopback timeout proof to the PR body. A hanging local server causes fetchWithSsrFGuard to reject within timeoutMs + 2s when timeoutMs: 500, demonstrating the real timeout behavior.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🧂 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. labels Jul 9, 2026
@steipete steipete self-assigned this Jul 15, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer pass complete. Land-ready at exact head cf0d6c562334bbfddc618e79a41e5046d244c4f9.

Improvement: kept the 30-second Memex lookup deadline and raised both bounded upload deadlines to five minutes, preserving hang protection without making plausible 6 MiB uploads fail too aggressively.

Proof:

  • CI=1 pnpm test extensions/tlon/src/tlon-api.test.ts on Blacksmith Testbox tbx_01kxjvmc4cn3xmqyhkyq2mvmnt: 15/15 passed (run).
  • CI=1 ... pnpm check:changed on the same Testbox: extension production/test typechecks, lint, and changed guards passed.
  • Fresh local and full-branch autoreview: no findings.
  • Exact-head hosted CI gate: green (run).
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 102903: passed for the exact pushed head.

Known gap: no live Tlon/Memex/custom-S3 credentials were used; request-option forwarding and all three owner branches are covered by focused tests.

@steipete
steipete merged commit e58dc09 into openclaw:main Jul 15, 2026
90 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 16, 2026
* fix(tlon): add timeouts to file upload HTTP requests

* fix(tlon): allow slow bounded uploads

---------

Co-authored-by: chengzhichao-xydt <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
* fix(tlon): add timeouts to file upload HTTP requests

* fix(tlon): allow slow bounded uploads

---------

Co-authored-by: chengzhichao-xydt <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
@chengzhichao-xydt
chengzhichao-xydt deleted the fix/tlon-upload-timeouts branch October 30, 2026 08:21
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. 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