Skip to content

fix(server): detect Forgejo remotes by advertised SSH clone URL - #9

Merged
Fryuni merged 1 commit into
mainfrom
t3code/fix-forgejo-remote-hostname-detection
Sep 14, 2026
Merged

Fryuni merged 1 commit into
mainfrom
t3code/fix-forgejo-remote-hostname-detection

Conversation

@Fryuni

@Fryuni Fryuni commented Sep 14, 2026

Copy link
Copy Markdown
Owner

What Changed

When a Forgejo remote is only reachable over SSH, the server now identifies which configured fj login 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, resolveRepository retries listing logins against the raw SSH remote URL before falling back.

Why

An SSH remote like ssh://git@git.example.org/maria/project.git gives 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

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Generated with GLM (glm-5.3-flash) via opencode.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-14T20:41:05.521510Z 28ed72d PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Fryuni
Fryuni merged commit 9a3a7e1 into main Sep 14, 2026
@Fryuni
Fryuni deleted the t3code/fix-forgejo-remote-hostname-detection branch September 14, 2026 20:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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.

1 participant