Skip to content

fix(auth): fall back to GitHub App installation token when user has no OAuth#34

Merged
genisd merged 2 commits into
gynzyfrom
fix/app-token-retrieval
May 21, 2026
Merged

fix(auth): fall back to GitHub App installation token when user has no OAuth#34
genisd merged 2 commits into
gynzyfrom
fix/app-token-retrieval

Conversation

@genisd

@genisd genisd commented May 21, 2026

Copy link
Copy Markdown
Member

Tasks created by users who signed in via non-GitHub providers (Google/OIDC) were failing with agent_no_output. The credential helper called /api/internal/git-credentials, which returned 500 because getTokenForUser only fell back to PAT (user OAuth → PAT → throw) and never tried the installed GitHub App. Without a PAT configured, the helper returned nothing, git prompted for credentials on a non-TTY stdin, and the agent's entrypoint died on set -e before the agent could start.

Reorder the fallback chain to user OAuth → App installation → PAT (the order the existing docstring and error message already implied). Folds getPatFallback and getServerToken into a single fallbackToAppOrPat helper used by both user-scoped and server-scoped lookups, removing two layers of indirection.

Also stops the recurring Secret not found errors from pr-watcher and reconcile-snapshot that hit the same code path on every poll cycle.

Summary

Changes

Testing

  • Tests pass (pnpm turbo test)
  • Typechecks pass (pnpm turbo typecheck)

Related

Closes #

Screenshots

genisd and others added 2 commits May 21, 2026 09:20
…o OAuth

Tasks created by users who signed in via non-GitHub providers (Google/OIDC)
were failing with `agent_no_output`. The credential helper called
/api/internal/git-credentials, which returned 500 because getTokenForUser
only fell back to PAT (`user OAuth → PAT → throw`) and never tried the
installed GitHub App. Without a PAT configured, the helper returned
nothing, git prompted for credentials on a non-TTY stdin, and the agent's
entrypoint died on `set -e` before the agent could start.

Reorder the fallback chain to `user OAuth → App installation → PAT` (the
order the existing docstring and error message already implied). Folds
`getPatFallback` and `getServerToken` into a single `fallbackToAppOrPat`
helper used by both user-scoped and server-scoped lookups, removing two
layers of indirection.

Also stops the recurring `Secret not found` errors from pr-watcher and
reconcile-snapshot that hit the same code path on every poll cycle.
@genisd genisd merged commit 743314e into gynzy May 21, 2026
15 checks passed
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.

2 participants