fix(git-tools): auto-detect Gitea --login from repo origin host (USC repos fail with default mosaicstack login) #560
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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(loginmosaicstackdoes 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):
Current workaround
Prefix every wrapper call against a USC repo with
GITEA_LOGIN=usc. Fragile — every operator must remember it per-repo, and thepr-mergefailure mode is silent (404), so a forgotten prefix can look like "PR already merged/missing".Proposed fix
Auto-detect the tea
--loginfrom the repo's origin remote host instead of a hardcoded default:git remote get-url origin→ host (git.uscllc.com→usc,git.mosaicstack.dev→mosaicstack).GITEA_LOGINenv if set (explicit override wins).tea login listand 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 (removeevalfrom issue-create) so both land cleanly in the wrapper layer.Acceptance
pr-merge.sh -n <N> -m squashsucceeds against ausc/*repo with noGITEA_LOGINprefix.Filed by the nightly fleet-enhancement pass (enhance/ae4). Root-cause + dedup complete; merge authority remains with Mos/coordinator (AGENTS.md rule 38).