Repository navigation
feat: the shift watcher posts as a minimal GitHub App (#630) - #631
Merged
Merged
Conversation
The watcher's own gh calls (status comment and edit, mentions, digest, correction, steering read) now run as its GitHub App installation token when PYAUTO_SHIFT_APP_ID, PYAUTO_SHIFT_APP_INSTALLATION_ID and PYAUTO_SHIFT_APP_KEY are all set: an RS256 JWT (PyJWT, else openssl dgst with no shell), one POST /app/installations/<id>/access_tokens, cached with its expires_at in the state dir (mode 600) and re-minted under 10 min from expiry. PYAUTO_SHIFT_GH_TOKEN stays the fallback. A failed mint (or a part-configured App) holds every GitHub call: never the human's gh auth in its place. The reason goes into tick.log and the digest; a held post costs no try; a failed mint backs off 10 min. worker_env strips the three App variables and any minted token. The poster login is the App's <slug>[bot] via GET /app with the JWT. Docs: batch AGENTS.md identity section; AUTONOMY network-surface paragraph names the App installation token and the mint call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…630 review) - No on-disk token cache: the installation token is minted on a tick's first watcher GitHub call, reused within that tick and held in memory only (a worker running as the same user could read a file). A failed mint records only {at, error} in app_mint_failure.json (unique temp file + rename, no secret) for the 10-minute back-off. - env() in App mode raises when it holds no token; never returns None. - AGENTS.md: every watcher write (and the steering read) uses the App; gh pr view (gh_pr_state) and gh pr checks (pr_health) stay human-auth reads, since the App cannot see library repos. AUTONOMY.md: mint per tick, the PYAUTO_SHIFT_GH_TOKEN fallback restored, the dangling "until it is set" sentence fixed. - Tests: in-memory mint once a tick with no file holding the token; failure record holds only time and reason; App mode without a token raises; the mint-failure tick test asserts no file holds the token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Closes #630. Human decision, 2026-11-14: the watcher posts as its own minimal App,
pyautolabs-watcher: Issues read/write and metadata read, on PyAutoMind only. It does not reusepyautolabs-bot, which is a ruleset bypass actor with org-wide push. The human created and installed the App, and it was verified read-only._app_token.py: builds a PyJWT RS256 JWT (openssl fallback, no shell), then mints an installation token. The token is kept in memory for one tick only, with nothing on disk. A mint failure backs off for 10 min and records only a time and reason.gh_pr_state,pr_health) deliberately use the human's auth, because the App cannot read library PRs. The docs say so.worker_envstrips the App settings and any token from workers and close-outs.<slug>[bot], read fromGET /app.GET /app, and keeps thePYAUTO_SHIFT_GH_TOKENfallback. No rule changes.Test plan
tests/test_orchestrator_app_identity.py: 11 tests, offline. They cover the JWT claims, the openssl fallback, mint and refresh, the failure backoff, no token on disk, workers stripped, and partial config making no call.pyautolabs-watcher[bot], permissions issues:write + metadata:read, PyAutoMind#561 read.Tier: glance. Merge mode: auto-merge on green, with the Heart dev-ship gate.
🤖 Generated with Claude Code