Skip to content

Draft: port per-key account preferences and legacy migration 194→213 bridge - #52

Closed
Bl0ck154 wants to merge 16 commits into
migration/port-custom-20261024from
integration/preferred-bridge-20261024
Closed

Bl0ck154 wants to merge 16 commits into
migration/port-custom-20261024from
integration/preferred-bridge-20261024

Conversation

@Bl0ck154

Copy link
Copy Markdown
Owner

Safe staged integration — NOT for production

Built from the upstream-first staging branch (#51), no changes to the existing production branch or running VPS. This is a stacked draft PR; do not merge into production. The new branch is a source migration candidate only, not a tested release.

Included

  • Cherry-merge upstream contribution feat(auth): add per-API-key ordered connection preference cheaper-inference/OmniRoute#13102 for API-key-specific preferredConnections ordering, UI, credential selection and regression tests (source of 91-file change, including translations).
  • Resolve all 3 locale conflicts (en, pt-BR, vi) by preserving existing removeSelection and new preferredConnections* labels. All JSON parsed successfully.
  • Add explicit compatibility metadata to rehome the historical fork 170/api_key_preferred_connections and 194/api_key_preferred_connections ledger entries to canonical 213/api_key_preferred_connections.
  • Restore official 194_proxy_logs_attempt_timing invariant by checking both proxy_logs.headers_ms and first_chunk_ms; 213 checks api_keys.preferred_connections. This matters because the live fork database is known to contain the legacy 194 marker and no official timing columns (see docs/maintenance/UPSTREAM_PARITY_GAP_AUDIT_20261024.md on production).
  • New tests/unit/api-key-preferred-migration-bridge.test.ts exercises fresh database, previously migrated database and historical 170/194 markers plus idempotent repeat boot, using synthetic in-memory SQLite.
  • Preserve preexisting staged URL speech, Antigravity 504 and Codex paid-plan filtering (Draft: upstream-first patch migration — phase 1 (speech, Antigravity, Codex) #51). src/sse/services/auth.ts retains the Codex eligibility import.

Checked so far

  • Git 3-way merge completed, no unresolved conflicts or staged whitespace problems (git diff --check).
  • Three resolved i18n files parse with Python JSON.
  • All changes committed and pushed from an isolated worktree, no local build/tests on production VPS.

Required before integration

Keep #51 and this PR draft, no deployment or migration against live DB.

Bl0ck154 and others added 15 commits September 9, 2026 11:32
# Conflicts:
#	AGENTS.md
#	README.md
#	docs/i18n/ar/llm.txt
#	docs/i18n/az/llm.txt
#	docs/i18n/bg/llm.txt
#	docs/i18n/bn/llm.txt
#	docs/i18n/cs/llm.txt
#	docs/i18n/da/llm.txt
#	docs/i18n/de/llm.txt
#	docs/i18n/es/llm.txt
#	docs/i18n/fa/llm.txt
#	docs/i18n/fi/llm.txt
#	docs/i18n/fr/llm.txt
#	docs/i18n/gu/llm.txt
#	docs/i18n/he/llm.txt
#	docs/i18n/hi/llm.txt
#	docs/i18n/hu/llm.txt
#	docs/i18n/id/llm.txt
#	docs/i18n/it/llm.txt
#	docs/i18n/ja/llm.txt
#	docs/i18n/ko/llm.txt
#	docs/i18n/mr/llm.txt
#	docs/i18n/ms/llm.txt
#	docs/i18n/nl/llm.txt
#	docs/i18n/no/llm.txt
#	docs/i18n/phi/llm.txt
#	docs/i18n/pl/llm.txt
#	docs/i18n/pt-BR/llm.txt
#	docs/i18n/pt/llm.txt
#	docs/i18n/ro/llm.txt
#	docs/i18n/ru/llm.txt
#	docs/i18n/sk/llm.txt
#	docs/i18n/sv/llm.txt
#	docs/i18n/sw/llm.txt
#	docs/i18n/ta/llm.txt
#	docs/i18n/te/llm.txt
#	docs/i18n/th/llm.txt
#	docs/i18n/tr/llm.txt
#	docs/i18n/uk-UA/llm.txt
#	docs/i18n/ur/llm.txt
#	docs/i18n/vi/llm.txt
#	docs/i18n/zh-CN/llm.txt
#	docs/i18n/zh-TW/llm.txt
#	llm.txt
…on-count docs

176_api_key_preferred_connections.sql collided with 176_xp_action_counts.sql,
merged to release/v3.8.51 after this branch was cut. Renumbered to the next
free slot (180) and recomputed the migration-count mentions in AGENTS.md,
README.md, llm.txt and all docs/i18n/*/llm.txt against the real tip count
(177). Also rebaselines the frozen file-size ceilings this PR's own feature
growth crosses (src/sse/services/auth.ts, src/sse/handlers/chat.ts,
src/lib/db/apiKeys.ts, ApiManagerPageClient.tsx) with justification, per
check-file-size.mjs's own last-resort guidance.

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

Renamed 180_api_key_preferred_connections.sql to 184_api_key_preferred_connections.sql: the
release tip landed 180_memory_fts_au_conditional_memory_id.sql after this PR's previous
renumbering pass. Slot 184 is the owner-assigned number for this PR among the 7 PRs
that collided on the 180 slot (cheaper-inference#13610=181, cheaper-inference#12962=182, cheaper-inference#12967=183, cheaper-inference#13102=184,
cheaper-inference#13222=185, cheaper-inference#13373=186, cheaper-inference#13554=187).

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
# Conflicts:
#	AGENTS.md
#	README.md
#	config/quality/file-size-baseline.json
#	docs/i18n/am/llm.txt
#	docs/i18n/ar/llm.txt
#	docs/i18n/az/llm.txt
#	docs/i18n/bg/llm.txt
#	docs/i18n/bn/llm.txt
#	docs/i18n/cs/llm.txt
#	docs/i18n/da/llm.txt
#	docs/i18n/de/llm.txt
#	docs/i18n/el/llm.txt
#	docs/i18n/es/llm.txt
#	docs/i18n/et/llm.txt
#	docs/i18n/fa/llm.txt
#	docs/i18n/fi/llm.txt
#	docs/i18n/fr/llm.txt
#	docs/i18n/ga/llm.txt
#	docs/i18n/gu/llm.txt
#	docs/i18n/ha/llm.txt
#	docs/i18n/he/llm.txt
#	docs/i18n/hi/llm.txt
#	docs/i18n/hr/llm.txt
#	docs/i18n/hu/llm.txt
#	docs/i18n/hy/llm.txt
#	docs/i18n/id/llm.txt
#	docs/i18n/ig/llm.txt
#	docs/i18n/it/llm.txt
#	docs/i18n/ja/llm.txt
#	docs/i18n/ka/llm.txt
#	docs/i18n/km/llm.txt
#	docs/i18n/kn/llm.txt
#	docs/i18n/ko/llm.txt
#	docs/i18n/lt/llm.txt
#	docs/i18n/lv/llm.txt
#	docs/i18n/ml/llm.txt
#	docs/i18n/mr/llm.txt
#	docs/i18n/ms/llm.txt
#	docs/i18n/mt/llm.txt
#	docs/i18n/my/llm.txt
#	docs/i18n/ne/llm.txt
#	docs/i18n/nl/llm.txt
#	docs/i18n/no/llm.txt
#	docs/i18n/or/llm.txt
#	docs/i18n/pa/llm.txt
#	docs/i18n/phi/llm.txt
#	docs/i18n/pl/llm.txt
#	docs/i18n/pt-BR/llm.txt
#	docs/i18n/pt/llm.txt
#	docs/i18n/ro/llm.txt
#	docs/i18n/ru/llm.txt
#	docs/i18n/si/llm.txt
#	docs/i18n/sk/llm.txt
#	docs/i18n/sl/llm.txt
#	docs/i18n/sr/llm.txt
#	docs/i18n/sv/llm.txt
#	docs/i18n/sw/llm.txt
#	docs/i18n/ta/llm.txt
#	docs/i18n/te/llm.txt
#	docs/i18n/th/llm.txt
#	docs/i18n/tr/llm.txt
#	docs/i18n/uk-UA/llm.txt
#	docs/i18n/ur/llm.txt
#	docs/i18n/uz/llm.txt
#	docs/i18n/vi/llm.txt
#	docs/i18n/yo/llm.txt
#	docs/i18n/zh-CN/llm.txt
#	docs/i18n/zh-TW/llm.txt
#	llm.txt
#	src/lib/db/apiKeys.ts
… on the release train

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

Resolve apiKeys.ts (SELECT/INSERT carry both preferred_connections and the tip's
expires_at/codex_service_mode), keys/route.ts (expiresAt + preferredConnections) and
file-size-baseline.json (tip + measured ceilings). The legacy permissions modal no
longer exists on the tip, so ApiManagerPageClient.tsx takes the tip's version; the
preference UI is re-ported onto the access editor in the next commit.
The tip replaced the permissions modal with the per-key access editor, so the
ordered preference list moves to a PreferredConnectionsSection component on the
Connections tab (only connections the key may use are offered; click to append,
arrows to reorder, Clear to reset). The form state carries
selectedPreferredConnections, prunes it whenever the allowed set narrows, and the
PATCH body always sends a subset of allowedConnections. Strings are translated in
all 66 locales; up/down/inactive reuse common.* keys.

Migration renumbered 184 -> 207 (184 is 184_proxy_logs_correlation_id on the tip,
206 is reserved). Routing doc points at the dashboard path.

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

Resolve apiKeys.ts (metadata SELECT keeps preferred_connections on the new key_hash-only lookup), chat.ts (preferredConnectionIds threaded through the new selectCredentials helper) and file-size-baseline.json (base version; no ceiling exceeded).

Renumber 207_api_key_preferred_connections.sql to 213 (207 is taken by 207_remove_opencode_free_provider.sql on the base) and name the changelog fragment with the PR number.

Copy link
Copy Markdown
Owner Author

2026-10-24 validation update: isolated stacked branch integration/preferred-bridge-20261024 at fd66e6b70f30bdf2d4f363f7b5560af86518e242 passed API Route Typecheck (GitHub Actions, completed successfully). A manual full CI run has been requested against the exact same SHA; it was in progress at last observation. This does not establish that migration cases or full CI passed yet. No build/tests ran on the production VPS, and production DB/service remain unchanged.

Copy link
Copy Markdown
Owner Author

2026-10-25 staged progress: ce54587190c710471e9b78975606e27a4bb76e37 ports soft preferred Antigravity 5s default / Gemini 3.8 12s header-timeout caps into the new upstream executeWithUpstreamStartTimeout chain (both primary and retry), keeping explicit pins/singletons/other providers unchanged and preserving stricter connection/model timeouts. Production-style cached resilienceSettings.antigravity numeric overrides (500–120000ms) remain readable without introducing another settings DB query. Credential selection now emits selectedByApiKeyPreference plus preferredFallbackAvailable only when a second currently eligible account survives filtering. Added unit + timeout behavior tests and a targeted manual GitHub Actions gate in .github/workflows/api-route-typecheck.yml. Hosted run 40132837056 completed SUCCESS at exact SHA ce54587190, including the new preferred routing/legacy SQLite synthetic tests and API route typecheck. The previous all-project run 40117341814 at SHA fd66e6b failed several broad gates (notably npm audit dependency alerts, 66+ i18n untranslated ratio errors, unrelated Codex/image/UI regressions), so the draft remains NOT release-ready. No production restart, database mutation, local build, package promotion or change to production.

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.

2 participants