Skip to content

gstack-global-discover does not dedupe ssh:// git remotes #975

@officialasishkumar

Description

@officialasishkumar

Summary

gstack-global-discover normalizes scp-style git remotes like git@github.com:owner/repo.git to https://github.com/owner/repo, but it leaves the equally valid ssh://git@github.com/owner/repo.git form as ssh://git@github.com/owner/repo.

That means /retro global and other global discovery consumers can report the same repository twice when one AI tool session ran in a clone using scp-style SSH and another ran in a clone using ssh:// SSH.

Repro

Run the normalizer on the two equivalent GitHub remotes:

bun -e "import { normalizeRemoteUrl } from './bin/gstack-global-discover.ts'; console.log(normalizeRemoteUrl('git@github.com:garrytan/gstack.git')); console.log(normalizeRemoteUrl('ssh://git@github.com/garrytan/gstack.git'));"

Current output:

https://github.com/garrytan/gstack
ssh://git@github.com/garrytan/gstack

Expected

Both valid SSH forms normalize to the same canonical remote:

https://github.com/garrytan/gstack
https://github.com/garrytan/gstack

Root cause

normalizeRemoteUrl() only handles scp-style SSH remotes with this pattern:

/^(?:ssh:\/\/)?git@([^:]+):(.+)$/

That pattern requires a colon after the host, so it misses standard URL-style SSH remotes where the owner/repo path follows a slash.

Suggested fix

Parse ssh:// remotes with URL, convert ssh://git@host/owner/repo.git to the same https://host/owner/repo form, and add regression coverage so scp-style SSH, URL-style SSH, and HTTPS all dedupe together.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions