fix(cli): fail early on GitHub permission gaps#34
Open
biaoxie wants to merge 1 commit into
Open
Conversation
Run takeover preflight checks with the exact token inherited by agents, verify repository, push, pull-request, and Actions capabilities, and abort startup with concrete remediation when a required permission is missing.\n\nDocument required user-token and GitHub App permissions.\n\nRefs chekusu#7
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.
Problem
wanman takeovertells dev and CTO agents to push branches, create and review pull requests, and inspect Actions runs. Startup did not verify those GitHub capabilities, and the isolated agentHOMEcould hide the hostghkeyring credential. Agents therefore discovered missing permissions only after work had started.The existing repository-role check alone is also insufficient for fine-grained PAT and GitHub App credentials because PR and Actions permissions are independent.
Fix
Takeover startup now:
originremote.ghtoken before creating the isolated agent home.GH_TOKEN.PR-write access is checked without creating repository state: the preflight calls the create-PR endpoint with the same nonexistent branch as head and base. An authorized credential reaches GitHub validation and returns HTTP 422; a credential without Pull requests: write is rejected before validation.
The quickstart now documents minimum permissions for classic PAT/OAuth, fine-grained PAT, and GitHub App installation-token modes.
Tests
@wanman/clisuite: 34 files, 382 tests passed.pnpm --filter @wanman/cli typecheckclean.pnpm --filter @wanman/cli buildclean.biaoxie/wanman.Closes #7