oficina / equipo Public

Brief: amadan git needs a PAT via Basic auth

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 494073139aa5bc267495631f7577081beb042765 parent e99d178
1 file changed, +46 −0
  • docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md +46 −0
diff --git a/docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md b/docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md
new file mode 100644
index 00000000..c1763d90
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md
@@ -0,0 +1,46 @@
+# Brief: amadan git transport needs a PAT via Basic auth, not the agent bearer
+
+Branch `forge-git-auth` from main e99d178 (deployed). Observed on
+amadan.net today:
+- Agent bearer token (minted by `amadan agent token create`) works for
+ the hub API with `Authorization: Bearer` (GET
+ /api/v1/repos/oficina/equipo/branches/main/description → 200).
+- Git smart HTTP (`https://amadan.net/oficina/equipo`) rejects
+ `Authorization: Bearer <agent token>` (git asks for a username) and
+ rejects Basic with the agent token as password ("Authentication
+ failed"). It ACCEPTS Basic with a PAT as password, any username
+ (`amadan tokens create`, run as the agent via AMADAN_HOME, says
+ "Use it as your git password ... username is ignored").
+Equipo's runner sends `http.extraHeader=Authorization: Bearer <token>`
+for git fetch/push (internal/runner/workspace/workspace.go ~250,
+internal/runner/forge/publisher.go), so every real task would fail at
+fetch.
+
+Fix:
+- Credential file (EQUIPO_AMADAN_CREDENTIAL_PATH, forgeCredentialFile
+ in internal/runner/runtime_workflow.go): add a per-repository git
+ password (PAT) alongside the API bearer, e.g.
+ {"agent": "...", "repositories": {"amadan.net/ns/repo": {"api": "<bearer>",
+ "git": "<pat>"}}}; keep reading the old string form as API-only and
+ refuse git without a PAT with a clear config issue.
+- Git transport uses `Authorization: Basic base64("x:"+pat)` via the
+ same GIT_CONFIG_* env mechanism (never on the command line, never
+ logged); API calls keep Bearer. Update forge.Credential/workspace.Remote
+ types, validation, tests (including no leak into argv, logs, journal,
+ provider sandboxes; the credential file stays a protected path).
+- Docs: how to mint both for an agent (agent token create; then
+ AMADAN_HOME=<agent home> amadan tokens create) in docs/live-gate.md or
+ README runner section (copy accepted for now; plain).
+Live check allowed: read-only `git ls-remote`/fetch of
+amadan.net/oficina/equipo through the runner's workspace code path using
+the existing file on docs-t1 after the controller converts it (do NOT
+read or print token values; the controller will convert the file). Write
+the exact conversion steps for the controller (a python snippet that
+reads ~/.local/share/equipo-runner/amadan.json and
+~/.local/share/equipo-runner/amadan-agent-home/git-pat and writes the new
+format atomically, 0600, printing nothing secret). Targeted tests, ONE
+full `make -k ci` (rerun at most twice). Commit subject < 80, body
+`Co-Authored-By: Astra <noreply@openai.com>`, push.
+CONTROLLER-REPORT-forge-git-auth.md. No deploys, no pushes to other
+repos, no provider launches. Scratch removed; no copy-review server.
+Print a five-line summary.