All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
The per-agent identity resolution added to get_gitea_token() (Patch 2 / #873) resolves an explicit identity (MOSAIC_GIT_IDENTITY env, or git config mosaic.gitIdentity) and returns that identity's per-slot Gitea token when present. Gap: when the identity resolves but its per-slot token file is ABSENT for a recognized Gitea host, the function fell through to the shared/default credential-loader token instead of failing. API tooling (pr-create.sh, issue-create.sh, pr-review.sh) then silently posted the PR/issue/review as the WRONG agent — e.g. a reviewer seat's Gate-16 review getting attributed to the shared/default identity — corrupting author≠reviewer separation while also masking the missing-token misconfiguration. This surfaced most often on the tea-stale API-fallback path, which is exactly when tooling leans on get_gitea_token. Fix: in the step-0 explicit-identity branch, when the per-slot token for that identity is absent on a recognized Gitea host, print a stderr diagnostic naming the identity, its source (env vs git config), the host, and the expected token path, then return 1 instead of falling through. All three callers already `return 1` on a nonzero get_gitea_token, so fail-loud propagates with zero caller edits. Scope (deliberate, minimal blast radius): explicit-identity-only. Plain `git config user.name` is not an identity trigger — only MOSAIC_GIT_IDENTITY / git config mosaic.gitIdentity count, so ordinary shared/human repo usage is unaffected. Recognized-Gitea-hosts-only: unrecognized hosts have no per-slot token scheme, so identity-set + unknown-host still falls through unchanged (no fail-loud). The MOSAIC_STRICT_IDENTITY opt-in discussed as a possible future extension (gating the full `... > git username` chain) is deliberately NOT part of this patch — deferred per spec as a later, separate proposal. Red-first: stashed the source fix, ran the extended test-gitea-token-identity.sh — 16 assertions failed exactly as expected (shared token leaked, no fail-loud diagnostic). Restored the fix — all green, full test:framework-shell chain passes. Backward compat verified: the no-identity-requested case still returns the shared token unchanged. Extends test-gitea-token-identity.sh: the no-per-slot-token case (both identity sources: env and git config) on a recognized host now asserts nonzero return + empty stdout + stderr diagnostic naming identity/source/host/expected path, instead of asserting a shared-token fallback. Adds a same-identity cross-host case (token exists for one host, absent for another → fail-loud on the host lacking it, no cross-host token leak) and a scope-containment case (identity set + unrecognized host → existing fall-through behavior unchanged, fail-loud diagnostic does not fire). Gates: shellcheck clean on both changed files, sanitization gate (verify-sanitized.sh) passes, full test:framework-shell chain green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0158NZqN2n2ymKFeJAZ4GUCb