Skip to content

refactor: simplify env var surface; align on SWE-AF naming#35

Merged
AbirAbbas merged 1 commit into
mainfrom
refactor/normalize-env-vars
May 11, 2026
Merged

refactor: simplify env var surface; align on SWE-AF naming#35
AbirAbbas merged 1 commit into
mainfrom
refactor/normalize-env-vars

Conversation

@AbirAbbas
Copy link
Copy Markdown
Contributor

Summary

Drops five legacy env-var aliases that were side-by-side with their canonical names, and fixes a latent NODE_ID typo. Pairs with the companion PR in github-buddy that aligns its env var names on the same canonical surface.

Aliases removed (canonical replacement in parens):

  • HARNESS_PROVIDER (→ PR_AF_PROVIDER)
  • HARNESS_MODEL (→ PR_AF_MODEL)
  • AI_MODEL and PR_AF_AI_MODEL (→ PR_AF_MODEL; per-tier overrides via PR_AF_MODEL_BUDGET / _MID / _PREMIUM unchanged)
  • OPENCODE_SERVER (→ PR_AF_OPENCODE_SERVER)
  • GITHUB_TOKEN (→ GH_TOKEN)

SWE-AF (our public release with the most users) only uses GH_TOKEN and NODE_ID, so the same naming is now consistent across all three agents (github-buddy, pr-af, SWE-AF).

Latent bug fix:

src/pr_af/app.py was reading os.getenv("PR_AF", "pr-af") instead of os.getenv("NODE_ID", "pr-af"). The PR_AF env var is never set anywhere, so pr-af's registered node id silently always defaulted to "pr-af" regardless of deployer intent — fixed.

Why this is safe:

These five aliases had PR_AF_* canonical replacements that have been side-by-side for several releases. Internal deployments and the docker-compose / Dockerfile have been updated to the new names in this PR; nothing left in the repo references the removed aliases. The GitHub Actions integration in the README still references secrets.GITHUB_TOKEN (GitHub Actions' built-in secret name — that's a GitHub-side convention, not our env var, and is correctly mapped to GH_TOKEN).

Companion PR

Agent-Field/github-buddy#55 — same naming alignment in github-buddy + a workspace-level docker-compose that brings all three agents up together.

Test plan

  • ruff check src/ — clean
  • Smoke import test confirms PR_AF_MODEL propagates to both harness_model and ai_model, GH_TOKEN flows through GitHubClient and provider_env, NODE_ID registers correctly.
  • docker compose config — syntactically valid
  • No tests in tests/ on origin/main, so I couldn't run the full pytest suite against this branch directly. Against the equivalent change on the internal pr-af tree (which has the full suite), 25/25 non-cost-tracker tests pass (the one cost-tracker failure is pre-existing and unrelated).
  • Set PR_AF_MODEL / PR_AF_PROVIDER / GH_TOKEN on the Railway service before merging — the deployed container will read the new names. Drop the now-unused legacy aliases (HARNESS_MODEL, HARNESS_PROVIDER, AI_MODEL, PR_AF_AI_MODEL, OPENCODE_SERVER, GITHUB_TOKEN) after the deploy succeeds.

🤖 Generated with Claude Code

pr-af shared three legacy env-var aliases with its newer canonical
names. They've been side-by-side for a while; this drops the legacy
side now that nothing reads them.

**Removed (with the still-supported replacement):**
- `HARNESS_PROVIDER` → `PR_AF_PROVIDER`
- `HARNESS_MODEL` → `PR_AF_MODEL`
- `AI_MODEL` / `PR_AF_AI_MODEL` → `PR_AF_MODEL` (the .ai() / .harness()
  splits both fall back to the same value; per-tier overrides via
  `PR_AF_MODEL_BUDGET` / `_MID` / `_PREMIUM` are unchanged)
- `OPENCODE_SERVER` → `PR_AF_OPENCODE_SERVER`
- `GITHUB_TOKEN` → `GH_TOKEN` (matches SWE-AF, the public release with
  the most users — github-buddy is being aligned in parallel)

**Also fixes a latent typo:** `NODE_ID` was being read as `PR_AF`
(`os.getenv("PR_AF", "pr-af")` at app.py:27). The `PR_AF` env var is
never set anywhere, so pr-af's registered node id always silently
defaulted to `"pr-af"` regardless of any deployer's intent. Now reads
`NODE_ID` like the other agents on the stack.

Dockerfile + docker-compose updated to match. README + docs/DX.md
references to `GITHUB_TOKEN` (as a description of pr-af's own env var)
updated to `GH_TOKEN`. References to GitHub Actions' built-in
`secrets.GITHUB_TOKEN` are unchanged — that's a GitHub-side convention
we don't control.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AbirAbbas AbirAbbas merged commit f831192 into main May 11, 2026
2 checks passed
@AbirAbbas AbirAbbas deleted the refactor/normalize-env-vars branch May 11, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant