fix(server): detect Forgejo remotes by advertised SSH clone URL - #9
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28ed72dc3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ? login.name | ||
| : null; | ||
| }, | ||
| Effect.timeout("5 seconds"), |
There was a problem hiding this comment.
Do not expire probes while they wait for authentication
With multiple uncached fj logins, this five-second timeout starts before authenticateFj acquires the shared one-permit authLock. If an earlier login's whoami consumes much of that window, a later candidate—including the actual matching server—can time out while queued and be converted to null, causing the SSH remote to remain undetected and caching that false negative for a minute. Apply the timeout after acquiring the authentication permit, or use an aggregate budget that accounts for the serialized probes.
Useful? React with 👍 / 👎.
What Changed
When a Forgejo remote is only reachable over SSH, the server now identifies which configured
fjlogin owns it by asking each candidate server for the repository and comparing the advertised SSH clone URL against the local remote. A short-lived cache (1 minute TTL, 512 entries) dedupes the probe so discovery and subsequent PR operations share one lookup. If no login matches the provider's base URL,resolveRepositoryretries listing logins against the raw SSH remote URL before falling back.Why
An SSH remote like
ssh://git@git.example.org/maria/project.gitgives no API base URL, so Forgejo repositories hosted on non-default or self-hosted servers were not detected. Matching on a successful repository lookup alone is not evidence: the same owner/repository path can exist on several servers. Comparing the advertised clone URL (host and path) makes the match unambiguous, including rejecting mismatches in path or port.UI Changes
Not applicable — server-side source control detection only.
Checklist
Generated with GLM (glm-5.3-flash) via opencode.