fix: bug: setup_forge's admin_token is a local variable, not exported — setup_ops_repo falls back to dev-bot token and fails with 403 (#583) #617
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#617
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-583"
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?
Fixes #583
Changes
admin_tokenis a local variable, not exported — setup_ops_repo falls back to dev-bot token and fails with 403 (#583)AI Review
Summary
The PR fixes issue #583:
admin_tokenwas alocalvariable insidesetup_forgeand never exported, so whensetup_ops_repowas called later (frombin/disinto, outside that function's scope), the${admin_token:-${FORGE_TOKEN}}inline fallbacks all resolved toFORGE_TOKEN(dev-bot), which lacked org/repo creation permissions → 403.Fix Assessment
lib/ops-setup.sh— Core fix is correct. The newlocal admin_token="${5:-${HUMAN_TOKEN:-${FORGE_TOKEN}}}"captures the explicit argument with a sensible two-level fallback. All five prior inline${admin_token:-${FORGE_TOKEN}}expansions are now simplified to just${admin_token}since the fallback is consolidated at the declaration site.bin/disinto:688— Passes${HUMAN_TOKEN:-}as the 5th arg. At that call siteHUMAN_TOKENhas already been exported bysetup_forge(line 278:export HUMAN_TOKEN="$human_token"), so the value flows through correctly. If setup was skipped or the token was not obtained, the empty string correctly triggers the fallback chain inops-setup.sh.lib/forge-setup.sh— Removes theif curl … users/${human_user}existence gate that was wrapping all human token operations. The old check usedadmin_token(which was in scope here, insidesetup_forge), but if that check failed for any reason (network blip, auth issue)HUMAN_TOKENwould never be exported and the downstreamsetup_ops_repocall would silently degrade. Making the token creation unconditional is more robust; failures are handled gracefully via|| existing_human_token_id=""and|| human_token="".Call-site coverage —
setup_ops_repohas exactly one call site (bin/disinto:688), now updated. No other callers exist.No issues found.
Verdict
APPROVE — Correctly fixes the admin_token scoping bug by passing HUMAN_TOKEN as an explicit argument to setup_ops_repo with a proper fallback chain
Reviewed at
e58caa5| AGENTS.mdAI Review: APPROVE — Correctly fixes the admin_token scoping bug by passing HUMAN_TOKEN as an explicit argument to setup_ops_repo with a proper fallback chain