Repository navigation
fix(extensions): avoid duplicate .git suffix in GitHub shorthand - #4524
onatozmenn wants to merge 4 commits into
Conversation
Signed-off-by: onatozmenn <onatozmen44@gmail.com>
|
🤖 OpenHands is reviewing this PR. Head commit: This comment was posted by an AI agent (OpenHands). |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was created by an AI agent (OpenHands) on behalf of the repository maintainers.
Summary
This is a clean, minimal bug fix. Routing the GitHub shorthand expansion through normalize_git_url (instead of unconditionally appending .git) correctly resolves the duplicate-suffix case (github:owner/repo.git -> https://github.com/owner/repo.git.git) while preserving the existing behavior for the bare shorthand (github:owner/repo -> https://github.com/owner/repo.git).
normalize_git_url already guards against re-adding .git when the URL ends with it, and only applies to https:///http:// URLs, so the fix is safe and idiomatic — it reuses the same normalization path already used for full git URLs a few lines below.
Findings
No material issues found. The new test covers the fixed case, and existing shorthand/full-URL behavior is unchanged.
Risk Assessment
Low. Parser-only change with no security, persistence, or API-surface impact. The behavior change is strictly a bug fix on an edge case.
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Summary
The fix is correct and minimal. parse_extension_source now routes the expanded GitHub shorthand through normalize_git_url instead of unconditionally appending .git, which is the same normalization already applied to full git URLs a few lines below. normalize_git_url skips adding .git when the URL already ends in it, so the duplicate-suffix case is resolved without changing any other path.
Verification
- Scope: the change belongs in this repository;
openhands-sdk/openhands/sdk/extensions/fetch.pyis SDK-owned extension parsing, and the linked issue #4520 (closed,bug/sdk/ready-for-dev) is the parser bug being fixed. - Base vs head on the current checkout, calling
parse_extension_sourcedirectly:github:owner/repo.git: basehttps://github.com/owner/repo.git.git-> headhttps://github.com/owner/repo.git(fixed)github:owner/repo: unchanged (https://github.com/owner/repo.git)https://github.com/owner/repo/...repo.git: unchanged (SourceType.GIT,https://github.com/owner/repo.git)github:owner/repo/still rejected withExtensionFetchError; shorthand format validation is untouched
- Focused tests on the current head:
uv run --frozen pytest tests/sdk/extensions/test_fetch.py -q->48 passed. The added test covers the already-suffixed shorthand. - CI for head
8448173bc11fd3f329d7483282822607ee3abba5: all check runs completed successfully (no failures; skipped entries are publish/cleanup jobs gated on merge).
Findings
No material correctness, security, or compatibility issues found. The change is confined to a parser edge case with no public API, persistence, or serialization impact.
✅ APPROVED
|
Hi, this is ready on my side and CI is green. Could someone from the team take a look when you have time? Happy to address any feedback. |
…git-suffix # Conflicts: # openhands-sdk/openhands/sdk/extensions/fetch.py
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Summary
The fix is correct and minimal. parse_extension_source now routes the expanded GitHub shorthand through normalize_git_url instead of unconditionally appending .git, reusing the same normalization already applied to full git URLs a few lines below. normalize_git_url skips adding .git when the URL already ends in it, so the duplicate-suffix case is resolved without changing any other path.
Verification
- Scope: this belongs in this repository.
openhands-sdk/openhands/sdk/extensions/fetch.pyis SDK-owned extension parsing, and the linked issue #4520 (closed, labelsbug,sdk,ready-for-dev,priority:low) is exactly the parser bug being fixed. No cross-repository boundary is crossed. - Base vs head on the current checkout, calling
parse_extension_sourcedirectly:github:owner/repo.git: basehttps://github.com/owner/repo.git.git-> headhttps://github.com/owner/repo.git(fixed)github:owner/repo.git/andgithub:owner/repo.git/sub: base...repo.git.git-> head...repo.git(fixed)github:owner/repo,github:owner/repo/,github:owner/repo/sub/dir: unchanged (https://github.com/owner/repo.git)https://github.com/owner/repo/...repo.git: unchanged (SourceType.GIT,https://github.com/owner/repo.git)- Invalid shorthands (
github:invalid,github:/repo,github:owner/) still raiseExtensionFetchError; validation is untouched.
- Focused tests on the current head:
uv run --frozen pytest tests/sdk/extensions/test_fetch.py -q->57 passed. The added test covers the already-suffixed shorthand. - CI for head
d20ef5ce013209e65ef7e129c65bf9d3681f4418: all check runs completed successfully (no failures; the skipped entries are publish/cleanup jobs gated on merge).
Findings
No material correctness, security, or compatibility issues found. The change is confined to a parser edge case with no public API, persistence, or serialization impact.
✅ APPROVED
|
@enyst small parser fix for the |
Keep main's .git suffix handling from OpenHands#6379 in parse_extension_source and drop the duplicate shorthand test, since both already landed on main. Co-authored-by: openhands <openhands@all-hands.dev>
|
Closing this as superseded — the same bug is already fixed on I refreshed the branch against the current Thanks for the detailed report and the clean reproducer in #4520 — that analysis is what made the parser behavior easy to verify. |
HUMAN:
I fixed the GitHub shorthand parsing so URLs that already end in .git no longer get an extra .git appended.
AGENT:
Why
github:owner/repo.gitcurrently becomeshttps://github.com/owner/repo.git.git, so extension fetching tries the wrong clone URL.Summary
normalize_git_urlinstead of appending.gitdirectly.Issue Number
Fixes #4520
How to Test
Invoked the parser directly with this checkout on
PYTHONPATH:Then ran:
Ruff format, Ruff lint, pycodestyle, import rules, tool registration, and
git diff --checkalso pass for the changed files.Video/Screenshots
Not applicable for this parser-only change.
Design Doc
Not needed for this small bug fix.
Type
Notes
The existing shorthand format checks are unchanged.