fix(github-auth): always run gh setup when user explicitly opts in#2674
Merged
fix(github-auth): always run gh setup when user explicitly opts in#2674
Conversation
When the user selects the GitHub CLI step in setup options (interactive
prompt or --steps github), offerGithubAuth() was silently returning early
if no local gh token was found by detectGithubAuth(). This made the step
unreachable for users without gh installed locally — exactly the ones who
need remote setup most.
Fix: accept an `explicitlyRequested` parameter in offerGithubAuth(). When
true, skip the githubAuthRequested guard and always run the remote install.
The orchestrator passes enabledSteps?.has("github") as this flag.
detectGithubAuth() still auto-enables the step when a local token exists
(convenience forwarding), but can no longer block a user-explicit request.
Fixes #2672
Agent: issue-fixer
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
louisgv
approved these changes
Mar 16, 2026
Member
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Commit: 6666062
Findings
No security issues found.
Changes Analysis
- Added
explicitlyRequestedparameter toofferGithubAuth()function - Pure control flow change - no injection risks, credential leaks, or path traversal
- Boolean flag used only for conditional logic, never interpolated into commands
- Safe default behavior (undefined) maintains backward compatibility
- Existing security checks remain intact
Tests
- bash -n: PASS (all shell scripts have valid syntax)
- bun test: PASS (1417 tests passed, 0 failures)
- curl|bash: N/A (no shell script changes)
- macOS compat: N/A (no shell script changes)
-- security/pr-reviewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the user selects the GitHub CLI step in setup options (interactive prompt or
--steps github),offerGithubAuth()was silently returning early if no local gh token was found. This made the step unreachable for users withoutghinstalled — exactly who the step is designed to help.Root cause: Two independent guards, both required to pass:
orchestrate.ts:252— checksenabledSteps.has("github")✅agent-setup.ts:264— checksgithubAuthRequested❌ (silently blocks if no local token)githubAuthRequestedis only set totruewhen a token is detected locally. Users withoutghinstalled or not authenticated getgithubAuthRequested = false→ silent skip.Fix
explicitlyRequested?: booleanparameter toofferGithubAuth()!githubAuthRequested && !explicitlyRequested— either condition unblocks the steporchestrate.tspassesenabledSteps?.has("github")asexplicitlyRequestedenabledStepsisundefined(run all steps), existing auto-detection behavior is preserveddetectGithubAuth()still auto-enables the step for token forwarding (convenience), but can no longer silently block a user-explicit request.Fixes #2672
Test plan
bun test)bunx @biomejs/biome check)ghand--steps github: step runs and installs gh on remoteghtoken: token forwarded as before--stepsflag): auto-detection behavior unchanged-- refactor/issue-fixer