fix(#7089): use standard token resolution in lookupAppID - #7091
Conversation
lookupAppID had its own inline token resolution that only checked
GH_TOKEN and GITHUB_TOKEN env vars. The shared resolveToken function
in the same package adds gh auth token as a third fallback, matching
the resolution chain used by every other GitHub-calling command.
Replace the inline env-var checks with a call to resolveToken via a
testable package-level variable (lookupTokenFn). Since the /apps/{slug}
endpoint is public, a resolution error is treated as proceed
unauthenticated rather than a hard failure.
Closes #7089
|
🤖 Finished Review · ✅ Success · Started 7:30 AM UTC · Completed 7:43 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.84 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Risk Assessment: moderate (2/5) DetailsTier 1 signals are unchanged from prior review (small 2-file, bot-authored, well-tested fix scoring 1.0); Tier 2 confirms persistent high-churn and fix-heavy history on both mint.go and mint_test.go, yielding Tier 2 composite ~2.71; weighted composite 1.65 rounds to 2 (moderate), consistent with prior score. Previous runRisk Assessment: moderate (2/5) DetailsTier 1 signals are unchanged from prior review (small, well-tested, bot-authored fix scoring 1.0); Tier 2 confirms high-churn, fix-heavy history (mint.go: 19 commits/30d, 36 fix commits/90d), elevating Tier 2 composite to ~2.9 and keeping weighted composite at 1.66, rounding to 2 (moderate) — consistent with prior score of 2. Previous run (2)Risk Assessment: moderate (2/5) DetailsSmall, well-tested bot-authored bug fix in a high-churn file that has seen prior fixes to the same function, yielding moderate risk overall. |
|
Looks good to me Previous runLooks good to me Previous run (2)ReviewFindingsLow
Next steps:
|
|
🤖 Finished Fix · ✅ Success · Started 7:45 AM UTC · Completed 7:52 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $0.70 |
Add assertion to TestLookupAppID_RateLimit verifying the unauthenticated rate-limit error includes the "gh auth login" remediation text. The existing "set GH_TOKEN or GITHUB_TOKEN" assertion is a prefix of the new message and passes without validating the newly added suggestion. Note: pre-commit hooks were not run. pre-commit could not complete (infrastructure failure), and hooks were run directly instead. Addresses #7091
🔧 Fix agent — iteration 1 (bot-triggered)Added missing test assertion for the gh auth login suggestion in the unauthenticated rate-limit error message, as identified by the reviewer Fixed (1):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 7:54 AM UTC · Completed 8:05 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $2.63 |
Superseded by updated review
|
/fs-fix |
|
🤖 Finished Fix · ✅ Success · Started 9:25 AM UTC · Completed 9:32 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $0.98 |
Replace defer-based lookupTokenFn restoration in TestLookupAppID_UsesResolveTokenFallback with t.Cleanup to match the pattern established by the withNoToken helper in the same PR. Note: pre-commit hooks were not run. pre-commit could not complete (infrastructure failure), and hooks were run directly instead (gofmt, go vet passed). Addresses #7091
🔧 Fix agent — iteration 2 (human-triggered)Addressed code organization finding: replaced defer-based lookupTokenFn restoration with t.Cleanup in TestLookupAppID_UsesResolveTokenFallback for consistency with the withNoToken helper pattern Fixed (1):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 9:34 AM UTC · Completed 9:48 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.54 |
Superseded by updated review
|
🤖 Finished Retro · ✅ Success · Started 10:02 AM UTC · Completed 10:12 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $2.50 |
Retro: PR #7091 — use standard token resolution in lookupAppIDOverall assessment: The workflow performed well end-to-end. Issue #7089 went from filing to merged PR in under 3 hours, with accurate triage ($1.04, 5 min), clean code generation ($4.63, 11 min), and legitimate review findings. However, a gap in the review→fix→re-review cycle caused unnecessary human intervention and added ~$8 in avoidable agent cost. What went well
What went wrongThe fix agent's first iteration fixed only Finding 1 (missing assertion) and silently dropped Finding 2 (defer vs t.Cleanup). This appears related to the delivery channel split: Finding 1 ended up in the review body text (because GitHub returned HTTP 422 when the review agent tried to post it inline), while Finding 2 was posted as a successful inline diff comment. The fix agent processed the review body but not the inline comments. More critically, Review 2 — triggered by the fix commit — declared "looks good to me" without re-flagging the still-unfixed Finding 2. This left the inline comment sitting unresolved for ~1.5 hours until human reviewer ifireball noticed it and manually triggered Evidence for existing issues
Cost breakdown
Proposals filed
|
Summary
lookupAppIDininternal/cli/mint.gohad its own inline token resolution that only checkedGH_TOKENandGITHUB_TOKENenv vars. This PR replaces it with a call to the sharedresolveToken()function, which addsgh auth tokenas a third fallback — matching the resolution chain used by every other GitHub-calling command.Related Issue
Fixes #7089
Changes
lookupAppIDwith a call toresolveToken()via a testable package-level variable (lookupTokenFn)resolveToken()errors as "proceed unauthenticated" since the/apps/{slug}endpoint is publicgh auth loginas a recovery optionTestLookupAppID_UsesResolveTokenFallbackto verify the fallback pathwithNoTokenhelper for deterministic behaviorTesting
TestLookupAppID_*tests pass (10 tests including new one)TestMintDeploy*andTestResolveToken*tests passgo vet ./internal/cli/...passesgofmtpasseslookupAppIDis 85.7% (above 80% threshold)Checklist
!for breaking changes)Closes #7089
Post-script verification
agent/7089-mint-gh-auth-fallback)3371a4efd48cf13cf3cb756ec71a58dc80b5091e..HEAD)