feat: rename CF_ORCH_URL to GPU_SERVER_URL for self-hoster clarity #14

Merged
pyr0ball merged 2 commits from fix/gpu-server-url-rename into main 2026-07-10 19:34:20 -07:00
Owner

Summary

Closes #10 (and #9, closed as a duplicate). Follows the GPU_SERVER_URL convention already established in Kiwi's app/core/config.py.

  • app/config.py resolves GPU_SERVER_URLCF_ORCH_URL (back-compat alias) → https://orch.circuitforge.tech default when CF_LICENSE_KEY is present (Paid+ tiers), written back to os.environ["CF_ORCH_URL"] so existing callers need zero changes.
  • .env.example / .env.cloud.example document GPU_SERVER_URL as primary, CF_ORCH_URL noted as still-honoured legacy alias.
  • compose.cloud.yml's hardcoded coordinator URL now sets GPU_SERVER_URL.
  • docs/reference/environment-variables.md updated.

Test plan

  • pytest tests/ -q — 63 passed (6 new tests covering the priority chain + write-back behavior)
  • Manual: not yet verified against a live cf-orch coordinator (only unit-tested against the env var resolution logic)
## Summary Closes #10 (and #9, closed as a duplicate). Follows the `GPU_SERVER_URL` convention already established in Kiwi's `app/core/config.py`. - `app/config.py` resolves `GPU_SERVER_URL` → `CF_ORCH_URL` (back-compat alias) → `https://orch.circuitforge.tech` default when `CF_LICENSE_KEY` is present (Paid+ tiers), written back to `os.environ["CF_ORCH_URL"]` so existing callers need zero changes. - `.env.example` / `.env.cloud.example` document `GPU_SERVER_URL` as primary, `CF_ORCH_URL` noted as still-honoured legacy alias. - `compose.cloud.yml`'s hardcoded coordinator URL now sets `GPU_SERVER_URL`. - `docs/reference/environment-variables.md` updated. ## Test plan - [x] `pytest tests/ -q` — 63 passed (6 new tests covering the priority chain + write-back behavior) - [ ] Manual: not yet verified against a live cf-orch coordinator (only unit-tested against the env var resolution logic)
pyr0ball added 2 commits 2026-07-10 17:23:41 -07:00
When CF_ORCH_URL is set, chat now calls CFOrchClient.task_allocate("pagepiper",
"rag_query") instead of routing through LLMRouter with an explicit model. The
coordinator resolves the assignment (granite-4.1-8b via assignments.yaml) and
returns an allocated URL; pagepiper wraps it in a minimal LLMRouter config for
the Synthesizer. Falls back to LLMRouter on TaskNotFound or allocation failure,
so standalone Ollama installs are unaffected.

Extracts _run_chat() and _build_llm_for_alloc() helpers to keep the endpoint
body readable regardless of which path fires.
CF_ORCH_URL makes sense internally but isn't self-explanatory for a
local-first user setting up their own GPU rig. Follows the GPU_SERVER_URL
convention Kiwi already established (app/core/config.py there).

- app/config.py: resolves GPU_SERVER_URL -> CF_ORCH_URL (back-compat
  alias) -> https://orch.circuitforge.tech default when CF_LICENSE_KEY
  is present (Paid+ tiers). Written back to os.environ["CF_ORCH_URL"]
  so existing callers (get_llm_config, app/api/chat.py) needed zero
  changes.
- .env.example / .env.cloud.example: document GPU_SERVER_URL as the
  primary name, CF_ORCH_URL noted as a still-honoured legacy alias.
- compose.cloud.yml: the hardcoded coordinator URL now sets
  GPU_SERVER_URL instead of CF_ORCH_URL directly (relies on the same
  config.py normalization).
- docs/reference/environment-variables.md updated.
- 6 new tests covering the resolution priority chain and the
  write-back behavior legacy callers depend on.

Closes: #10
pyr0ball added 1 commit 2026-07-10 19:25:21 -07:00
Found during freeze-branch integration testing (PR #12 + #14 + #15
combined): app/config.py's write-back (os.environ["CF_ORCH_URL"] =
GPU_SERVER_URL) is a module-level side effect monkeypatch never tracks,
so it wasn't being reverted between tests. Once any test_config.py test
set a truthy GPU_SERVER_URL/CF_LICENSE_KEY, the resulting CF_ORCH_URL
wrote leaked into every later test in the same pytest session.

This silently broke all five "skips_embeddings_without_ollama_url"
tests across the shelve_*.py suite (pdf, docx, odt, ods, xlsx) — their
get_llm_config() check no longer saw a clean "nothing configured" state,
so they attempted embedding instead of skipping it. Neither PR #12 nor
#14 alone exercised this combination in the same test session, so it
only surfaced once merged together.

Fix: explicitly pop CF_ORCH_URL/GPU_SERVER_URL/CF_LICENSE_KEY from
os.environ in the autouse teardown fixture before reloading app.config,
rather than relying on monkeypatch to catch a write it never made itself.
pyr0ball merged commit c684f347e9 into main 2026-07-10 19:34:20 -07:00
Sign in to join this conversation.
No reviewers
No labels
backlog
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/pagepiper#14
No description provided.