Commit Graph

4484 Commits

Author SHA1 Message Date
diegosouzapw
f2d7df1f94 feat(proxy): egress IP visibility + pool validation (codex anomaly)
The proxy logs captured the INBOUND client IP (x-forwarded-for) but never the
OUTBOUND/egress IP — so there was no way to confirm by which IP each account
leaves. For rotating providers that is the whole game: probing the servers
showed every codex account had a distinct proxy assigned, but ALL proxies were
dead (egress timeout) while still marked status=active, so accounts fell back
to the shared host IPv6 /64 (same /64 across .16/.17/.18) → OpenAI anomaly
revocation ("authentication token has been invalidated").

- src/lib/proxyEgress.ts: resolveEgressIp() (echo-IP via the resolved proxy,
  cached), analyzeEgressSharing() (flags >=2 same-rotation-group accounts on
  one egress IP), diagnoseAllEgressIps(), and validateProxyPool() (probes each
  proxy and persists status=active/error so the dead-proxy filter takes them out
  of rotation automatically).
- proxyLogger: new egressIp field + a structured [ProxyEgress] line
  (in=clientIp out=egressIp) so the proxy logs show entry AND exit IP.
- chatHelpers: populate egressIp from a non-blocking cache, warm in background.
- GET/POST /api/settings/proxies/egress: diagnose + validate from the dashboard.

TDD: 5 tests (egress resolve/cache, sharing analysis, diagnose wiring, pool
validation). 37/37 proxy+oauth tests green, typecheck:core=0, lint clean.
2026-06-12 00:25:13 -03:00
diegosouzapw
980188fad9 fix(proxy): exclude explicitly-dead proxies from resolution
Resolution queries JOINed proxy_registry without any status filter, so a proxy
marked inactive/error/disabled (by an operator or a health check) kept being
handed out — every request paid the dead-proxy timeout or leaked out the host
IP. Add a conservative PROXY_ALIVE_PREDICATE (excludes only known-dead states;
active/null/unknown stay usable) to both resolveProxyForConnectionFromRegistry
(account/provider/global) and resolveProxyForScopeFromRegistry.

Part of the codex anomaly-revocation hardening (the dead proxy pool was a
factor in accounts being routed out a shared host IP). TDD: 4 tests.
2026-06-11 22:11:41 -03:00
diegosouzapw
cb1c5471dd fix(oauth): resilient refresh error classification + healthcheck circuit breaker
Root cause of the production token-invalidation storm (claude/aa5dd5cf
refreshed 1352x, kimi-coding 270x): when a refresh endpoint returned
invalid_grant in a non-canonical body shape (a JSON string, a double-encoded
string, a nested {error:{code}}, or raw text wrapped by a proxy/MITM),
refreshClaudeOAuthToken's errorBody.error === "invalid_grant" check failed and
returned null instead of the unrecoverable sentinel. The HealthCheck then kept
the connection active and re-tried every 60s forever (the loop + log flood +
upstream hammering that contributed to the 429s).

- extractOAuthErrorCode(): shape-agnostic OAuth error extractor (object, nested,
  bare string, double-encoded JSON string, raw text) restricted to a known
  unrecoverable set so transient errors (server_error, 502 HTML) never become
  false positives.
- refreshClaudeOAuthToken + refreshAccessToken/Cline/Qoder/GitHub now classify
  invalid_grant/invalid_request via the helper -> always emit the unrecoverable
  sentinel so the HealthCheck deactivates cleanly instead of looping.
- HealthCheck refresh circuit breaker: track consecutive refresh failures in
  providerSpecificData.refreshCircuit and back off exponentially (5->10->20...
  ->240min cap) instead of retrying every 60s; cleared on a successful refresh.
  Stops the loop for null/network failures (e.g. dead proxy / Kimi fetch failed).

TDD: 26 new tests (19 resilience + 7 circuit breaker); 113 oauth/refresh/
healthcheck tests green. typecheck:core=0, lint clean.
2026-06-11 20:53:55 -03:00
diegosouzapw
e771776b67 docs(changelog): credit #3673 + #3675 — leninejunior bulk-actions + quota-toggle 2026-06-11 18:30:27 -03:00
diegosouzapw
598ab693e0 chore(release): v3.8.22 CHANGELOG + env-doc sync
- Set release date in CHANGELOG [3.8.22] to 2026-06-11
- Add HERMES_HOME to .env.example (from #3628/#3663)
- Add HERMES_HOME + OMNIROUTE_PREFER_CLAUDE_CODE_FOR_UNPREFIXED_CLAUDE_MODELS to ENVIRONMENT.md (#3628/#3540)
2026-06-11 18:27:48 -03:00
Diego Rodrigues de Sa e Souza
831f8c7b52 refactor(dashboard): extract useProviderConnections/Settings/Models hooks — #3501 Phase 1f (#3684)
#3501 Phase 1f: god-component 4,948->4,062 LOC. Connection state+handlers, settings, and model metadata moved into hooks/.

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
2026-06-11 17:35:53 -03:00
Diego Rodrigues de Sa e Souza
57f8137352 refactor(dashboard): extract useModelCompatState hook + model sections — #3501 Phase 1e (#3683)
#3501 Phase 1e: extract useModelCompatState hook (unblocks the model sections) + ModelRow/PassthroughModelsSection/PassthroughModelRow/CustomModelsSection/CompatibleModelsSection. god-component 6,838->4,921 LOC.

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
2026-06-11 17:03:25 -03:00
Lenine Júnior
89fb1dde4d fix(dashboard): close review gaps in bulk provider connection actions (#3271 follow-up) (#3673)
Integrated into release/v3.8.22 — page.tsx conflict (god-component split #3501) resolved by re-applying the bulk-action deltas to ProviderDetailPageClient.tsx
2026-06-11 16:52:56 -03:00
Lenine Júnior
592554dbcd feat(dashboard): deactivate/activate accounts from the quota overview (#3675)
Integrated into release/v3.8.22
2026-06-11 16:41:10 -03:00
Diego Rodrigues de Sa e Souza
ef82f10a0d fix(combo): stop premature context compaction — real auto-combo windows + per-target compression limit (#3680)
Integrated into release/v3.8.22
2026-06-11 16:39:49 -03:00
Diego Rodrigues de Sa e Souza
bbace56180 feat(obsidian): add /api/v1/webdav file server for Obsidian vault sync (#3485 part 2) (#3678)
Part 2 of #3485. WebDAV server (PROPFIND/GET/PUT/DELETE/MKCOL/MOVE/OPTIONS) handled in the custom server layer (standalone-server-ws.mjs) since the App Router cannot export WebDAV methods. Basic-Auth (constant-time), path-traversal hardened, password decrypt ported from encryption.ts (parity-tested), DATA_DIR resolution parity-tested against dataPaths.ts. End-to-end Obsidian-over-Tailscale validation is a live VPS step (Rule #18).
2026-06-11 15:33:48 -03:00
Diego Rodrigues de Sa e Souza
dbbcc65693 feat(obsidian): add WebDAV config route + encrypt creds at rest (#3485 part 1) (#3677)
Part 1 of #3485. Adds /api/settings/obsidian/webdav (GET/POST/DELETE) wiring the ready obsidianSync lib, encrypts webdav password + obsidian token at rest, removes the duplicate UI block, drops the KNOWN_MISSING entry. WebDAV file server is part 2.
2026-06-11 15:33:38 -03:00
Diego Rodrigues de Sa e Souza
623806b6d7 refactor(dashboard): extract ConnectionRow + ModelCompatPopover + SiliconFlowEndpointModal — #3501 Phase 1d (#3676)
#3501 Phase 1d: god-component 8,092->6,838 LOC.

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
2026-06-11 14:57:22 -03:00
diegosouzapw
a3253399b3 docs(changelog): reconcile v3.8.22 — credit #3621/#3622 + MiMoCode follow-up roll-up 2026-06-11 14:09:39 -03:00
Diego Rodrigues de Sa e Souza
9196a5427e refactor(dashboard): extract AddApiKeyModal + EditConnectionModal — #3501 Phase 1c (#3674)
#3501 Phase 1c: extract AddApiKeyModal, EditConnectionModal, WebSessionCredentialGuide into components/; god-component 10,166->8,092 LOC. Reconciles the v3.8.22 file-size drift for this file.

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
2026-06-11 13:41:39 -03:00
Diego Rodrigues de Sa e Souza
acadb593d8 fix(dashboard): honor auto-hide and switch to visible filter on passthrough Test-all (#3610) (#3669)
Closes #3610
2026-06-11 13:16:23 -03:00
Diego Rodrigues de Sa e Souza
8f281ed8c7 fix(i18n): use logical CSS direction utilities for sidebar and key overlays (RTL #3541) (#3670)
Closes #3541
2026-06-11 13:16:14 -03:00
Diego Rodrigues de Sa e Souza
eb32352076 fix(resilience): clear stale transient connection cooldowns on startup (#3625) (#3672)
Closes #3625
2026-06-11 13:15:57 -03:00
Diego Rodrigues de Sa e Souza
8a2d86a576 fix(oauth): name Kiro/AWS auto-imported accounts and dedupe by profileArn (#3615) (#3671)
Closes #3615
2026-06-11 13:15:47 -03:00
Diego Rodrigues de Sa e Souza
34c278324b fix(dashboard): restore home topology live in-flight pulse (#3507) (#3667)
Closes #3507
2026-06-11 12:55:32 -03:00
Diego Rodrigues de Sa e Souza
7e7fdbd30d fix(electron): launch peer-stamping server-ws.mjs entrypoint to avoid 403 LOCAL_ONLY (#3386) (#3665)
Closes #3386
2026-06-11 12:55:16 -03:00
Diego Rodrigues de Sa e Souza
47155fa3a0 fix(api): flag provider topology error state by current status, not stale history (#3619) (#3666)
Closes #3619
2026-06-11 12:55:02 -03:00
Diego Rodrigues de Sa e Souza
8c7f37340c fix(api): fetch live OpenCode model catalog for no-auth model picker (#3611) (#3664)
Closes #3611
2026-06-11 12:54:46 -03:00
Diego Rodrigues de Sa e Souza
03039321d5 fix(cli): honor HERMES_HOME for Hermes Agent config path (#3628) (#3663)
Closes #3628
2026-06-11 12:54:28 -03:00
Diego Rodrigues de Sa e Souza
bc164d0df5 fix(mitm): remove duplicated 'Command failed:' error prefix (#3641) (#3662)
Closes #3641
2026-06-11 12:53:11 -03:00
Diego Rodrigues de Sa e Souza
3ce157d22e fix(responses): detect stream readiness for tool-call-only and object-less chunks (#3612) (#3661)
Closes #3612
2026-06-11 12:53:07 -03:00
diegosouzapw
60e38a71d1 fix(mimocode): add required authHeader:"none" to registry entry (#3659 follow-up)
The mimocode RegistryEntry omitted the required authHeader field, which broke
typecheck:core (TS2741). Match the no-auth convention (authType:"none" + authHeader:"none")
used by veoaifree-web and other free providers. Follow-up to #3659 (@pizzav-xyz).
2026-06-11 11:59:18 -03:00
diegosouzapw
a702a9e56f docs(changelog): credit #3632/#3631/#3637/#3659/#3540/#3616/#3523 (v3.8.22 targeted review round) 2026-06-11 11:57:26 -03:00
Witroch4
2b39b8357c Add Claude Code routing preference for unprefixed Claude models (#3540)
Integrated into release/v3.8.22 — page.tsx conflict resolved (re-applied toggle to ProviderDetailPageClient) + disable-test updated for catalog drift in review.
2026-06-11 11:53:59 -03:00
kkkayye
3813fa4a85 Log Responses WebSocket calls in history (#3616)
Integrated into release/v3.8.22 — Codex Responses WebSocket call history logging.
2026-06-11 11:46:32 -03:00
PizzaV
5a5d2ee5a4 feat(providers): add MiMoCode free-tier provider with bootstrap JWT auth (#3659)
Integrated into release/v3.8.22 — page.tsx conflict resolved + NoAuthAccountCard re-applied to ProviderDetailPageClient in review. MiMoCode endpoint validated live.
2026-06-11 11:45:10 -03:00
Hernan Javier Ardila Sanchez
337f16ca6b fix(combo): skip same-provider targets on 408/500/502/503/504/524 errors (#3637)
Integrated into release/v3.8.22 — circuit-breaker guard added in review (#1731v2)
2026-06-11 11:42:01 -03:00
Nicolas Lorin
9574d572d6 refactor: small code cleanup (#3523)
Integrated into release/v3.8.22
2026-06-11 11:36:40 -03:00
NOXX - Commiter
8ecfe757ea fix(kiro): route enterprise IAM Identity Center accounts to their regional endpoint (#3631)
Integrated into release/v3.8.22
2026-06-11 11:36:36 -03:00
Abhishek Divekar
c5b21412c0 fix(reasoning): replay reasoning_content on plain DeepSeek turns (#1682) (#3632)
Integrated into release/v3.8.22
2026-06-11 11:36:32 -03:00
Diego Rodrigues de Sa e Souza
d8b9759db6 refactor(dashboard): extract remaining shared helpers to providerPageHelpers — #3501 Phase 2b (#3658)
#3501 Phase 2b: extract remaining shared helpers to providerPageHelpers (leaf, cycle-safe). Heavy modals unblocked.

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
2026-06-11 11:10:41 -03:00
Diego Rodrigues de Sa e Souza
2ec54d06f6 refactor(dashboard): extract pure helpers to providerPageHelpers — #3501 Phase 2 (#3653)
#3501 Phase 2: extract pure helpers to providerPageHelpers (leaf, cycle-safe).

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
2026-06-11 10:25:07 -03:00
Diego Rodrigues de Sa e Souza
c4bdd4a90b chore(db-gate): reclassify external-DB reads, fully close #3500 (#3649)
Closes #3500: reclassify external-DB reads; all internal raw-SQL migrated to db/ modules.
2026-06-11 09:49:56 -03:00
Diego Rodrigues de Sa e Souza
870f825196 refactor(db): move usage_logs/semantic_cache/proxy_logs SQL into db modules (#3500 slice 4) (#3648)
#3500 slice 4: usage_logs/semantic_cache/proxy_logs SQL → db modules. All internal routes done (2 external by-design remain).
2026-06-11 09:46:11 -03:00
Diego Rodrigues de Sa e Souza
53af75fcac refactor(db): move skills UPDATE + db-backups SQL into db modules (#3500 slice 5) (#3647)
#3500 slice 5: skills UPDATE (allowlist) + db-backups SQL → db modules.
2026-06-11 09:43:33 -03:00
Diego Rodrigues de Sa e Souza
581878a421 refactor(db): move usage_history SQL into usageAnalytics module (#3500 slice 2) (#3644)
#3500 slice 2: usage_history/daily_usage_summary SQL → usageAnalytics db module.
2026-06-11 09:32:55 -03:00
Diego Rodrigues de Sa e Souza
9e9262b145 refactor(db): move community_servers SQL into gamification db module (#3500 slice 3) (#3639)
#3500 slice 3: community_servers SQL → gamification db module.
2026-06-11 09:16:27 -03:00
Diego Rodrigues de Sa e Souza
ee53ced36b refactor(dashboard): extract EditCompatibleNodeModal — #3501 Phase 1b (#3638)
#3501 Phase 1b: extract EditCompatibleNodeModal (cycle-safe via leaf constants module).

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
2026-06-11 09:14:57 -03:00
Diego Rodrigues de Sa e Souza
1d147b61da refactor(db): move call_logs aggregations into callLogStats db module (#3500) (#3636)
#3500 slice 1: call_logs aggregations → src/lib/db/callLogStats.ts (Rule #5). Byte-identical queries; TDD 6/6.
2026-06-11 08:58:33 -03:00
Diego Rodrigues de Sa e Souza
f6632c0cd4 fix(db): reclassify localDb unexported modules as intentionally-internal (#3499) (#3635)
Closes #3499 — reclassify localDb unexported modules as intentionally-internal (audit + honest gate framing).
2026-06-11 08:56:45 -03:00
Diego Rodrigues de Sa e Souza
3a2cfd63ae refactor(dashboard): extract auth-import modals — #3501 Phase 1a (#3634)
#3501 Phase 1a: extract 3 auth-import modal clusters.

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
2026-06-11 08:54:38 -03:00
Diego Rodrigues de Sa e Souza
bb6d5a288a refactor(dashboard): extract ProviderDetailPageClient — #3501 Phase 0 (#3633)
#3501 Phase 0: extract ProviderDetailPageClient + smoke test.

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
2026-06-11 08:40:15 -03:00
diegosouzapw
cf06adf2e3 chore(release): open v3.8.22 development cycle 2026-06-11 05:16:40 -03:00
Diego Rodrigues de Sa e Souza
a32e52eed6 fix(ci): increase execFileSync maxBuffer in validate-pack-artifact (#3622)
npm pack --dry-run --json on large packages exceeds the default 1 MB
buffer. Set maxBuffer to 64 MB so check:pack-artifact does not fail
with ENOBUFS on the CI runner.
2026-06-11 05:08:54 -03:00
Diego Rodrigues de Sa e Souza
88857237a2 fix(guardrails): use validateBody() in /api/guardrails/test route (#3621)
Replaces request.json() + TestRequestSchema.parse() pattern with the
canonical validateBody()/isValidationFailure() pattern from
@/shared/validation/helpers, satisfying check:route-validation:t06.
2026-06-11 05:06:58 -03:00