Skip to content

fix(sdk): parse file:// URLs instead of slicing the scheme off - #6482

Merged
VascoSch92 merged 2 commits into
OpenHands:mainfrom
yftx293:fix/file-url-parsing
Nov 6, 2026
Merged

VascoSch92 merged 2 commits into
OpenHands:mainfrom
yftx293:fix/file-url-parsing

Conversation

@yftx293

@yftx293 yftx293 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

HUMAN:

Fixed file:// source resolution from #6348. I reviewed the diff and the tests; a file URL names a path, not a string to slice.


AGENT:

Why

resolve_source_path handled file:// by slicing the scheme off (Path(source[7:])). Two valid spellings broke:

  • file://localhost/tmp/skill became the relative path localhost/tmp/skill, because the authority segment was treated as a path component.
  • file:///tmp/my%20skill kept the escape, so the resolved path pointed at a directory literally named my%20skill instead of my skill.

Summary

  • Parse the URL with urlparse and take its path, decoding percent-escapes with unquote; an empty or localhost authority is dropped, and any other authority is preserved as a UNC-style prefix.
  • Port the pinned tests test_resolve_file_url_with_localhost_authority and test_resolve_file_url_decodes_percent_escapes from the worktree-test-edge-cases branch (commit f2fcf6e) without their xfail(strict=True) markers, per the [Bug]: Edge-case tests expose ~70 bugs across the SDK, agent server, tools and workspaces #6348 menu's acceptance criteria.

Issue Number

Part of #6348 (menu sub-items: "file:// URLs are sliced instead of parsed, so the 'localhost' authority becomes a relative path component" and "... so percent-escapes such as %20 are not decoded")

How to Test

uv run pytest tests/sdk/plugin/test_source.py -k file_url

Before this change both new cases fail (WindowsPath('/tmp/my%20skill'), and localhost/... as a relative path); after, all three file_url cases pass. tests/sdk/plugin/ is 384 passed, with five pre-existing network/git-dependent failures that fail the same way on unpatched main. ruff check/format on the touched files are clean.

Type

  • Bug fix

Notes

file:///tmp/skill resolves exactly as before.

@yftx293

yftx293 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

The integration-test failure here is infrastructure, not this change: the agent-server image build hit 504 Gateway Timeout fetching dmsetup from snapshot.debian.org (E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?), so buildx failed before any test ran. Every other check on this PR is green.

Could a maintainer re-run the failed job once the mirror is healthy? Nothing in the diff touches the image or its dependencies.

@VascoSch92 VascoSch92 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.

lgtm

@VascoSch92
VascoSch92 merged commit 7920bb3 into OpenHands:main Nov 6, 2026
37 of 38 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.

2 participants