Skip to content

Infra spec: Agents act as openwiz[bot] (GI6) #1837

Open
4 of 5 issues completed
Open

Description

@jparker2006

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

  1. 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.
  2. 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.
  3. 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.
  4. As an agent, I want my token refreshed before it expires, so that long work never fails on an expired token.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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 gh and 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

Sub-issues

Sub-issues

4 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. added this to the Infra milestone on Nov 20, 2026
  2. jparker2006 commented on Nov 20, 2026

    @jparker2006
    MemberAuthor

    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).

    flowchart LR
      GA1["#1839 GA1: the token-service contract, first (S)"] -->|real: request, answer and refusals| GA2["#1841 GA2: the token service on the owner's machine (M)"]
      GA1 -->|real: request, refresh and fallback| GA3["#1844 GA3: the agent helper (M)"]
      GA1 -->|real: the contract| GA4["#1846 GA4: launch-fleet starts agents with a bot token (M)"]
      GA3 -->|real: the helper every start runs| GA4
      GA2 -->|real: the service| GA5(["#1849 GA5: live: the owner installs the App (a person)"])
      GA3 -->|real: the helper| GA5
      GA4 -->|real: fleets using it| GA5
    
    Loading
    Ticket Title Blocked by Labels
    #1839 Infra GA1: the token-service contract, first none held
    #1841 Infra GA2: the token service on the owner's machine mints one-hour installation tokens #1839 held
    #1844 Infra GA3: the agent helper gets, refreshes and falls back from an installation token #1839 held
    #1846 Infra GA4: launch-fleet starts every agent with an openwiz[bot] token #1839, #1844 held
    #1849 Infra GA5: live: the owner installs the App and a cloud agent writes as openwiz[bot] #1841, #1844, #1846 held

    Longest chain: 3 links (GA1, GA3, GA4, GA5). Can start at approval: 1 of 5 (GA1). File links: none.

    Link check:

    pass spec #1837: tickets 5, links 7, real 7, file 0, unlabelled 0, refusals 0
    
  3. jparker2006 commented on Nov 20, 2026

    @jparker2006
    MemberAuthor

    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

    Ticket Title Blocked by Label
    #1839 Infra GA1: the token-service contract, first none ready-for-agent
    #1841 Infra GA2: the token service on the owner's machine mints one-hour installation tokens #1839 ready-for-agent
    #1844 Infra GA3: the agent helper gets, refreshes and falls back from an installation token #1839 ready-for-agent
    #1846 Infra GA4: launch-fleet starts every agent with an openwiz[bot] token #1839 #1844 ready-for-agent
    #1849 Infra GA5: live: the owner installs the App and a cloud agent writes as openwiz[bot] #1841 #1844 #1846 ready-for-human

    Fingerprint: f76ad4afaa350d4e06d8c068684992e3c335bf89da1e2306270742b26e91be68

    Revision text
    plan-graph revision v2
    spec #1837 body sha256 9f5ef671e683547dea283748b3ecbb0bd24ee2a2179e16c681733a10f92b1cc4
    ticket #1839 blocked-by none body sha256 06e9185f0c1eb6e895aa46e256840e2b540a914e66837a1739966e27306d781f title Infra GA1: the token-service contract, first
    ticket #1841 blocked-by #1839 body sha256 b4f0492eb7ac89d7a553360192a88ef2503bb6c494e05f3a784e6b460597b0a8 title Infra GA2: the token service on the owner's machine mints one-hour installation tokens
    ticket #1844 blocked-by #1839 body sha256 555015fbc6d679d57450c76b8435155de4f1d7c7dd3daaebc8f886126ce0f2ef title Infra GA3: the agent helper gets, refreshes and falls back from an installation token
    ticket #1846 blocked-by #1839 #1844 body sha256 f1bc0ca4147fddbf59975c793a0bc25c17c7d8dbfc02491737803bd8a232a090 title Infra GA4: launch-fleet starts every agent with an openwiz[bot] token
    ticket #1849 blocked-by #1841 #1844 #1846 body sha256 2e14e9dda7e51001521d52f92fdd733437c4a4b468c4c53c80382a3a0ef678d6 title Infra GA5: live: the owner installs the App and a cloud agent writes as openwiz[bot]
    
  4. jparker2006 commented on Nov 20, 2026

    @jparker2006
    MemberAuthor

    launch-fleet: fleet active, loop fleet-1837

    Wake mode: fresh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions