First-run setup: credential preflight, cross-platform runner, Makefile - #7
Merged
Conversation
A first-timer can now go from clone to a rendered demo with `make setup && make run`
from the repo root — no remembering the cd's, uv flags, or which env to activate.
Directly targets the two failures from the fresh-clone screenshot:
- Stale VIRTUAL_ENV warning ("does not match .venv"): every uv call runs with
`env -u VIRTUAL_ENV` and pinned to v1/, so it always targets v1/.venv.
- "offline mode: no cached response" dead-end: the default `make run` is a golden
replay (no key, no cost, deterministic) and can't hit that wall. Live is a
separate, explicit `make live`.
Targets: setup / run / live / console / report / ui / open / doctor / test /
clean / distclean. Prereq checks for uv + npm print install hints instead of a
cryptic "command not found". The `live` guard is provider-aware (real Anthropic
key OR full Azure var set) and rejects the .env.example placeholder so a fresh
clone can't launch a doomed run. All paths are space-quoted — the repo dir name
contains a space. README Quickstart now leads with the make flow (manual steps
kept in a details block).
…legates to it
Root-caused the manager's second screenshot: a bare live run with no key either
crashes with a raw SDK TypeError ("Could not resolve authentication method") or,
if DISCOVERY_OFFLINE lingers, prints the misleading "use the golden run" message.
The .cache/ is gitignored, so a fresh clone has nothing to replay live — only the
committed golden/ does, via --golden.
Engine (behaviour unchanged for valid runs):
- run.py: credential PREFLIGHT on any non-golden (live) path. If the selected
provider has no usable creds, stop before any work with one actionable line
(add key to v1/.env / verify with doctor / or use --golden), exit 2. No
traceback, no misleading cache talk.
- env.py: missing_credentials()/credentials_present() — provider-aware (Anthropic
key OR full Azure set), and the .env.example placeholder (sk-ant-...) counts as
missing so a freshly-seeded .env fails cleanly.
- llm.py: wrap the provider calls so any auth/network SDK error becomes a clean
LLMError with the real fix; offline-mode messages now say it's cache-only
(DISCOVERY_OFFLINE) and how to go live.
Cross-platform + single source of truth:
- tasks.py (new, stdlib-only): `python tasks.py setup|run|live|console|…` works on
Mac/Linux/Windows. Strips a stray VIRTUAL_ENV before every uv call (the "does
not match .venv" warning), uses arg-list subprocess + webbrowser (space- and
OS-safe), and prereq-checks uv/npm with install hints.
- Makefile: now a thin wrapper that forwards each target to tasks.py, so make
(Mac/Linux) and tasks.py (Windows) run identical logic.
- README: Windows quickstart + a note that live preflights credentials.
Tests: +tests/test_env.py (8 cases: provider matrix, placeholder, load_env). Suite
248 passed, 100% branch coverage held, pyrefly clean (incl. tasks.py).
…reflight The engine README still led with a bare live `uv run python run.py --domain o2c` (needs a key) as the first thing to run — exactly what tripped the fresh-clone setup. Update it to match the root README: - point at `make run` / `python tasks.py run` from the root as the easy path, - lead Usage with the offline `--golden` demo (no key, no cost), - mark .env / doctor as live-only, - add the credential-preflight + gitignored-cache note.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A teammate hit setup failures on a fresh clone (two screenshots). Root-causing the second one (a bare live run) found a real engine bug, not just an ergonomics gap:
TypeError("Could not resolve authentication method"), or — ifDISCOVERY_OFFLINElingers from an earlier golden experiment — prints the misleadingoffline mode: no cached response … use the golden run. Neither tells you the real problem: your key isn't set..cache/) is gitignored, so a fresh clone has nothing to replay live. Only the committedgolden/does, via--golden.uvalso warned about a staleVIRTUAL_ENVpointing at another project's venv.This PR fixes the root cause and makes setup one command on Mac/Linux/Windows.
Engine fixes (behaviour unchanged for valid runs)
run.py) — on any non---golden(live) path, if the selected provider has no usable credentials, stop before any work with one actionable line and exit 2:env.py—missing_credentials()/credentials_present(): provider-aware (Anthropic key or the full Azure var set), and the.env.exampleplaceholder (sk-ant-...) counts as missing so a freshly-seeded.envfails cleanly instead of handing a bogus key to the SDK.llm.py— provider calls are wrapped so any auth/network SDK error becomes a cleanLLMErrorwith the real fix (no traceback); the offline-mode messages now say it's cache-only (DISCOVERY_OFFLINE) and how to go live.Cross-platform, single source of truth
tasks.py(new, stdlib-only) —python tasks.py setup|run|live|console|report|ui|open|doctor|test|clean|distclean. Works on Mac / Linux / Windows. Strips a strayVIRTUAL_ENVbefore everyuvcall (kills the "does not match.venv" warning), uses arg-listsubprocess+webbrowser(space- and OS-safe), prereq-checksuv/npmwith install hints.Makefile— now a thin wrapper that forwards each target totasks.py, somake <t>(Mac/Linux) andpython tasks.py <t>(Windows) run identical logic.Default path is keyless & free
make run/python tasks.py runis a deterministic golden replay → builds the explorer → opens it. No key, no cost, no cache-miss wall.Verified
--golden→ full success (exit 0) ✓make report/tasks.py reportwith a deliberately-staleVIRTUAL_ENVexported → no warning, golden replay completes ✓tasks.py runfull chain (report → build → open) ✓tasks.py) ✓