Skip to main content

Module github_token

Module github_token 

Source
Expand description

POST /api/v1/github/token: the GitHub token an agent’s git and gh use.

agentmux-bashwrap asks here, from the agent’s own shell, as git’s credential helper and before each wrapped command. Who is asking is the agent its X-Agent-Token was minted for, never a name in the request; the request says only which repository. The token is the AgentMux GitHub App’s installation token, narrowed to that repository by AgentMux Cloud’s broker (identity::github_tokens). The answer also says who the agent works for (the GitHub account’s id and login) and who the App’s bot is, for the PR tag and the commit’s author. When there is no token, the answer says why, in words an agent can show; nothing here falls back to another credential.

Structs§

GithubTokenRequest 🔒

Constants§

NEEDS_SIGN_IN_FOR_AGENT 🔒
What an agent is told when the person isn’t signed in to AgentMux Cloud (the Connect with GitHub design).

Functions§

handle_github_token 🔒
POST /api/v1/github/token
refusal_for 🔒
What a refusal says, and its status, once the broker path has failed too (host_error: what gh-agent said first, for a container agent).
refusal_shown 🔒
refusal_for, and for a container agent the sentence it was given is also put in its pane, when the person can fix it.
retry_without_workflows 🔒
Whether a push token that failed is asked for again without workflows write: an App without it cannot give that, and the push token without it still pushes everything else. Not after a gh-agent that is too old (it would be again), and not after one that was slow: a second wait would run past the container’s own, and its answer would never arrive.
scope_for 🔒
The scope of the token a container on a gh-agent host is given for purpose: only git’s own asks for a push token.
status_for 🔒
The status a refusal is answered with: the request’s fault (4xx) or a bad moment (503).
the_persons_to_fix 🔒
Whether a refusal is one the person can fix, so a container agent’s pane says so: GitHub isn’t connected, the App isn’t installed where the repository is, or the Cloud sign-in lapsed. A slow gh-agent is only a bad moment.