Skip to content

fix(extensions): avoid duplicate .git suffix in GitHub shorthand - #4524

Closed
onatozmenn wants to merge 4 commits into
OpenHands:mainfrom
onatozmenn:fix/github-shorthand-git-suffix
Closed

onatozmenn wants to merge 4 commits into
OpenHands:mainfrom
onatozmenn:fix/github-shorthand-git-suffix

Conversation

@onatozmenn

@onatozmenn onatozmenn commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

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.git currently becomes https://github.com/owner/repo.git.git, so extension fetching tries the wrong clone URL.

Summary

  • Pass the expanded GitHub shorthand through normalize_git_url instead of appending .git directly.
  • Cover an already-suffixed shorthand while keeping the existing shorthand and full URL behavior unchanged.

Issue Number

Fixes #4520

How to Test

Invoked the parser directly with this checkout on PYTHONPATH:

main:   https://github.com/owner/repo.git.git
branch: https://github.com/owner/repo.git

Then ran:

python -m pytest tests/sdk/extensions/test_fetch.py -q
42 passed

Ruff format, Ruff lint, pycodestyle, import rules, tool registration, and git diff --check also pass for the changed files.

Video/Screenshots

Not applicable for this parser-only change.

Design Doc

Not needed for this small bug fix.

Type

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

Notes

The existing shorthand format checks are unchanged.

Signed-off-by: onatozmenn <onatozmen44@gmail.com>
@onatozmenn
onatozmenn marked this pull request as ready for review August 18, 2026 09:09
@all-hands-bot

Copy link
Copy Markdown
Collaborator

🤖 OpenHands is reviewing this PR.

Head commit: 3a138c5566a340ddc1a1425d3ae0c369845c920f
View the conversation: https://oss-agent-canvas.ngrok.dev/conversations/970f827e-66cb-46f5-80bc-7a7585a8b70f

This comment was posted by an AI agent (OpenHands).

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copilot AI lite review requested due to automatic review settings September 26, 2026 14:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.py is 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_source directly:
    • github:owner/repo.git: base https://github.com/owner/repo.git.git -> head https://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 with ExtensionFetchError; 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

@onatozmenn

Copy link
Copy Markdown
Contributor Author

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 all-hands-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.py is SDK-owned extension parsing, and the linked issue #4520 (closed, labels bug, 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_source directly:
    • github:owner/repo.git: base https://github.com/owner/repo.git.git -> head https://github.com/owner/repo.git (fixed)
    • github:owner/repo.git/ and github: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 raise ExtensionFetchError; 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

@onatozmenn

Copy link
Copy Markdown
Contributor Author

@enyst small parser fix for the github:owner/repo.git shorthand: it no longer appends a second .git. CI is green and the PR is merge-ready. Could you take a look when you have a moment?

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>
@onatozmenn

Copy link
Copy Markdown
Contributor Author

Closing this as superseded — the same bug is already fixed on main by #6379 (merged 2026-11-02), which drops an existing .git suffix in the GitHub shorthand (repo.removesuffix('.git')) and adds the equivalent test_parse_github_shorthand_with_git_suffix regression test.

I refreshed the branch against the current main to clear the conflict, which confirms there is no remaining diff: github:owner/repo.git now parses to https://github.com/owner/repo.git via the code that is already in main.

Thanks for the detailed report and the clean reproducer in #4520 — that analysis is what made the parser behavior easy to verify.

@onatozmenn onatozmenn closed this Nov 3, 2026
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.

[Bug]: parse_extension_source duplicates an existing .git suffix in GitHub shorthand

3 participants