headroom/tests/test_install
Tejas Chopra 36f4f27be3 fix(install): default to cache mode, matching headroom proxy (#1893 follow-up)
#1893 shipped the coding/cache posture as Headroom's out-of-box default, but it
only touched `cli/proxy.py` and `proxy/server.py`. The install path kept the older
`token` default from #1404 / the persistent-install work, so the two entry points
disagreed:

  * `headroom proxy`  -> `mode or HEADROOM_MODE or PROXY_MODE_CACHE` (cache)
  * `proxy/server.py` -> `HEADROOM_MODE` env default is cache, commented
    "delta-only compression at ~0 prefix-cache busts"
  * `headroom install` / `headroom deploy` -> `--mode` defaulted to token

That last one is not a passive difference. `install/planner.py` writes
`"HEADROOM_MODE": proxy_mode` into the install base env, so installing Headroom
ACTIVELY OVERRODE the good server default with the cache-busting one. Cache mode
freezes prior turns and compresses only the newest delta, keeping the cached
prefix byte-identical; token mode rewrites frozen history, which moves the bytes
the provider hashed and forces a full cold re-write of the whole prefix.

Verified this is an oversight rather than a deliberate divergence: `git show`
confirms #1893 (68676daa) touched agent_savings.py, cli/proxy.py and
proxy/server.py only — neither `cli/install.py` nor `install/` was in the diff.

Changed: both `--mode` defaults (install_apply, deploy) and the
`DeploymentManifest.proxy_mode` field default, so a manifest that omits the field
no longer falls back to token either. `--mode token` remains fully available for
anyone who wants maximum compression and accepts the busts; the option type is
unchanged (free text through `normalize_proxy_mode_value`).

New `tests/test_install/test_proxy_mode_default.py` pins the agreement between the
two entry points — the guard that was missing when #1893 landed, so this cannot
drift apart again.

NOTE ON EXISTING INSTALLS: a manifest already on disk has `proxy_mode: "token"`
serialized explicitly, so it keeps token until it is re-applied. The immediate
remedy for those users is `HEADROOM_MODE=cache` in the environment, or re-running
install with `--mode cache`. This commit fixes the default going forward; it does
not migrate existing manifests.

Testing: pytest tests/test_install/ tests/test_proxy_mode_policy.py -> 146 passed,
2 skipped (5 new). ruff + mypy clean.
2026-07-25 14:17:56 -07:00
..
test_codex_install.py fix(codex): detect keyring-backed ChatGPT auth (#2478) 2026-07-22 06:09:31 -07:00
test_health.py test: expand persistent install coverage 2026-04-11 18:24:15 -05:00
test_native_installers.py fix: B1 — retire ICM, RollingWindow, scoring, relevance + dependents 2026-05-02 12:23:17 -07:00
test_paths.py ci: restore green lint (reformat for ruff 0.15.17, fix mypy no-any-return, pin linters) (#1295) 2026-06-22 15:14:40 -05:00
test_planner.py feat(install): add apply flag parity, --env passthrough, and EIO retry (#2152) 2026-07-14 14:10:39 -04:00
test_providers.py fix(codex): rewrite config.toml properly so Codex will route through … (#2102) 2026-07-14 11:53:24 -04:00
test_proxy_mode_default.py fix(install): default to cache mode, matching headroom proxy (#1893 follow-up) 2026-07-25 14:17:56 -07:00
test_runtime.py feat(deploy): Add turnkey deploy command (#1404) 2026-07-15 18:37:20 +00:00
test_state.py fix(install): migrate deployments off the retired chopratejas image repo (#2427) 2026-07-19 22:15:01 -07:00
test_supervisors.py feat(install): add apply flag parity, --env passthrough, and EIO retry (#2152) 2026-07-14 14:10:39 -04:00