Skip to content

fix(ts-client): reject browser-only downloads early in Node.js - #4982

Merged
enyst merged 2 commits into
OpenHands:mainfrom
RivenZhang01:fix/ts-download-node-guard
Sep 13, 2026
Merged

enyst merged 2 commits into
OpenHands:mainfrom
RivenZhang01:fix/ts-download-node-guard

Conversation

@RivenZhang01

@RivenZhang01 RivenZhang01 commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

HUMAN:

I asked Codex to investigate contribution opportunities and prepare this fix for downloadAndSave() calls in Node.js. Codex implemented and tested the change and drafted this note with my authorization. The validation below was performed by the agent; I am submitting the change for maintainer review.


AGENT:

Why

In Node.js, downloadAndSave() requests the file and creates an object URL before failing because document is undefined.

Summary

  • Reject non-browser calls before downloading and point callers to the existing downloadAsBlob() / downloadAsText() methods.
  • Add @throws documentation and four regression cases.

Issue Number

Fixes #4738.

How to Test

Run npm ci and npm run build in clients/typescript, then node .pr/repro_ts_download.mjs from the repository root. The emitted package returns actionable guidance with zero fetch calls. Client lint, build, formatting, and coverage checks passed: 19 suites / 318 tests. The new test file had one failure before the fix and all four cases pass afterward.

Reproduction and validation · before · after

Video/Screenshots

CLI evidence is linked above; this change has no UI.

Design Doc

Small bug fix; reproduction and compatibility notes are linked above.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

The smoke test uses an in-process fetch fixture; browser coverage uses a DOM test double. No real browser, Docker integration, or Node 22.12/24.x matrix was run locally (Node 26.0.0 used). Lint retains eight existing warnings. No public API or server-contract change.

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🧹 PR Artifact Cleanup Queued

The .pr/ directory reached main after merge. A cleanup PR has been opened or updated: #5020

@RivenZhang01
RivenZhang01 marked this pull request as ready for review September 12, 2026 06:11

@enyst enyst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@enyst

enyst commented Sep 13, 2026

Copy link
Copy Markdown
Member

🐾 Hi @ZZZriven — I'm smolpaws, a little cat agent (built on OpenHands). I'm acting here on Engel Nyst's behalf.

Heads up on what's going on with this PR: one CI run — "Pre-commit checks" (run 34676487235, attempt 2) — is wedged in a queued state with no jobs ever scheduled. It's a known GitHub limbo: because it isn't "in progress," the API refuses cancel, force-cancel, and rerun, and it never emits its check result — so the PR stays BLOCKED even though every other check is green (32 passing).

I can't push a fresh commit to your fork branch (maintainer-edits is off), so to shake it loose I'm going to close and immediately reopen this PR. That re-dispatches the workflows on the same commit — no code change, same SHA — and should replace the stuck run with a fresh one.

Nothing to do on your end; just didn't want a surprise close/reopen notification without a friendly explanation first. 🐾

@enyst enyst closed this Sep 13, 2026
@enyst enyst reopened this Sep 13, 2026
@enyst
enyst merged commit b4a17ce into OpenHands:main Sep 13, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guard downloadAndSave() against Node.js environments (uses browser-only DOM APIs)

2 participants