feat(reviewer): cloud Ollama bearer auth via OLLAMA_API_KEY env #60
No reviewers
Labels
No labels
agent/claude-code
agent/codex
agent/gemini
agent/hermes
agent/iskra
agent/ollama
agent/patchwarden
area:business-model
area:competitive
area:discovery
area:forgejo
area:metrics
area:product-strategy
area:v0-core
cagan-grade-approved
client:platform
dependency/blocked
dependency/blocks-others
dependency/cross-repo
dependency/needs-confirmation
domain:agents
domain:ci
domain:docs
domain:forgejo
domain:infra
domain:memory
domain:runtime
domain:signal
domain:ux
flow/architecture
flow/blocked
flow/deployed
flow/done
flow/implementation
flow/intake
flow/maintained
flow/observed
flow/ready
flow/refining
flow/retired
flow/review
judge/codex-candidate
judge/hermes-candidate
judge/low-confidence
judge/needs-refinement
judge/operator-needed
judge/p0
judge/p1
judge/p2
judge/p3
judge/park
judge/patchwarden-candidate
judge/stale-priority
kind/adr
kind/bug
kind/chore
kind/feature
kind/infra
kind/ops
kind/refactor
kind/research
kind:artifact
kind:decision
kind:dogfood
kind:epic
kind:implementation
kind:research
merge/auto
merge/manual
merge/manual-dependency-conflict
merge/manual-failing-tests
merge/manual-merge-conflict
merge/manual-missing-review
merge/manual-operator-preference
merge/manual-red-zone
merge/manual-security-sensitive
merge/manual-unclear-scope
merge/manual-unknown
mode:operator-only
mode:patchwarden-iskra-approved
mode:safe-auto
observed/erroring
observed/needs-followup
observed/pending
observed/retire-candidate
observed/unused
observed/used
priority:p0
priority:p1
priority:p2
priority:p3
ready-for-agent
review:claude-reviewed
review:codex-reviewed
review:dziadek-reviewed
review:needs-human
safety:external-write
safety:no-prod-mutation
safety:prod-impact
safety:secret-touch
size/large
size/medium
size/small
size/tiny
size/unknown
source/adr
source/agent-generated
source/manual
source/operator-chat
source/voice-note
status:blocked
status:blocked-on-discovery
status:cagan-grade-review-pending
status:codex-ready
status:merged:pending-evidence
status:needs-evidence
status:needs-operator-decision
status:operator-needed
status:parked
tier:0-anchor
tier:0-platform-substrate
tier:1-core
tier:1-iskra-value-layer
tier:2-supporting
tier:2-tools-products-modules
type:bug
type:chore
type:docs
type:feat
type:policy
type:research
wave:1-foundation
wave:2-positioning
wave:3-validation
wave:4-economics
wave:5-operating
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pdurlej/patchwarden!60
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/feat-cloud-ollama-auth"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
pdurlej/platform#527smoke test for theplatform#524wave revealed thatpatchwarden review-run, even after theMERGE_BASEworkflow fix (platform#528), hitsConnection refusedagainst127.0.0.1:11434— there's no local Ollama on the runner andollama_client.pyhad no way to authenticate against cloud Ollama. The reviewer lane is wired but cannot actually produce findings without local Ollama deployment.This PR adds the missing pluming: optional bearer-token auth + env-var-driven endpoint override. Together with a runner-local
PLATFORMCTL_CANARY_ENVsettingOLLAMA_API_KEY(sourced frominfisical:/home-platform/providers/OLLAMA_CLOUD_API_KEY) andOLLAMA_BASE_URL=https://ollama.com, the workflow can target cloud Ollama without changing the lane config or CLI invocation.What changes
src/patchwarden/ollama_client.pyOllamaRequest.api_key: str | None = None._attemptbuilds the headers dict (Content-Type always; Authorization: Bearer when api_key truthy)._urllib_transportsignature gainsheadersparameter and forwards it verbatim tourllib.request.Request.Transporttype updated accordingly.src/patchwarden/review_run.py_findings_from_ollamareadsOLLAMA_BASE_URL+OLLAMA_API_KEYfromos.environand passes them toOllamaRequest. Both optional — unset leaves the dataclass defaults (127.0.0.1:11434, no auth) intact.tests/test_ollama_client.pyheadersparameter. NewAuthHeaderTests(4 tests).tests/test_review_run.pyBackward compatibility
OLLAMA_API_KEYset → noAuthorizationheader → request looks identical to today's traffic.OLLAMA_BASE_URLunset → falls back toOLLAMA_DEFAULT_BASE_URL = "http://127.0.0.1:11434".OLLAMA_API_KEY=""(common env-var artifact) explicitly treated as no auth — never emits a malformedBearerheader.D20 sovereignty
Unchanged. This is transport plumbing only. The model still only suspects; Patchwarden's deterministic policy gate still decides merge eligibility. No new authority, no APPROVED path, no merge endpoint —
tests/test_d20_architectural_boundary.pystill passes.D21 (M2 amendment) compatibility
This is wiring of an existing capability to a different endpoint, not a new core capability. It does not add a new CLI subcommand, does not change schema versions, does not bind new runtime deps (stdlib-only urllib already in use), does not expand the dogfood lane. It enables the existing Ollama call path to function in the actual deployment environment per
platform#527evidence.Tests
152 baseline + 4 new
AuthHeaderTests:test_no_api_key_omits_authorization_header— default path stays unauthenticatedtest_api_key_sets_bearer_authorization_header— Bearer token format correcttest_api_key_propagated_on_fallback_attempt— fallback reuses authtest_empty_string_api_key_treated_as_no_auth— empty env-var artifact safeSmoke evidence after merge (planned)
PLATFORMCTL_CANARY_ENVfile with:OLLAMA_API_KEY=<infisical OLLAMA_CLOUD_API_KEY value>OLLAMA_BASE_URL=https://ollama.com(or whichever cloud endpoint)pdurlej/platform#527re-runs (push empty commit forsynchronize).review-runreaches Ollama with auth → either gets real findings OR a meaningful HTTP response (not connection refused).post-findings --executeposts a comment to#527— evidence-confirmed full loop.pdurlej/patchwardenupdatesdocs/operations/dogfood-actual-vs-mental-model.mdto mark Luka 1+2 as evidence-confirmed.Refs:
pdurlej/platform#527,pdurlej/platform#528,pdurlej/patchwarden#48 #49 #54