Skip to content

feat(settings): persist headroomUrl for the Headroom proxy - #12487

Merged
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.51from
HouMinXi:feat/12306-headroom-url
Sep 3, 2026
Merged

diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.51from
HouMinXi:feat/12306-headroom-url

Conversation

@HouMinXi

@HouMinXi HouMinXi commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Settings currently drops headroomUrl on PATCH because the field is missing from updateSettingsSchema. Status and start already read that key, so a custom Headroom URL never survives a save.

This PR:

  • Adds headroomUrl to the settings schema (empty = HEADROOM_URL / localhost:8787; whitespace-only trims to empty; http(s) only; max 500).
  • Adds a Headroom card on Advanced settings: URL field, save, start, stop.
  • Rejects javascript: / file: / data: / malformed http:// via isHttpUrl.

Closes #12306

Test plan

DISABLE_SQLITE_AUTO_BACKUP=true node --import tsx/esm --import ./open-sse/utils/setupPolyfill.ts --import ./tests/_setup/isolateDataDir.ts --test --test-force-exit tests/unit/headroom-url-settings-12306.test.ts tests/unit/headroom-proxy-lifecycle.test.ts

20/20 pass. Also checked: drop the trim pipe → whitespace-only test fails; drop the saveAc.current === ac guard → source assertion fails.

Notes for reviewers

  • cliproxyapi_url next to the new field still uses z.string().url() with no http(s) refine. That line is from v3.8.4 (b91ffa7f7); not touched here.
  • .url() plus isHttpUrl is layered on purpose: Zod's URL parser still accepts javascript:; the refine is the scheme gate used by probeProxyRunning (fetch(${url}/health)).
  • i18n keys reuse settingSaveFailed / settingSaved. No new locale strings required beyond the card copy already in this commit.

Not in this PR

  • Changing CLIProxyAPI URL scheme policy
  • Headroom CLI install / binary itself

Status and start already read settings.headroomUrl, but PATCH
stripped the key because it was missing from updateSettingsSchema.
Keep the URL in settings, add a Settings > Advanced card, and
refuse to spawn against a non-loopback URL (existing start route).

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@HouMinXi
HouMinXi force-pushed the feat/12306-headroom-url branch from aedc39c to 13fec05 Compare September 3, 2026 12:37
@HouMinXi

HouMinXi commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto release/v3.8.51 @ 2c4ad3e55.

Upstream retired src/i18n/messages/in.json (#12496). This PR had keys in that file; dropped it and kept the remaining locales. Head is now 13fec0502.

react-hooks/set-state-in-effect flagged the mount fetch. Load settings
and status in an async continuation. Fill Vietnamese Headroom strings
so i18n-vi-completeness no longer sees __MISSING__ sentinels.
@diegosouzapw
diegosouzapw merged commit 35caeb3 into diegosouzapw:release/v3.8.51 Sep 3, 2026
14 of 16 checks passed
@HouMinXi
HouMinXi deleted the feat/12306-headroom-url branch September 16, 2026 13:39
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…apw#12487)

Validado em lote numa worktree combinada com os 9 PRs desta leva sobre o tip de `release/v3.8.51`: `typecheck:core` limpo, `check:provider-consistency` OK (273 entradas REGISTRY, **356** providers canônicos), `check-docs-counts-sync` exit 0 e **300/300** nos testes que a leva toca.

O crescimento de arquivo que os PRs empilham uns sobre os outros foi rebaselinado num único registro datado (`_rebaseline_2026_09_03_houminxi_batch`), com a decomposição por arquivo: `providers/page.tsx` +18 (import CSV do diegosouzapw#12504 + busca do diegosouzapw#12495 no mesmo painel), `accountFallback.ts` +6 (o diegosouzapw#12566 sobre o rebaseline que o diegosouzapw#12590 já registrou — os dois tocam `checkFallbackError`) e `chatCore.ts` +3 (invalidez de cache de quota no 429 do diegosouzapw#12325). As violações restantes (`codex.ts`, `stream.ts`) foram medidas também no tip puro e são drift da base, não desta leva.
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.

feat(backend): configurable Headroom server URL for compression

2 participants