Commit Graph

106 Commits

Author SHA1 Message Date
Diego Rodrigues de Sa e Souza
0cb9a7c288 test(dashboard): close the UI kit test and infra follow-ups (#18079) (#19397)
- burn-rate-chart: pay the cold BurnRateChartInner import in beforeAll, so the
  first test no longer times out on a loaded host
- typecheck:core includes src/shared/constants/iconMap.ts (TS2300 on duplicates)
- accent-ink guard checks pairs across separate ${...} expressions
- icon codemod keeps a directive first when code follows it on the same line
- vitest maps the kit's renamed exports (styles.css, tokens.css, brand) explicitly
- Playwright expect timeout is 30 s locally, as in CI

Refs #18079
2026-11-09 11:34:11 -03:00
小妍儿 ✨
cb55651736 feat(api): import caller-supplied gateway API keys atomically (#18010)
## Summary

Add `POST /api/keys/import` so a management client can provision the same caller-supplied gateway key on multiple instances without invoking whole-database restore.

- Required `key`/`name`, optional UUID `id`; inherits every create-policy field and refinement through `createKeySchema.safeExtend`.
- Same management authentication as key creation, including `admin` access-token scope and the open-mode management-key credential requirement.
- One synchronous SQLite IMMEDIATE transaction checks identity and inserts the complete policy. Existing explicit id + same value is a read-only retry (200); conflicting id/value is 409 without another id or secret in the response; new import is 201.
- Existing crypto helpers supply encrypted-at-rest storage when configured, hash and prefix. Responses whitelist masked key + stored policy. Environment/self-loop credential collisions are rejected. New imports trigger best-effort asynchronous cloud sync.
- No rekey, settings/provider/combo/session import, or changes to `import-json` authorization. Existing creation remains server-generated.

Closes #18005

## Target branch and design

Thanks @xiaoyaner0201.
2026-11-08 18:33:03 -03:00
Minxi Hou
55342ab3ac fix(ws): bound /v1/ws frame input and keep buffering linear (#19113)
fix(ws): bound /v1/ws frame input and keep buffering linear

Evidence: combined board on release/v3.8.54: 147 node:test and 11 vitest cases passed across the lot's test files; eslint, typecheck:core and open-sse typecheck clean; file-size OK; changelog integrity OK against origin/release/v3.8.54.
2026-11-06 17:59:30 -03:00
Seizethewind
37022cbc42 feat(render): add 180s self-pinger to keep the free web service awake (#18656)
Adds an optional self-pinger for the Render free tier. It stays inert unless a URL is configured: no timer, no request, no log.

Maintainer rework: config and pinger moved to `scripts/build/runtime-env.mjs` (already shipped in the standalone bundle); `SELF_PING_PATH` can no longer replace the host; logs only on status changes; env vars documented in `.env.example` and ENVIRONMENT.md; 24 tests.

Evidence: removing the path guard fails 3 tests. Gate / CI, Gate / Quality and Merge integrity green on this head. Not exercised on a real Render service.
2026-11-02 14:00:28 -03:00
Bob.Hou
26092708fc fix(tls): follow the newest wreq-js browser profile in the web providers (#17869) 2026-10-29 04:29:24 -03:00
Diego Rodrigues de Sa e Souza
7336e1e611 chore(dashboard): sync the CI UI Kit to 0.0.79 and keep tracking the newest release (#18504) 2026-10-28 22:43:25 -03:00
Diego Rodrigues de Sa e Souza
c80074cac5 fix(api): stop keyless cross-origin reads on the client API and inference WebSockets (#18512)
HTTP: on a keyless install (REQUIRE_API_KEY=false) any Authorization, x-api-key or x-goog-api-key header, valid or not, made client-API routes echo the request Origin while serving the request as anonymous. The allow path now relaxes CLIENT_API CORS only for a non-anonymous subject; route-level 401s that refuse a presented key still echo Origin (Vary: Origin, no credentials header) so browser clients can read them (#5242).

WebSocket: browsers do not apply CORS to WebSockets and the /v1/responses, /v1/ws and /api/v1/ws handshakes never read Origin. They now admit no-Origin clients, CORS-allowlisted origins, the gateway's own public origin and handshakes with a valid API key; everything else, null included, gets 403 ws_origin_forbidden. The bridge upgrades only when the route answers originChecked: true. /v1/responses now enforces REQUIRE_API_KEY. The service worker also bypasses the client-API aliases. CORS and PWA guide mirrors refreshed.

Co-authored-by: HouMinXi <19586012+HouMinXi@users.noreply.github.com>
2026-10-28 21:46:59 -03:00
diegosouzapw
91ad72a8cb test(e2e): make npm run test:e2e -- <spec> filter and align @playwright/test with playwright
The test:e2e script passed tests/e2e/*.spec.ts ahead of the caller's arguments, so
`npm run test:e2e -- <spec>` still ran every spec. The script now calls the runner with no
glob; the runner forwards spec paths and flags as `test` arguments and defers to the
config's testDir/testMatch when called bare.

The runner also spawned the runtime `playwright` 1.62.1 CLI while specs import
`@playwright/test` 1.63.0 ("did not expect test() to be called here"). It now spawns the
@playwright/test CLI (what `npx playwright` resolves to in CI), and @playwright/test is
pinned to 1.62.1, the exact runtime pin, so the lockfile carries one Playwright.

check-test-discovery anchors the e2e collector on the new script and playwright.config.ts;
gate-manifest follows the script. tests/unit/playwright-runner-args.test.ts guards the
argument building and the version pin (KEA-7886 follow-up, P19a).
2026-10-25 17:17:22 -03:00
diegosouzapw
a981407d5a chore(uikit): back-merge release/v3.8.53 into feat/new-uikit (Task 43)
Conflicts resolved mechanically: the release side only renamed github.com/diegosouzapw/OmniRoute links to cheaper-inference/OmniRoute (#17871) in QuotaSharePageClient, providers/page, privacy and terms; applied the rename on the migrated markup. src/shared/components/Footer.tsx stays deleted (dead shared Footer removed in F4, pinned by dashboard-kit-sweep).
2026-10-22 05:34:31 -03:00
diegosouzapw
e0d613861e fix(dashboard): F4 — distinct missing-icon glyph, CDN guard, coverage hint
Review follow-ups for KEA-7886 F4-A:
- M1: an unmapped <Icon> name draws SquareDashedBottom (exported as MISSING_ICON_GLYPH)
  instead of CircleDashed, which is ICON_MAP.pending; a test pins that the placeholder
  is neither an ICON_MAP value nor the same drawing as one.
- M2: restore the #3695 guard lost with material-icons-self-hosted.test.ts: neither
  src/app/layout.tsx nor globals.css loads fonts from fonts.googleapis/gstatic.com.
- M3: icon-map-coverage and gen-icon-map point non-icon strings to NOT_ICON_NAMES
  instead of a fake Lucide mapping.
- N6: resolveIcon resolves own keys only (constructor/toString return null), pinned.
- N1/N2: stale dashboard-layout-flag reference; single-file loop inlined.
2026-10-22 02:33:46 -03:00
Diego Rodrigues de Sa e Souza
8162d1e7ab chore: point workflows, scripts and functional links at cheaper-inference/OmniRoute (#17871) 2026-10-21 23:06:06 -03:00
diegosouzapw
677bf405b3 refactor(dashboard): Icon renders Lucide only; unmapped names draw a placeholder (KEA-7886, F4)
The <Icon> adapter loses its Material ligature fallback: a name missing from ICON_MAP
renders a neutral CircleDashed glyph (data-icon-missing, same a11y) and warns once
outside production. The 32 remaining null entries of ICON_MAP are mapped to Lucide
(ICON_MAP is now Record<string, LucideIcon>). gen-icon-map no longer reads the
vocabulary from the material-symbols package: every scanned name must map to Lucide,
except a documented NOT_ICON_NAMES list (provider logo keys, a size key), and the
data-*-icon attributes are no longer mistaken for icon props.
2026-10-21 22:30:43 -03:00
diegosouzapw
509ba40edb fix(dev): icon codemod keeps the use-client directive first and reports multi-line dynamic spans (KEA-7886)
The import is now inserted after the directive prologue (leading comments + "use client"/'use server' lines) instead of at offset 0, with a guard that throws if the output's directives differ from the input's. Leftover detection scans whole JSX opening tags (brace/string aware) instead of single lines, so multi-line dynamic spans are reported at their <span line and the CLI exits 2; multi-line spans with a static className (including {`...`} without ${}) are normalised and converted.
2026-10-21 03:37:16 -03:00
diegosouzapw
1a6df39e9e Merge remote-tracking branch 'origin/feat/new-uikit' into feat/new-uikit-A
# Conflicts:
#	package.json
2026-10-20 02:53:52 -03:00
diegosouzapw
9381f94d8b fix(dashboard): codemod leftover detection across files, scanner sees <Icon name> (KEA-7886, trilha B) 2026-10-19 22:29:23 -03:00
diegosouzapw
7bcfe80d5c build(dashboard): ui-kit follow-ups — brand export path, snapshot gate hardening, pre-commit hook (KEA-7886) 2026-10-19 22:26:17 -03:00
diegosouzapw
383c5dc5d4 build(dashboard): vendor the CI UI Kit as packages/ui-kit with sync script and snapshot gate (KEA-7886) 2026-10-19 22:16:26 -03:00
diegosouzapw
747c9a1b63 chore(dashboard): codemod for Material Symbols spans → <Icon> (KEA-7886, trilha B) 2026-10-19 21:55:31 -03:00
diegosouzapw
aa40469fd6 chore(dashboard): icon-map generator validates names against the Material vocabulary and prunes non-icon keys (KEA-7886, trilha B) 2026-10-19 21:55:14 -03:00
diegosouzapw
f7cff7980a feat(dashboard): <Icon> adapter with Material→Lucide map and fallback (KEA-7886, trilha B) 2026-10-19 21:16:35 -03:00
Diego Rodrigues de Sa e Souza
5470b56b3c chore(dev): read-only PR babysitting helpers — ci-discriminate.sh and audit-worktree.sh (#16903)
Merged via /merge-batch (2026-10-16 wave, maintainer PRs). Validated on a second combined board of 8 PRs over release/v3.8.52@16d9205b8: typecheck:core, open-sse typecheck, eslint on changed files, file-size, changelog-integrity, complexity, cognitive-complexity, env-doc-sync and agent-skills-sync all green; focused tests 249/250 (node:test; the one red, kiro-content-stall-15260, passes 3/3 isolated — a 100 ms stall-timer flake under load) + 16/16 (vitest UI); boundary 774 = tip (inherited base-red). Remaining CI reds are the inherited base-red #15306.
2026-10-17 00:34:30 -03:00
Diego Rodrigues de Sa e Souza
16d87339d3 chore(dev): typecheck-touched.sh and a concurrency-safe new-worktree.sh (#16905)
Merged via /merge-batch (2026-10-16 wave, maintainer PRs). Validated on one combined board of 20 PRs over release/v3.8.52@76e905b15: typecheck:core, open-sse typecheck, eslint on changed files, file-size, changelog-integrity, complexity, cognitive-complexity, env-doc-sync and agent-skills-sync all green; focused tests 263/263 (node:test) + 26/26 (vitest UI). Remaining CI reds are the inherited base-red #15306.
2026-10-16 23:58:24 -03:00
Caio Figueiroa
050903dcef fix(ci): stop spawning npx.cmd/npm.cmd without a shell on Windows (#16581)
Thanks @shipsfromrio.

Validated in local merge-train merge-train-20261016-020918 on devbox-vm-06-dev002 @ 86de1a0e. Fast gates green. Inherited typecheck:core and i18n drift match origin/release/v3.8.52 (#15306). Focused node tests and vitest passed.
2026-10-16 02:27:15 -03:00
Tiago Rodrigues da Rosa
d29e000699 fix(server): answer cleartext h2c upgrade requests in HTTP/1.1 instead of dropping them (#16514)
Thanks @tiagolabsit.

Validated in local merge-train merge-train-20261016-020918 on devbox-vm-06-dev002 @ 86de1a0e. Fast gates green. Inherited typecheck:core and i18n drift match origin/release/v3.8.52 (#15306). Focused node tests and vitest passed.
2026-10-16 02:27:09 -03:00
OmnitrixDev
71ff9efe85 fix(docker): apply #5172 heap auto-calibration in standalone launcher (#16343) (#16498)
Thanks @omnitrixAG — the standalone launcher applies the heap auto-calibration.

Validated in local merge-train .claude/worktrees/merge-train-20261015-235925 on devbox-vm-06-dev002 @ cb939401be036aa8caa1a9a972b0f13d85f5c914. Static gates green except inherited typecheck:core (same errors on origin/release/v3.8.52) and inherited i18n translation drift. Focused node tests passed. Vitest 499 passed; 1 timeout in provider-family-combos auto/glm (20s). Isolated rerun of that file passed 2/3, third was the same timeout, not an assertion. These PRs do not touch autoCombo. Inherited base-red #15306. Fast train: daily full unit suite still required.
2026-10-16 00:29:15 -03:00
Junior-HJ
dd6b7cf6d5 fix(server): enable TCP keepalive on accepted connections (#16396)
Thanks @Junior-HJ — accepted connections now enable TCP keepalive. The change is in `src/shared/utils/runtimeTimeouts.ts` plus the dev server scripts, covered by the three main-server keepalive and timeout-parity tests.

Boarded together on release/v3.8.52 at 4833845bda. Focused unit tests: 133 passed, 0 failed (`node --import tsx/esm --test --test-force-exit`). File-size gate: only the inherited `open-sse/services/combo/executeTargetAttempt.ts` overage (1288 > frozen 1284), unchanged by this pull request.

⚠️ base-red inherited: #15306
2026-10-13 08:01:25 -03:00
Diego Rodrigues de Sa e Souza
cff1461877 feat(dev): local candidate build/validate/promote loop with rollback (rail 3.8.53, #8084 local side) (#16180)
* feat(dev): local candidate build/validate/promote loop with rollback

Add scripts/dev/candidate.mjs (npm run dev:candidate), the local side of
RFC #8084: build one candidate from the current tree (npm pack) or a
prebuilt tarball into an isolated npm prefix under _artifacts/candidate/<id>,
boot that packaged CLI on a free port with an isolated DATA_DIR and fake
secrets, require /api/health and /v1/models to answer 200, promote the same
validated artifact with compensated renames, and roll back automatically
when the promoted slot fails its health check. Every command supports
--dry-run and --json; child processes use argument arrays only (Hard Rule #13).

stopChild is now exported from check-pack-boot.mjs so the loop reuses the
same process-group shutdown instead of duplicating it.

* docs(ops): document the local candidate loop in the golden path and release checklist

* fix(dev): isolate the candidate boot from operator .env files

The first real validate run against the published 3.8.51 tarball booted and
answered /api/health, but /v1/models returned 401: the packaged CLI fills
undefined keys from <packageRoot>/.env (postinstall copies .env.example with
INITIAL_PASSWORD=CHANGEME), and any password is a credential surface for the
model catalog. It also reads the default data dir's .env, derived from
HOME/XDG_CONFIG_HOME/APPDATA, i.e. the operator's real ~/.omniroute/.env.

The candidate now gets an isolated HOME (plus XDG/APPDATA) under its slot,
INITIAL_PASSWORD pinned to an empty value, a fresh DATA_DIR on every
validation, and --log so failures show server output. run --dry-run no
longer claims the candidate is active.
2026-10-10 09:56:00 -03:00
Alejandro Ramírez
65963f4efd feat(providers): add vendor-drift tooling for codex-chatgpt-web (#14194) (#14719)
Validated in a combined board with the other PRs of this wave on release/v3.8.52: the PR's own tests pass; typecheck:core, open-sse typecheck, api-typecheck, complexity, changelog-integrity, env-doc-sync, test-discovery, vitest-exclusions, error-helper, test-masking, lockfile, deps, gate-manifest, cli-i18n and i18n coverage green. Any file-size ceiling or stryker registration this wave needs lands in the wave's follow-up PR. Thank you for the contribution!
2026-10-08 11:39:25 -03:00
QuangBlue
f12801da0f fix(api): standalone server owns SIGTERM so graceful-shutdown cleanup runs (#15331)
Onda 6. Este squash entra com o crédito de @QuangBlue (fix(api): standalone server owns SIGTERM so graceful-shutdown cleanup runs).

O board único validou os 19 PRs (sem o #15412): file-size OK, changelog OK, i18n drift OK, typecheck:core OK, complexity e cognitive dentro do baseline. Testes focados: 390 passaram, 1 skip. O teste novo de GHE Copilot Sonnet 5.5 falhou no head original e foi corrigido no board; esse ajuste entra com o #15478, fora deste squash.

O rebaseline de file-size e o adopt de i18n ficam num follow-up.

⚠️ base-red inherited: #15306

Obrigado, @QuangBlue.
2026-10-06 19:25:09 -03:00
QuangBlue
bdaa86ce2a fix(api): keep Next's upgrade listener off the run-next server (#15332)
Onda 6. Este squash entra com o crédito de @QuangBlue (fix(api): keep Next's upgrade listener off the run-next server).

O board único validou os 19 PRs (sem o #15412): file-size OK, changelog OK, i18n drift OK, typecheck:core OK, complexity e cognitive dentro do baseline. Testes focados: 390 passaram, 1 skip. O teste novo de GHE Copilot Sonnet 5.5 falhou no head original e foi corrigido no board; esse ajuste entra com o #15478, fora deste squash.

O rebaseline de file-size e o adopt de i18n ficam num follow-up.

⚠️ base-red inherited: #15306

Obrigado, @QuangBlue.
2026-10-06 19:24:52 -03:00
Grape Slush
8f0f85c94e fix(cli): prefer an existing ~/.omniroute over XDG_CONFIG_HOME in every data-dir resolver (#15450)
Onda 5. Este squash entra com o crédito de @grapeslush (fix(cli): prefer an existing ~/.omniroute over XDG_CONFIG_HOME in every data-dir resolver).

O board único validou os 28 PRs juntos: file-size OK, changelog OK, i18n drift OK, typecheck:core OK, complexity 2976/3218, cognitive 1358/1437. Testes focados: 545 passaram, 0 falharam, 3 skip em 52 arquivos. Cinco timeouts de resilience-http-e2e eram carga e passaram isolados.

O rebaseline de file-size e o adopt de i18n ficam num follow-up, fora deste squash.

⚠️ base-red inherited: #15306

Obrigado, @grapeslush.
2026-10-06 19:12:42 -03:00
Lance Woodson
b8c50e1a47 fix(release): drain three v3.8.52 base-reds — cycles fast-gate, stale PR base sha, integration port race (#15590)
Onda 3 (woodsonl) validada num único board em `.claude/worktrees/batch-w3` sobre `origin/release/v3.8.52` (`4f4c983347b9`), 27 PRs, superfícies protegidas 0.

Evidência: `typecheck:core` limpo. i18n drift limpo no board. changelog-integrity ok. file-size ok (170 congelados). complexity 2975/3218 e cognitive-complexity 1357/1437 dentro do baseline. node:test focado: 1868 passaram, 0 falharam. Vitest da UI: 150 passaram em 12 arquivos. Os 38 do RTK caem no `useCallback` nulo de `node_modules/node_modules/react` via zustand, o mesmo React duplicado desta worktree. Onde dois PRs mexiam no mesmo save, o board ficou com os dois comportamentos: escrita parcial de engine por id e a fila/resync do PR que entrou depois.

O hash de `.i18n-state.json` do guia de quality-gates entra no follow-up, fora do squash.

⚠️ base-red inherited: #15306 (timeouts de suíte no tip, não neste diff).

Obrigado, @woodsonl.
2026-10-06 18:20:39 -03:00
Bob.Hou
da4ddc2d67 refactor(sse): split handleChatCore into four response-path leaves (#14725)
Validated in a local merge-train on a clean-install host (FAST gates green: static + changed tests + vitest on the combined tree; audit.test.ts verified passing on base and PR tree when the machine is idle).
⚠️ base-red inherited: #15306
2026-10-06 13:50:32 -03:00
Lance Woodson
beda40212e fix(ci): check the hooks path git actually uses in new-worktree.sh (#15209)
Validated in a local merge-train on tomni-proxmox-113 (static gates + changed tests + vitest green on the 31-PR combined tree; the FULL unit run on the same set showed only load-timing flakes, the base-red consoleInterceptor-writes, and one regression since fixed in #15087).
⚠️ base-red inherited: #15306
2026-10-02 06:10:12 -03:00
Diego Rodrigues de Sa e Souza
d573d40e89 fix(security): never send raw exception text from the Responses WebSocket proxy (Hard Rule #12) (#15073)
responses-ws-proxy.mjs (shipped as dist/responses-ws-proxy.mjs) sent raw exception text to the client in the failed-upgrade 500 body (CodeQL #1021/#1022) and in the upstream-connect response.failed frame, which could carry the upstream proxy URL with credentials. Both now return a fixed message; details stay server-side. Remaining CI reds reproduce on the pure release tip (#15032).
2026-09-29 07:10:20 -03:00
Bob.Hou
d3da8bb827 fix(authz): treat every forwarding header as the mark of a proxied request (#15060)
Maintainer rework: reconciled with #15038/#15040 on the tip — the wider forwarding-header set only sets the via-proxy marker from a peer that may be a proxy (hasProxyHopHeader && isTrustedProxyPeer). Loopback without headers stays local. 35 peer-stamp/route-guard/live-WS test files green. Board-validated with the rest of the batch on release/v3.8.51: typecheck:core, check:open-sse-typecheck, check-file-size, eslint on changed files, i18n:check-keys all green. Thank you @HouMinXi!
2026-09-29 07:06:10 -03:00
Bob.Hou
7aed914116 fix(ws): report the real client address from the WebSocket relays (#15040)
The /v1/ws and Responses WebSocket relays now report the real client address and drop client-written forwarding headers. 10 failures on the tip, green with the change; responses-ws suites green on the batch board. Thank you @HouMinXi!
2026-09-29 04:05:42 -03:00
Bob.Hou
1394706ea9 fix(authz): judge the IP allow/deny list by the connection unless a trusted proxy fronts it (#15038)
Forwarding headers only count as a proxy signal from loopback/private/Cloudflare peers or OMNIROUTE_TRUSTED_PROXIES, and the IP filter judges a server-stamped client address. 16 failures on the tip, green with the change; ip-filter and peer-stamp suites green. Note for operators: a reverse proxy on a public address in front of an IP whitelist must now be listed in OMNIROUTE_TRUSTED_PROXIES. Thank you @HouMinXi!
2026-09-29 04:05:32 -03:00
QuangBlue
a0745d065a fix(sse): record streamed TTFT as request start to first output (#14919)
Maintainer rework: merged the release/v3.8.51 tip (twice, the tip moved mid-rework) and resolved the file-size-baseline conflict (kept every annotation; stream.ts frozen at 3297 as the PR measured; chatCore.ts measures 6383 on the reconciled tip, so its ceiling stays at the tip's 6441 and the annotation says so). Boarded with the 2026-09-28 release-drain batch (typecheck:core, check:open-sse-typecheck, ESLint clean); on the reconciled head sse-output-signal 6/6, responses-ws-proxy-turn-timing 1/1, stream-readiness 22/22 and chatcore-streaming-ttft 2/2 (one timing flake in four runs on the loaded host). The only file-size red on the reconciled head is tests/unit/response-sanitizer.test.ts, which comes from the tip (#14813), not this PR. Thank you @QuangBlue!
2026-09-28 23:28:49 -03:00
Rouzbeh†
71ecf8ad8b fix(docker): resolve standalone process.execPath for Bun runtime container startup (#12525)
Boarded on the release/v3.8.51 tip together with the 2026-09-28 release-drain batch (30 PRs): typecheck:core, check:open-sse-typecheck, file-size, migration numbering, i18n keys and ESLint on the changed files are clean, and this PR's own test files (1) pass on the combined tree. Thank you @rqzbeh!
2026-09-28 21:50:56 -03:00
Diego Rodrigues de Sa e Souza
db70929330 fix(test): boot ecosystem through trusted-peer server (#14403)
Merge-batch 2026-09-23 (PRs do mantenedor, Trilha B, retrabalhada).

Um worker corrigiu o defeito apontado na revisão direto no branch da PR; o detalhe está na seção "Rework (merge-batch 2026-09-23)" do corpo, com a prova de red→green. Revalidado numa árvore combinada das PRs da 2ª leva da Trilha B (#14415 #14472 #14468 #14493 #14403) sobre o tip atual de `release/v3.8.51`:
- 104/104 testes node focados + 46/46 vitest (as 6 suítes de UI que saíram da quarentena); `check:provider-consistency` OK (359)
- `typecheck:core`: só o herdado `cliproxyAccountHealth.ts:157`; `check:open-sse-typecheck`: só o herdado `auggie.ts` (base-red #14547, corrigido pela #14511)
- eslint nos arquivos alterados limpo; file-size OK
2026-09-23 22:17:46 -03:00
Tuan Dinh
e188da6399 fix(dev): allow Ctrl+C to promptly kill dev server by closing active connections (#13020)
* fix(dev): allow Ctrl+C to promptly kill dev server by closing active connections and adding force-exit timeout

* test(dev): add regression assertions for prompt dev server exit on Ctrl+C

* docs(changelog): add fragment for #13020
2026-09-18 12:23:15 -03:00
Abhishek Sharma
b45e0c69e6 feat(security): warn at boot when the inference server is exposed anonymously (#13820)
* feat(security): warn at boot when the inference server is exposed anonymously

`GET /v1/models` follows the dashboard login posture
(`isAuthRequired()` / `requireAuthForModels`) while the inference routes
follow `REQUIRE_API_KEY`. On an instance with an admin password set and
`REQUIRE_API_KEY=false`, `/v1/models` answers 401 while `/v1/responses`
is open to anyone who can reach the port — so the most natural probe an
operator runs reports the opposite of the truth.

#12568 added a boot warning for exactly this combination, but wired it
only into the API bridge and the live dashboard WebSocket. The Next
server that actually answers `/v1/chat/completions` and `/v1/responses`
never reached it, and it is the one that binds every interface by
default (`process.env.HOST || "0.0.0.0"`).

Wire the existing guard into the Next boot hook, and document the split.

Resolving the bound host needed care: two entrypoints bind that server
and they read different variables. `run-next.mjs` honours `HOST`; the
Docker entrypoint delegates to Next's generated `server.js`, which reads
`HOSTNAME`. `run-next.mjs` now publishes what it actually binds as
`OMNIROUTE_BOUND_HOST`, and the guard reads that, then `HOSTNAME`, then
the shared `0.0.0.0` default. `HOST` is deliberately absent from the
chain: the standalone server ignores it, so consulting it there would
warn about an interface the server is not on — and one false warning
teaches an operator to ignore the next one.

Closes #13695

* docs(changelog): add changelog.d entry for #13820
2026-09-18 11:33:39 -03:00
Bob.Hou
815dedd3c9 fix(resilience): extend process crash guard to combo hedge cancels and upstream fetch failures (#13636) (#14064)
Closes a real process-killer: the direct-response start timeout could fire after the fetch promise had already settled, and aborting at that point delivered the abort reason to a promise nobody was awaiting — Node promotes that to an `unhandledRejection` → `uncaughtException` and the process dies (#12861). The timer is now a no-op once the attempt has settled, and the same guard is extended to combo hedge cancels and upstream fetch failures.

Validated as a combined board first (this PR merged with the 11 siblings of the same batch on the release tip): eslint on every changed file with the suppressions file, typecheck:core, check:open-sse-typecheck, complexity, cognitive-complexity, changelog-integrity, i18n new-key coverage, docs-sync, migration-numbering, provider-consistency and a duplicate-identifier audit all green, plus 275 passing / 0 failing focused node:test cases across the 28 test files the batch touches. Then re-validated alone on the fresh tip before this merge: conflicts re-resolved, file sizes rebaselined for this PR's own growth, eslint and this PR's focused tests re-run.

Thanks @HouMinXi!

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
2026-09-18 10:21:32 -03:00
initguru
36df9e505a fix(codex): fail fast and release per-account Responses WS leases (#12911)
* fix(codex): fail fast and release per-account Responses WS leases

* chore(changelog): add fragment for Codex WS lease fail-fast fix

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* fix(codex): carry the reasoning-rule context through the leased WS path

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
2026-09-17 10:56:01 -03:00
Bob.Hou
e7999c477b fix(db): bound health scans and isolate native diagnostics (#13717)
Merged after a maintainer rework that kept every one of @HouMinXi's commits intact.

**What the rework added on top of the contribution:** the new DB health-check behaviour is gated behind a default-off feature flag (`src/shared/constants/featureFlagDefinitions.ts`, `defaultValue: "false"`), documented in `docs/reference/FEATURE_FLAGS.md` with the description key carried into all 66 locales, so the release default is unchanged and the new bounds only apply when an operator opts in. The optional-FTS5 migration set was reconciled by hand with the "180" entry that landed meanwhile (`src/lib/db/migrationRunner/constants.ts`).

**Carried from your rebased head:** the `/api/db/health` local-only classification in `src/server/authz/routeGuard.ts` plus its `routeGuard` assertion — `runManagedDbHealthCheck()` forks native diagnostics into a child process, so Hard Rules #15/#17 apply. Re-verified here: 37 pass / 0 fail.

Validated as a combined board first (this PR merged with the 21 siblings of the same wave on the release tip): eslint with the frozen suppressions, typecheck:core, check:open-sse-typecheck, complexity, cognitive-complexity, changelog-integrity, i18n new-key coverage, docs-counts, docs-sync, migration-numbering, provider-consistency and a duplicate-identifier audit all green, plus 176 passing / 0 failing focused node:test cases across the 25 test files the wave touches and the dashboard test under Vitest (2/0). Then re-validated alone on the fresh tip before this merge: conflicts re-resolved, file sizes rebaselined for this PR's own growth, eslint and this PR's focused tests re-run.

Thank you for the depth of this one — the resource-bounds suite and the sql.js startup/backup coverage are the kind of tests that keep a database layer honest.
2026-09-16 12:59:45 -03:00
Bob.Hou
f36fcd8c31 fix(resilience): extend process crash guard to combo hedge cancels and upstream fetch failures (#13636)
Closes a real process-killer: the direct-response start timeout could fire after the fetch promise had already settled, and aborting at that point delivered the abort reason to a promise nobody was awaiting — Node promotes that to an `unhandledRejection` → `uncaughtException` and the process dies (#12861). The timer is now a no-op once the attempt has settled, and the same guard is extended to combo hedge cancels and upstream fetch failures.

Validated as a combined board first (this PR merged with the 11 siblings of the same batch on the release tip): eslint on every changed file with the suppressions file, typecheck:core, check:open-sse-typecheck, complexity, cognitive-complexity, changelog-integrity, i18n new-key coverage, docs-sync, migration-numbering, provider-consistency and a duplicate-identifier audit all green, plus 275 passing / 0 failing focused node:test cases across the 28 test files the batch touches. Then re-validated alone on the fresh tip before this merge: conflicts re-resolved, file sizes rebaselined for this PR's own growth, eslint and this PR's focused tests re-run.

Thanks @HouMinXi!
2026-09-16 03:03:07 -03:00
Diego Rodrigues de Sa e Souza
df87e9363b fix(auth): close the JWT_SECRET bootstrap chain — real-peer loopback, obsidian always-protected, DATA_DIR vault refusal (#13791)
GHSA-7pq4-8pvv-rx7r (critical). Every link of the reported chain held on the
release tip:

1. First boot without JWT_SECRET generates one and writes it in cleartext to
   $DATA_DIR/server.env.
2. With no password configured, isAuthRequired() returned false for
   POST /api/settings/require-login unconditionally — before the loopback
   check — so any network peer could switch requireLogin off.
3. With requireLogin off, POST /api/settings/obsidian/webdav accepted an
   arbitrary vault root and echoed freshly minted Basic credentials.
4. The WebDAV file service is served by the custom Node layer before Next.js,
   outside the authz pipeline.
5. Pointing it at DATA_DIR reads server.env, and JWT_SECRET forges an
   `{"authenticated":true}` admin session.

A second, worse problem surfaced while verifying: isLoopbackRequest() decided
"loopback" from nextUrl.hostname / the Host header, which the client controls.
`Host: localhost` from a remote address made the whole fresh-install bootstrap
reachable, not just the write path.

Three cuts, plus the root cause:

- isLoopbackRequest() now reads the trusted peer: the token-stamped real TCP
  peer the custom server writes (peerStamp), then the pipeline's own locality
  verdict once a stamp token exists, then a real socket peer. The bootstrap
  write path honours the same constraint instead of returning false, and
  managementPolicy hands down the peerContext verdict explicitly, because at
  policy time the original request still carries client-supplied headers.
- Host is consulted only when the process has no stamp token at all — no
  stamping server in front, which in practice means route handlers invoked
  directly by the unit-test harness. Every supported runtime (run-next dev and
  start, standalone-server-ws for Docker, the npm CLI and Electron) calls
  ensurePeerStampToken() at boot, so there a signal-less request fails closed.
  Without this fallback ~340 route tests that call handlers with
  `new Request("http://localhost/…")` turned into 401s.
- /api/settings/obsidian joins ALWAYS_PROTECTED_API_PATHS: issuing and rotating
  reusable WebDAV credentials is credential export, the same rationale as the
  GHSA-62vw entry for the password reveal.
- enableObsidianVaultSync() refuses a vault that is, sits inside, or contains
  DATA_DIR, comparing realpath-resolved paths so a symlink cannot dodge it.

Tests are red-first: remote stamped peer → auth required on the bootstrap
write; Host: localhost plus a forged locality header from a non-loopback
stamped peer → 401 through the full pipeline; the local operator keeps the
first-password flow; obsidian inventory and DATA_DIR overlap cases.
2026-09-15 16:58:24 -03:00
Diego Rodrigues de Sa e Souza
cb55187eda chore(ci): make worktrees carry the hooks that enforce the identity gate (#13236)
Merged as part of the 39-PR owner batch of 2026-09-11, validated as a unit.

Boarded into one consolidated worktree cut from `release/v3.8.51` with the other 38 — zero conflicts between them.

- ESLint over every changed file: no errors (the only finding was one suppression entry the batch emptied, pruned on #13243)
- `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK
- complexity 2821 / baseline 3218 and cognitive-complexity 1272 / baseline 1437 — both under baseline
- 256 assertions green: 246 under node:test and 10 under vitest, which is where `tests/unit/**/*.test.tsx` actually runs
- `check-file-size`: `chatCore.ts` rebaselined 6144 → 6146 for #13278 and #13276, annotated and landed on #13243

⚠️ base-red inherited: #12732 — the provider count (356 in the docs vs the 358 the modules define) and `open-sse/utils/stream.ts` at 3115 > frozen 3098 both reproduce on the pure tip with zero contribution from this batch.
2026-09-11 22:05:25 -03:00
backryun
f8b01c966e fix(dev): make logging resources HMR-singleton (#12079)
Co-authored-by: backryun <backryun@daonlab.local>
2026-08-31 14:13:53 -03:00