fix(git-tools): auto-detect Gitea --login from repo origin host (USC repos fail with default mosaicstack login) #560

Closed
opened 2026-06-20 09:26:09 +00:00 by jason.woltje · 0 comments
Owner

Problem

The Mosaic git wrappers (~/.config/mosaic/tools/git/*.sh — issue-create, issue-close, pr-create, pr-merge) default to --login ${GITEA_LOGIN:-mosaicstack}. This login profile only exists for the mosaicstack Gitea (git.mosaicstack.dev). On USC repos (git.uscllc.com, e.g. usc/uconnect, usc/infrastructure) the bare wrapper call fails:

  • issue-close / issue-create: gitea / Error: GetUserByName (login mosaicstack does not exist on the USC host)
  • pr-merge: silent HTTP 404 not found — a wrong-repo target, not an auth error (most dangerous: looks like the PR/issue doesn't exist)

Evidence

Repeatedly hit across the fleet and documented in OpenBrain (4 separate captures, latest 2026-06-19):

  • uconnect #2059 (2026-05-31), #2366 merge (2026-06-13), #2494 close (2026-06-18)
  • The nightly enhance pass itself hit this when listing/creating USC issues this session.

Current workaround

Prefix every wrapper call against a USC repo with GITEA_LOGIN=usc. Fragile — every operator must remember it per-repo, and the pr-merge failure mode is silent (404), so a forgotten prefix can look like "PR already merged/missing".

Proposed fix

Auto-detect the tea --login from the repo's origin remote host instead of a hardcoded default:

  • Resolve git remote get-url origin → host (git.uscllc.comusc, git.mosaicstack.devmosaicstack).
  • Fall back to GITEA_LOGIN env if set (explicit override wins).
  • Optionally validate against tea login list and error clearly if no matching profile.

Relation to existing issues

Sibling to #550 (wrapper hardening: TLS / cred-path / no-CI) — same packages/mosaic/framework/tools/git/ surface, but #550 does not cover login resolution. Coordinate with #559 (remove eval from issue-create) so both land cleanly in the wrapper layer.

Acceptance

  • Bare pr-merge.sh -n <N> -m squash succeeds against a usc/* repo with no GITEA_LOGIN prefix.
  • Regression test asserting login is derived from origin host for both instances.

Filed by the nightly fleet-enhancement pass (enhance/ae4). Root-cause + dedup complete; merge authority remains with Mos/coordinator (AGENTS.md rule 38).

## Problem The Mosaic git wrappers (`~/.config/mosaic/tools/git/*.sh` — issue-create, issue-close, pr-create, pr-merge) default to `--login ${GITEA_LOGIN:-mosaicstack}`. This login profile only exists for the mosaicstack Gitea (git.mosaicstack.dev). On **USC repos** (git.uscllc.com, e.g. `usc/uconnect`, `usc/infrastructure`) the bare wrapper call fails: - `issue-close` / `issue-create`: `gitea / Error: GetUserByName` (login `mosaicstack` does not exist on the USC host) - `pr-merge`: silent **HTTP 404 not found** — a wrong-repo target, not an auth error (most dangerous: looks like the PR/issue doesn't exist) ## Evidence Repeatedly hit across the fleet and documented in OpenBrain (4 separate captures, latest 2026-06-19): - uconnect #2059 (2026-05-31), #2366 merge (2026-06-13), #2494 close (2026-06-18) - The nightly enhance pass itself hit this when listing/creating USC issues this session. ## Current workaround Prefix every wrapper call against a USC repo with `GITEA_LOGIN=usc`. Fragile — every operator must remember it per-repo, and the `pr-merge` failure mode is silent (404), so a forgotten prefix can look like "PR already merged/missing". ## Proposed fix Auto-detect the tea `--login` from the repo's origin remote host instead of a hardcoded default: - Resolve `git remote get-url origin` → host (`git.uscllc.com` → `usc`, `git.mosaicstack.dev` → `mosaicstack`). - Fall back to `GITEA_LOGIN` env if set (explicit override wins). - Optionally validate against `tea login list` and error clearly if no matching profile. ## Relation to existing issues Sibling to **#550** (wrapper hardening: TLS / cred-path / no-CI) — same `packages/mosaic/framework/tools/git/` surface, but #550 does **not** cover login resolution. Coordinate with **#559** (remove `eval` from issue-create) so both land cleanly in the wrapper layer. ## Acceptance - Bare `pr-merge.sh -n <N> -m squash` succeeds against a `usc/*` repo with no `GITEA_LOGIN` prefix. - Regression test asserting login is derived from origin host for both instances. --- _Filed by the nightly fleet-enhancement pass (enhance/ae4). Root-cause + dedup complete; merge authority remains with Mos/coordinator (AGENTS.md rule 38)._
jason.woltje added the fleet-enhancement label 2026-06-20 09:26:09 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#560