Repository navigation
Description
Parent
GA5 (#1849) of spec #1837 (Infra). The orchestrator ruled (2026-11-24) that the token service moves off the owner's PC to GitHub Actions minting in a private repository, sealed per #3085. Private record. GA5's live check runs on this route. Bot-token priority. Size: M. Security-relevant.
What to build
A third route to the token service, actions. A workflow in the owner's private repository mints each agent's token and seals it to that agent's one-time key with #3094's code. The helper dispatches the request and opens the sealed answer.
-
The workflow template (
tools/github-app/mint-workflow.yml, which the owner copies into the private repository's.github/workflows/):workflow_dispatchonly. The job refuses unlessgithub.refisrefs/heads/main.- The key job runs in an environment,
token-service, whose deployment branches aremainonly. The App key is that environment's secretOPENWIZ_GITHUB_APP_KEY(base64 of the PEM), never a repository secret. - Inputs, all untrusted data and reaching the script only through
env::request, the token-service request JSON with itsanswer_key, andnonce, a random id that names the run (run-name) and its artifact. - It checks out
openwizdev/OpenWizat a pinned commit sha written in the workflow, never a branch, and runs that commit'stools/github-app/token-service.py mint. The key goes to it through a pipe or descriptor, never a file. - The sealed answer, or the refusal, is uploaded as one artifact named by the nonce, with a 1-day retention. Nothing else is uploaded. The job summary carries the mint-log fields only.
- It uses no third-party action beyond
actions/checkoutandactions/upload-artifactat the shas OpenWiz already pins.
-
The helper (
agent-token.py): withOPENWIZ_TOKEN_SERVICE_ROUTE=actionsandOPENWIZ_TOKEN_SERVICE_REPOSITORY=<owner/name>(public settings), it:- dispatches the workflow on
mainwith the request and a fresh nonce, using today's account; - finds the run by its name and waits for it (the contract's 60 s timeout, raised to 120 s for this route);
- downloads the artifact, deletes it, opens the sealed answer and checks it as today.
Any failure falls back with the existing note (
unreachableorbad-answer). No plaintext token is ever in a request, a run's logs, an artifact or the helper's output. Keep the dispatch-and-poll calls few, and back off on 403 or 429. - dispatches the workflow on
-
The contract (
contracts/token-service.v1.md, schema and fixtures): add theactionsroute. Where the key lives becomes "the owner's machine (pairingandlocal), or thetoken-serviceenvironment secret of the owner's private repository (actions)". Set out the main-only rule and why a branch-triggered workflow must never read the key. -
Docs (
docs/github-app.md): the owner's steps:- Create the
token-serviceenvironment with deployment branches set tomainonly. - Make a fresh App key into its secret, through GitHub's own form.
- Protect
mainwith a ruleset so only the owner can change it. - Copy the template.
- Delete the old key in the App's settings.
- Create the
Owned paths
tools/github-app/mint-workflow.yml(new),tools/github-app/agent-token.py(shared: theactionsroute only),tools/github-app/test_agent_token.py(shared: the new cases), and a newtools/github-app/test_mint_workflow.pycontracts/token-service.v1.md,contracts/token-service.v1.schema.json,contracts/fixtures/token-service/(shared: theactionsroute only)docs/github-app.md(only the new route's section)changes/(one new line)
Relies on: contracts/token-service.v1.md; #3085 merged
Acceptance criteria
- Red first. Offline tests with a fake GitHub (dispatch, runs, artifacts) prove:
- the round trip over the
actionsroute; - a missing run, a timeout, a failed run, a missing or tampered artifact, and an unopenable answer each fall back with the right reason;
- the artifact is deleted after download.
Each test sayscatches: <the bug>.
- the round trip over the
- The plaintext token never appears in the dispatch inputs, the fake run's logs or summary, the artifact, or the helper's stdout or stderr.
- A check over the template proves:
- the trigger is
workflow_dispatchonly, and the key job namestoken-serviceand refuses a ref other thanmain; - the OpenWiz checkout is a pinned sha;
- no input appears inside
${{ }}in arun:; - every
uses:is pinned at a sha OpenWiz already uses.
- the trigger is
- No live call and no secret in CI. The live first run is GA5's, after the owner's steps.
Activity