cloud-tasks: support Forgejo/Gitea remotes in by-repo environment detection

Resolved 💬 1 comment Opened Mar 9, 2026 by tfiala Closed May 10, 2026

Codex CLI currently misses PR/footer context for Forgejo/Gitea repos because by-repo environment detection is GitHub-only.

Observed behavior

  • In repos with origin like https://git.home.invezt.io/<owner>/<repo> (Forgejo), Codex does not resolve repo context and PR/footer indicators are absent.
  • Same workflow in github.com repos works.

Root cause

  • codex-rs/cloud-tasks/src/env_detect.rs hardcodes GitHub parsing and provider routing:
  • only parses github.com remote formats
  • hardcodes .../by-repo/github/<owner>/<repo>

Proposed fix

  • Parse generic repo refs from HTTPS + SSH forms into host/owner/repo.
  • For non-GitHub hosts, try provider fallbacks in this order:

1) forgejo
2) gitea
3) github

  • Preserve current GitHub behavior: host github.com uses only provider github.

Patch available

What this patch changes

  • Adds RepoRef { host, owner, repo } parser.
  • Replaces GitHub-only parse_owner_repo logic with generic parse_repo_ref.
  • Adds provider_candidates_for_host and uses it in both:
  • autodetect_environment_id
  • list_environments
  • Adds unit tests for:
  • GitHub HTTPS + SSH SCP parsing
  • Forgejo HTTPS + SSH URL parsing
  • invalid remote rejection
  • provider-candidate selection

Validation run

  • cargo test -p codex-cloud-tasks env_detect -- --nocapture
  • Result: 7 env_detect tests passed.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗