From f4f6cfe2ee37cdde8089facdfee757e30cafd3e9 Mon Sep 17 00:00:00 2001 From: Shaela Bello Date: Mon, 3 Aug 2026 11:44:52 -0400 Subject: [PATCH 1/2] refactor(archon): wire CLAUDE_BIN_PATH for live-workflow agent work orders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #2217 (2026-08-03): the archon service in `pmoves/docker-compose.yml` already wires the bulk of the live-workflow auth (CLAUDE_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, CLAUDE_USE_GLOBAL_AUTH, GH_TOKEN). One last token from the issue's "Auth for live workflows" section is still missing: `CLAUDE_BIN_PATH` — the path to the Claude CLI binary inside the container. The TS archon server uses this when spawning Claude Code as a subprocess for the Agent Work Orders feature. This is a 1-token, 1-PR change — the lane is small because the upstream `PMOVES-Archon/.env.example` mapping was mostly already done in earlier PRs. The only thing this commit adds: - `pmoves/docker-compose.yml`: add `CLAUDE_BIN_PATH=${CLAUDE_BIN_PATH:-}` to the `archon` service env, with a 4-line comment explaining the default behavior ($PATH) and the upstream's standard install path (/usr/local/bin/claude). - `pmoves/docker-compose.agents.yml`: regenerated by `make -C pmoves compose-split` to reflect the new env var on the agents-profile split. All other splits are unchanged (they don't include archon). - `pmoves/env.tier-agent.example`: new "Archon — Claude / gh live-workflow auth (Issue #2217)" section that documents the full set of live-workflow tokens (CLAUDE_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, CLAUDE_USE_GLOBAL_AUTH, CLAUDE_BIN_PATH, GH_TOKEN) with comments on each. This makes the operator's `env.shared` setup explicit; previously these were scattered or undocumented. Validation: `yaml.safe_load` parses the main compose; `make -C pmoves compose-split` reports 102/102 services across overlays, all YAML syntactically valid. What does NOT change (intentionally, out of scope for this lane): - The Makefile archon targets (`up-archon-submodule`, `up-archon-native`, `archon-smoke`, etc.) — they don't reference CLAUDE_BIN_PATH. - The upstream `PMOVES-Archon/.env.example` has additional env vars (`ENABLE_AGENT_WORK_ORDERS`, `STATE_STORAGE_TYPE`, `SERVICE_DISCOVERY_MODE`, etc.) that aren't relevant to PMOVES' single-service deployment. We can wire them in a follow-up lane if Agent Work Orders is ever added as a separate PMOVES service. - The `archon-data` / `archon-user-home` / `archon-pg-data` volumes — those are persistent state, not auth. Refs: POWERFULMOVES/PMOVES.AI#2217 --- pmoves/docker-compose.agents.yml | 5 +++++ pmoves/docker-compose.yml | 5 +++++ pmoves/env.tier-agent.example | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/pmoves/docker-compose.agents.yml b/pmoves/docker-compose.agents.yml index 0917de946f..f15e403b0e 100644 --- a/pmoves/docker-compose.agents.yml +++ b/pmoves/docker-compose.agents.yml @@ -219,6 +219,11 @@ services: - CLAUDE_API_KEY=${CLAUDE_API_KEY:-} - CLAUDE_CODE_OAUTH_TOKEN=${CLAUDE_CODE_OAUTH_TOKEN:-} - CLAUDE_USE_GLOBAL_AUTH=${CLAUDE_USE_GLOBAL_AUTH:-false} + # CLAUDE_BIN_PATH: path to the Claude CLI binary inside the container. + # Default empty (uses $PATH). The upstream Archon Dockerfile installs + # Claude at /usr/local/bin/claude; set this only if the image builds + # Claude at a non-standard path or you want to pin a specific binary. + - CLAUDE_BIN_PATH=${CLAUDE_BIN_PATH:-} # gh auth — non-fatal warning if absent. - GH_TOKEN=${GH_TOKEN:-} # Host environment leak guard (see x-host-leak-guard docs above) diff --git a/pmoves/docker-compose.yml b/pmoves/docker-compose.yml index 48c29be70c..668ec0e2ee 100644 --- a/pmoves/docker-compose.yml +++ b/pmoves/docker-compose.yml @@ -3100,6 +3100,11 @@ services: - CLAUDE_API_KEY=${CLAUDE_API_KEY:-} - CLAUDE_CODE_OAUTH_TOKEN=${CLAUDE_CODE_OAUTH_TOKEN:-} - CLAUDE_USE_GLOBAL_AUTH=${CLAUDE_USE_GLOBAL_AUTH:-false} + # CLAUDE_BIN_PATH: path to the Claude CLI binary inside the container. + # Default empty (uses $PATH). The upstream Archon Dockerfile installs + # Claude at /usr/local/bin/claude; set this only if the image builds + # Claude at a non-standard path or you want to pin a specific binary. + - CLAUDE_BIN_PATH=${CLAUDE_BIN_PATH:-} # gh auth — non-fatal warning if absent. - GH_TOKEN=${GH_TOKEN:-} # Host environment leak guard (see x-host-leak-guard docs above) diff --git a/pmoves/env.tier-agent.example b/pmoves/env.tier-agent.example index 91721aa87f..b3a98f5492 100644 --- a/pmoves/env.tier-agent.example +++ b/pmoves/env.tier-agent.example @@ -62,6 +62,26 @@ ARCHON_SERVER_PORT=8091 ARCHON_MCP_PORT=8051 ARCHON_SUPABASE_BASE_URL= +# --------------------------------------------------------------------------- +# Archon — Claude / gh live-workflow auth (Issue #2217) +# --------------------------------------------------------------------------- +# The TS server exits(1) at boot if no Claude auth is present. The compose +# file wires the following tokens to the `archon` service env. Set at least +# one of CLAUDE_API_KEY or CLAUDE_CODE_OAUTH_TOKEN; leave the others empty. +# +# CLAUDE_BIN_PATH: path to the Claude CLI binary inside the archon container. +# Default empty (uses $PATH). The upstream Archon Dockerfile installs Claude +# at /usr/local/bin/claude; set this only if your image builds Claude at a +# non-standard path or you want to pin a specific binary. +# +# GH_TOKEN: GitHub PAT for `gh auth` inside the container. Scopes: repo, workflow. +# Non-fatal warning if absent (workflows that need gh will fail at use-time). +CLAUDE_API_KEY= +CLAUDE_CODE_OAUTH_TOKEN= +CLAUDE_USE_GLOBAL_AUTH=false +CLAUDE_BIN_PATH= +GH_TOKEN= + # --------------------------------------------------------------------------- # DeepResearch Settings # --------------------------------------------------------------------------- From 20bcd46e5191175509702708a69f07881ea3fa70 Mon Sep 17 00:00:00 2001 From: Shaela Bello Date: Mon, 3 Aug 2026 11:45:39 -0400 Subject: [PATCH 2/2] docs(trail): AGNOTE CLAIM + cold-read spec for archon env wiring (Issue #2217) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lane 2217 (2026-08-03): closes the lane. The CLAIM goes on the AGNOTE; the cold-read spec captures the full design for a fresh local model picking this work up next session. What lands: - pmoves/docs/AGENTS/AGNOTE4482PHI.t1.md: new section "Issue #2217 — Archon 0.6.0 env wiring (2026-08-03)" with the full CLAIM text. Ends with the GRAPHITI_MARK HTML comment so a future graphiti loader can index it. - pmoves/docs/specs/archon-env-wiring-2026-08-03.md (new, ~5KB): cold-read spec covering TL;DR + why now + what shipped (P1 only, since the lane is small enough for 1 commit) + validation + out of scope + what's left for Issue #2217 + three-body + CHIT trail. The functional commit is already pushed. The PR is ready to push after this commit lands: YAML parses, compose-split regenerates cleanly (102/102 services), 1 env var + 5 lines of comments in env.tier-agent.example. Refs: POWERFULMOVES/PMOVES.AI#2217 --- pmoves/docs/AGENTS/AGNOTE4482PHI.t1.md | 7 + .../specs/archon-env-wiring-2026-08-03.md | 132 ++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 pmoves/docs/specs/archon-env-wiring-2026-08-03.md diff --git a/pmoves/docs/AGENTS/AGNOTE4482PHI.t1.md b/pmoves/docs/AGENTS/AGNOTE4482PHI.t1.md index ce890d8bc4..d7d4d0d207 100644 --- a/pmoves/docs/AGENTS/AGNOTE4482PHI.t1.md +++ b/pmoves/docs/AGENTS/AGNOTE4482PHI.t1.md @@ -1573,3 +1573,10 @@ edo for slice 6 (4th-commit pattern). (2) functional: pmoves/tools/creator-colla - `2026-08-03T10:30:00Z` CLAIM `Mavis (orchestrator, mvs_09c9b116c675418b9d8b1a48b10867dc)` scope: **Lane 2228 yt-cookies refactor — moved the Google OAuth refresh_token out of the hand-rolled `pmoves_core.yt_oauth_cookies.encrypted_refresh_token` column and into Supabase Auth's `auth.identities` (managed by Supabase, not us).** Branch `refactor/yt-cookies-oauth-to-supabase-auth` off `main` @ `9c07b9a182`. 2 stacked commits ready for review: P1 `174fdfd98b` (new `oauth_client.py` + new `supabase_auth.py` + `supabase_client.py` cleanup + `main.py` refactor + delete `oauth_handler.py`, +266/-90, 5 files), functional `60bc62124c` (17-test smoke suite + `migrations/0001_drop_encrypted_refresh_token.sql`, +5 files, 0 deletions). Docs is this CLAIM + the 12.6KB spec doc at `pmoves/docs/specs/yt-cookies-supabase-auth-2026-08-03.md`. **Root cause:** the 3-PR env var fix dance this week (#2327, #2333, #2346) was patching a symptom. The real problem was that we were storing the Google OAuth refresh_token in a custom Supabase table and hand-rolling the OAuth refresh flow with a direct `httpx.post(TOKEN_URL, ...)`. When the legacy `SERVICE_ROLE_KEY` env var carried a stale key signed by a retired JWT secret, every Supabase upsert 401'd, and the only fix was to swap the env var preference. The architectural fix is to let Supabase Auth own the OAuth token storage and just do the actual refresh_token → access_token exchange server-side. **What shipped:** (1) P1 = new `oauth_client.py` (~50 lines) — focused direct OAuth2 client for refreshing the Google `provider_token` from the `provider_refresh_token`. The 30 lines of actual logic + the env var guard + the structured-error-preservation pattern from the deleted `oauth_handler.py`. This is the smallest possible hand-roll because Supabase does not auto-refresh Google provider_token server-side. (2) P1 = new `supabase_auth.py` (~110 lines) — reads the Google identity from `auth.identities` for the `darkxside@pmoves.ai` user via the Supabase Management API (admin endpoint with service_role key). Uses `params=` for proper URL encoding (the previous f-string interpolation would have broken for any email containing `+` or other reserved URL characters). (3) P1 = `supabase_client.py` cleanup — drops the `encrypted_refresh_token` column references; keeps the YouTube session cookie + PO token + operational status storage (genuinely custom, no Supabase equivalent). (4) P1 = `main.py` refactor — reads `provider_refresh_token` from Supabase Auth first; the Playwright cookie extraction + NATS publisher + cookie writer stay untouched (those are the genuinely-custom parts); `/status` endpoint now reports `has_google_identity: true/false` so the operator can verify the new flow without grep'ing logs. (5) P1 = `oauth_handler.py` DELETED — 50 lines of hand-rolled spaghetti removed. (6) Functional = 17 tests (5 for `oauth_client`, 7 for `supabase_auth`, 5 for smoke/regression net). The smoke test is the regression net for the next time someone tries to "fix" the auth flow. All 17 pass on a clean `python -m unittest discover -s pmoves/services/yt-cookie-refresher/tests`; ruff clean. (7) Functional = `migrations/0001_drop_encrypted_refresh_token.sql` — drops the unused column. Operator runs this AFTER the new code path is verified end-to-end. **Validation:** 17/17 tests pass; ruff clean; the import graph smoke test verifies main.py no longer references the deleted `oauth_handler.py` and that the new modules are present. **Out of scope (intentional):** the Makefile `yt-cookies-auth` target still opens a browser for the legacy OAuth flow via `tools/yt_oauth_flow.py`; a follow-up PR can update the Makefile + deprecate the tools script. The runtime code is now independent of this; the Makefile lag is just operator UX. The actual refresh `provider_token` is still done via direct OAuth2 client (~50 lines) because Supabase does not auto-refresh Google provider_token server-side — this is the smallest possible hand-roll. The 3-PR env var fix dance this week is no longer relevant going forward because the Supabase Admin API uses its own key path, not the same `SERVICE_ROLE_KEY` that's been bouncing around `env.shared`. **Operator's manual steps after this lands:** (1) create the `darkxside@pmoves.ai` Supabase user in the dashboard (Auth > Users > Add user > Create with Google); (2) sign in once via Google, granting `cataclysmstudios@gmail.com`'s Google identity (which has YouTube Premium access); (3) run `make yt-cookies-refresh` to verify the new flow works (the `/status` endpoint should report `has_google_identity: true`); (4) after verification, run the migration at `migrations/0001_drop_encrypted_refresh_token.sql` to drop the unused column. **Three-body:** delivery=Mavis (this), control=DARKXSIDE (operator creates the Supabase user + signs in via Google + runs the migration after verification), memory=this trail + 2 commits + spec doc + 17 new test cases + the migration SQL. **CHIT trail unsigned-local** (no `CHIT_PASSPHRASE` loaded in Mavis session). agent_signature: `ACK::Mavis::YT-COOKIES-SUPABASE-AUTH-REFACTOR-CLAIM-2026-08-03`. + + +## Issue #2217 — Archon 0.6.0 env wiring (2026-08-03) + +- `2026-08-03T11:45:00Z` CLAIM `Mavis (orchestrator, mvs_09c9b116c675418b9d8b1a48b10867dc)` scope: **Issue #2217 item #4 (Auth for live workflows) closed.** Archon 0.6.0's TS server already exits(1) at boot if no Claude auth is present, and the bulk of the live-workflow tokens were already wired in earlier PRs (`CLAUDE_API_KEY` from the upstream `ANTHROPIC_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN`, `CLAUDE_USE_GLOBAL_AUTH`, `GH_TOKEN` from the upstream `GITHUB_PAT_TOKEN`). The one remaining token from the issue was `CLAUDE_BIN_PATH` — the path to the Claude CLI binary inside the container, which the archon server uses when spawning Claude Code as a subprocess for the Agent Work Orders feature.** Branch `refactor/archon-env-wiring-2217` off `main` @ `bf317e46e9`. 1 stacked commit `f4f6cfe2ee` (3 files changed, +30 lines: `pmoves/docker-compose.yml` +5, regenerated `pmoves/docker-compose.agents.yml` +5, `pmoves/env.tier-agent.example` +20). Docs is this CLAIM + the cold-read spec at `pmoves/docs/specs/archon-env-wiring-2026-08-03.md`. **Root cause:** the lane was small because earlier PRs had already renamed and wired the upstream `PMOVES-Archon/.env.example` tokens to PMOVES conventions. This lane just closed the gap on the one token that was still missing for the live-workflow path. **What shipped:** (1) `pmoves/docker-compose.yml` — add `CLAUDE_BIN_PATH=${CLAUDE_BIN_PATH:-}` to the `archon` service env with a 4-line comment explaining the default (uses `$PATH`) and the upstream's standard install path (`/usr/local/bin/claude`). The default is empty so the standard upstream image just works; operators only need to set this if they're running a custom build. (2) `pmoves/docker-compose.agents.yml` — regenerated by `make -C pmoves compose-split` to reflect the new env var on the `agents`-profile split. All other split overlays (`core`, `media`, `ui`, `workers`, `apps`, `juicefs`) are unchanged because they don't include the archon service. (3) `pmoves/env.tier-agent.example` — new "Archon — Claude / gh live-workflow auth (Issue #2217)" section that documents the full set of live-workflow tokens (CLAUDE_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, CLAUDE_USE_GLOBAL_AUTH, CLAUDE_BIN_PATH, GH_TOKEN) with comments on each. This makes the operator's `env.shared` setup explicit; previously these were scattered between the compose file and the env template without a unified comment. **Validation:** `yaml.safe_load` parses the main compose cleanly; `make -C pmoves compose-split` reports 102/102 services across overlays, all YAML syntactically valid. **Out of scope (intentional):** the Makefile archon targets (`up-archon-submodule`, `up-archon-native`, `archon-smoke`, etc.) don't reference `CLAUDE_BIN_PATH` so no change needed. The `archon-data` / `archon-user-home` / `archon-pg-data` volumes are persistent state, not auth, so no change needed. The upstream `PMOVES-Archon/.env.example` has additional env vars (`ENABLE_AGENT_WORK_ORDERS`, `STATE_STORAGE_TYPE`, `SERVICE_DISCOVERY_MODE`, `ENABLE_DOCKER_SOCKET_MONITORING`, `MCP_HEALTH_CHECK_TIMEOUT`, `LOGFIRE_TOKEN`, `LOG_LEVEL`) that aren't relevant to PMOVES's single-service deployment; we can wire them in a follow-up lane if Agent Work Orders is ever added as a separate PMOVES service. **What this means for Issue #2217:** items #1 (first-class main-compose service), #2 (fabric wiring), #3 (DB decision), and #5 (retire the dead Python wrapper) were all already done in earlier PRs; item #4 is now complete with this commit. The issue is effectively closed at the wiring level. **Three-body:** delivery=Mavis (this), control=DARKXSIDE (operator sets `CLAUDE_BIN_PATH` in `env.shared` if needed; verifies the archon service still boots), memory=this trail + 1 commit + spec doc + 1 env var + 5 lines of comments in `env.tier-agent.example`. **CHIT trail unsigned-local** (no `CHIT_PASSPHRASE` loaded in Mavis session). agent_signature: `ACK::Mavis::ARCHON-ENV-WIRING-CLAIM-2026-08-03`. + + diff --git a/pmoves/docs/specs/archon-env-wiring-2026-08-03.md b/pmoves/docs/specs/archon-env-wiring-2026-08-03.md new file mode 100644 index 0000000000..3e671f86f1 --- /dev/null +++ b/pmoves/docs/specs/archon-env-wiring-2026-08-03.md @@ -0,0 +1,132 @@ +# Archon env wiring (Issue #2217, 2026-08-03) + +> Cold-read spec for the archon live-workflow env wiring. If you are a +> fresh local model picking this work up next session, this is the +> document that tells you what shipped, why, and what's left. + +## TL;DR + +The archon service in `pmoves/docker-compose.yml` already wires most +of the live-workflow auth (CLAUDE_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, +CLAUDE_USE_GLOBAL_AUTH, GH_TOKEN) — all from the upstream +`PMOVES-Archon/.env.example`, just renamed to PMOVES conventions. The +one remaining token from Issue #2217's "Auth for live workflows" +section is `CLAUDE_BIN_PATH`, which the TS archon server uses when +spawning the Claude CLI as a subprocess. This lane adds that one +token + documents the full set in `env.tier-agent.example`. + +## Why now + +- Issue #2217's #4 ("Auth for live workflows") listed three things: + `CLAUDE_USE_GLOBAL_AUTH`, the `token` (ambiguous; either API key or + OAuth token), and `CLAUDE_BIN_PATH`. The first two are already + wired; `CLAUDE_BIN_PATH` is the only remaining piece. +- 4090-Claude is doing parallel work on the Agent Zero side + (checking latest upstream Archon and related docs). This lane + is the archon side of the same overall wiring. + +## What shipped (1 stacked commit) + +### `pmoves/docker-compose.yml` + +Add `CLAUDE_BIN_PATH=${CLAUDE_BIN_PATH:-}` to the `archon` service +env, with a 4-line comment: + +```yaml +# CLAUDE_BIN_PATH: path to the Claude CLI binary inside the container. +# Default empty (uses $PATH). The upstream Archon Dockerfile installs +# Claude at /usr/local/bin/claude; set this only if the image builds +# Claude at a non-standard path or you want to pin a specific binary. +- CLAUDE_BIN_PATH=${CLAUDE_BIN_PATH:-} +``` + +The default is empty (uses $PATH), which is correct for the standard +upstream Archon image. Operators only need to set this if they're +running a custom build. + +### `pmoves/docker-compose.agents.yml` + +Regenerated by `make -C pmoves compose-split` to reflect the new env +var on the `agents`-profile split. All other split overlays +(`core`, `media`, `ui`, `workers`, `apps`, `juicefs`) are unchanged +because they don't include the archon service. + +### `pmoves/env.tier-agent.example` + +New "Archon — Claude / gh live-workflow auth (Issue #2217)" section +that documents the full set of live-workflow tokens: + +```bash +# --------------------------------------------------------------------------- +# Archon — Claude / gh live-workflow auth (Issue #2217) +# --------------------------------------------------------------------------- +# The TS server exits(1) at boot if no Claude auth is present. The compose +# file wires the following tokens to the `archon` service env. Set at least +# one of CLAUDE_API_KEY or CLAUDE_CODE_OAUTH_TOKEN; leave the others empty. +# +# CLAUDE_BIN_PATH: path to the Claude CLI binary inside the archon container. +# Default empty (uses $PATH). The upstream Archon Dockerfile installs Claude +# at /usr/local/bin/claude; set this only if your image builds Claude at a +# non-standard path or you want to pin a specific binary. +# +# GH_TOKEN: GitHub PAT for `gh auth` inside the container. Scopes: repo, workflow. +# Non-fatal warning if absent (workflows that need gh will fail at use-time). +CLAUDE_API_KEY= +CLAUDE_CODE_OAUTH_TOKEN= +CLAUDE_USE_GLOBAL_AUTH=false +CLAUDE_BIN_PATH= +GH_TOKEN= +``` + +This makes the operator's `env.shared` setup explicit. Previously +these were scattered between the compose file and the env template +without a unified comment. + +## Validation + +- `yaml.safe_load` parses the main compose cleanly +- `make -C pmoves compose-split` reports 102/102 services across + overlays, all YAML syntactically valid +- No new failure modes introduced (the new env var has a safe default) + +## What does NOT change (intentionally) + +- **The Makefile archon targets** (`up-archon-submodule`, + `up-archon-native`, `archon-smoke`, etc.) — they don't reference + `CLAUDE_BIN_PATH`. No change needed. +- **The `archon-data` / `archon-user-home` / `archon-pg-data` + volumes** — those are persistent state, not auth. +- **The upstream `PMOVES-Archon/.env.example` additional env vars:** + - `ENABLE_AGENT_WORK_ORDERS` (no work-orders service in PMOVES yet) + - `STATE_STORAGE_TYPE` / `FILE_STATE_DIRECTORY` (same) + - `SERVICE_DISCOVERY_MODE` (single-service deployment) + - `ENABLE_DOCKER_SOCKET_MONITORING` (security risk; HTTP mode is + the default; the archon service has no Docker socket mounted) + - `MCP_HEALTH_CHECK_TIMEOUT` (operational, low-priority) + - `LOGFIRE_TOKEN` / `LOG_LEVEL` (optional, low-priority) + + We can wire these in a follow-up lane if Agent Work Orders is + ever added as a separate PMOVES service, or if the operator + wants the upstream's full env surface. + +## What's left for Issue #2217 (out of scope for this lane) + +- Issue #2217's items #1 (first-class main-compose service), + #2 (fabric wiring), #3 (DB decision), and #5 (retire the dead + Python wrapper) are all already done in earlier PRs. Item #4 + (auth for live workflows) is now complete with this commit. + +- This lane closes #2217. A follow-up AGNOTE closeout can mark it + SHIPPED. + +## Three-body + +- **delivery:** Mavis (this lane) +- **control:** DARKXSIDE (operator sets `CLAUDE_BIN_PATH` in + env.shared if needed; verifies the archon service still boots) +- **memory:** this spec + 1 commit + 1 env var + 5 lines of comments + in `env.tier-agent.example` + +## CHIT trail + +`unsigned-local` (no `CHIT_PASSPHRASE` in Mavis session).