Repository navigation
Description
Problem Statement
The owner's agents still read and write GitHub as the owner's personal account. Their API use drains the owner's personal allowance (the factory has hit GitHub's limits more than once), their comments and pull requests look like the owner wrote them, and comment steering has to stay off because the owner and the factory can't be told apart. The OpenWiz App exists and its installation-token minter is merged (G2 part 1), but agents have no safe way to get a token: the App's private key must never travel to the cloud sandboxes the agents run in.
Solution
The App's private key stays on the owner's machine (the owner's PC now, the VPS later). That machine runs a tiny token service that mints one-hour installation tokens on request, scoped to the repositories the agent works in. Agents ask it for a token at start and refresh before it expires, and then read and write as openwiz[bot]. The key never leaves that machine and is never printed, logged or committed, and no token is ever printed, logged, committed or put on a command line. When the service can't be reached, an agent falls back to the owner's account, as today, with one note on standard error saying so. The owner installs the App on the openwizdev repositories once the code has landed.
Changelog headline
none
User Stories
- As the owner, I want my agents to act as
openwiz[bot], so that their API use stops draining my personal allowance and their records are signed by the App. - As the owner, I want the App's private key to stay on my machine, so that no sandbox, secret store or log ever holds it.
- As an agent, I want to ask the owner's token service for a one-hour token scoped to my repositories, so that I write only where my ticket works.
- As an agent, I want my token refreshed before it expires, so that long work never fails on an expired token.
- As an agent, I want to fall back to the owner's account with one note on standard error when the service is unreachable, so that the factory keeps running and the fallback is visible.
- As the owner, I want the service to refuse a request outside the App's installation or permissions, so that a token can't grant more than the App has.
- As the owner, I want an owner-only log of each mint without any token in it, so that I can see who asked for what.
- As a fleet, I want every builder, reviewer and wake to get its token the same way, so that one path is tested and audited.
- As the owner, I want approvals, repository settings and workflow files to stay on my own login, so that the App never does what it can't or mustn't.
- As the owner, I want one person ticket to install the App and start the service, so that the switch happens once, on my word.
Implementation Decisions
- One contract first: a token-service contract (v1, with a schema and fixtures) pins the request (the repositories, at most the App's permissions), the answer (a token handed to the caller without ever being printed, its expiry), each refusal, the refresh rule (under five minutes left), the fallback and its standard-error note, and the never-exposed rules.
- The service runs on the owner's machine beside the App's key, built on the merged minter (
tools/github-app/). It listens on no public port: agents reach it through the owner's existing machine pairing (Cloudroom's, for the owner's cloud threads; a local call for local threads). It keeps an owner-only log of mints with no token in it. - The agent helper asks the service, hands the token to
ghand git through the environment or a private file, refreshes it, and falls back with one standard-error note. It never asks for, reads or holds the key. - launch-fleet gives every agent it starts, and every fleet wake, its token through the helper. The owner's login stays for approvals, settings and workflow files.
- Supersedes G2's (Infra G2: Jake's agents read and write as openwiz[bot] with installation tokens #1402) choice between a Cloudroom secret and a PC-minted token: the key never leaves the owner's machine, not even into a secret store. G2's part 1 (the minter) is the base; its live steps are this spec's person ticket.
- Merges after the 0.1.0 branch is cut; WS14 and the pin go first.
Testing Decisions
Tests check behaviour from the outside: a request in, a token file and expiry or a refusal out; an unreachable service in, a fallback and one standard-error note out. The seams: the contract's fixtures; the service's tests with a fake GitHub (as the minter's tests do); the helper's tests with a fake service; launch-fleet's start tests. Every test also proves that no key or token appears in any output, log, argument list or file outside its private place, failing first. Prior art: tools/github-app/test.py.
Proof
| Claim | Evidence |
|---|---|
| P1 One request and answer form, with refusals and the fallback note | The contract's fixtures, red first |
| P2 The service mints scoped one-hour tokens and never exposes the key or a token | The service's tests, red first |
| P3 The helper refreshes in time and falls back with one note | The helper's tests, red first |
| P4 Every fleet start and wake uses the helper | launch-fleet's start tests, red first |
P5 Live: a cloud agent's GitHub write shows openwiz[bot] |
The person ticket's read-back |
Live check
On the owner's PC: the owner installs the App on the openwizdev repositories and starts the service. A cloud agent asks for a token, posts one comment on a throwaway issue, and the comment shows openwiz[bot]; with the service stopped, the next agent falls back to the owner's account with its note. The owner records both read-backs; no key or token is recorded anywhere.
Out of Scope
- The VPS move (J258: after Demo Day).
- Each user's own App (G1) and comment steering (WS17's rule stays until this is verified).
Further Notes
- From the owner's GI6 ruling, option B (2026-11-20; private record linked on this issue), building on G2 (Infra G2: Jake's agents read and write as openwiz[bot] with installation tokens #1402).
Activity
jparker2006 commentedon Nov 20, 2026
Plan graph written, for the agents' approval the J203 way. Approving starts every ticket as soon as its blockers have merged; nothing merges until the 0.1.0 release branch is cut (RL1, #1671).
Longest chain: 3 links (GA1, GA3, GA4, GA5). Can start at approval: 1 of 5 (GA1). File links: none.
Link check:
jparker2006 commentedon Nov 20, 2026
Plan graph approved by Jake, 2026-11-20, revision 1: Jake chose option B for the factory's GitHub identity (GI6): the OpenWiz App's private key stays on his machine, which mints one-hour installation tokens for agents on request; the key never leaves it and is never printed or committed; agents fall back to his account with a note when the service is unreachable; and he installs the App on the openwizdev repositories after landing. The orchestrator asked for it planned the J203 way, built tonight and merged after the 0.1.0 cut; the plan passed its own checks (links, relies, owned paths).
Private record: https://github.com/jparker2006/ClosedWiz/issues/3065#issuecomment-7035394761
Fingerprint:
f76ad4afaa350d4e06d8c068684992e3c335bf89da1e2306270742b26e91be68Revision text
jparker2006 commentedon Nov 20, 2026
launch-fleet: fleet active, loop fleet-1837
Wake mode: fresh
fix: a fallback revokes the held token before deleting its cache file…