Skip to content

feat(dashboard): copyable connection ID chip and docs for per-request account pinning - #16963

Merged
diegosouzapw merged 2 commits into
release/v3.8.52from
feat/port-pr-4718-connection-pin-discoverability
Oct 17, 2026
Merged

diegosouzapw merged 2 commits into
release/v3.8.52from
feat/port-pr-4718-connection-pin-discoverability

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Summary

  • The per-request account pin (x-omniroute-connection) already worked, but it was hard to find: no connection row showed its id and no user-facing doc mentioned the header. This PR adds the missing UI and docs.
  • Each provider connection row now has a copyable connection-ID chip, and a one-line tip under the Connections header explains how the pin works.
  • The API reference and the Claude Code guide now document the header, its strict semantics, and an ANTHROPIC_CUSTOM_HEADERS example.

Attribution

Thanks to @nhan14t1 for the original implementation.

Changes

  • components/ConnectionIdChip.tsx (new): ConnectionIdChip shows the first 8 characters of the id, copies the full id through useCopyToClipboard, and switches to "Copied" while the copy feedback is active. Its tooltip and aria-label name x-omniroute-connection. ConnectionPinTip is the one-line hint.
  • ConnectionRow.tsx: renders the chip next to #priority (+2 lines).
  • ProviderDetailPageClient.tsx: renders the tip above the connection list when the provider has connections (+2 lines).
  • i18n: 3 new providers.* keys (copyConnectionId, connectionIdCopied, connectionPinTip) translated in all 66 locales, with no __MISSING__ markers. The header name is passed in as an ICU {header} argument, so translators never touch it.
  • docs: API_REFERENCE.md gets a Custom Headers row and an "Account pinning per request" section. It documents single-model scope (combos ignore the header), exclusive use, no sibling rotation on an in-request failure, release to siblings during cooldown, quota exhaustion or a quota-policy block, and hard failure for an unknown or disabled id. CLAUDE-CODE-CONFIGURATION.md gets a short "Pin one account" subsection.
  • scripts/check/check-fabricated-docs.mjs: ANTHROPIC_CUSTOM_HEADERS is added to the external-tool env-var allowlist. It is Claude Code's own variable, never read by OmniRoute, and follows the same pattern as the existing CLAUDE_CODE_MAX_OUTPUT_TOKENS entry.
  • x-connection-id is deliberately not aliased on the chat route. The media playground cards already send x-connection-id: <providerId> to chat, so an alias would force a pin to a non-existent connection and break every playground chat. A source-level regression guard covers this.

Test plan

  • npx vitest run --config vitest.config.ts tests/unit/ui/connection-row-copy-id.test.tsx: before the implementation it failed with Failed to resolve import ".../ConnectionIdChip". After: Test Files 1 passed · Tests 7 passed (7). The tests cover the 8-character chip text, copying the full id plus the "Copied" state, a tooltip that names x-omniroute-connection, no chip when the id is empty, the tip text, and the chat-handler guard (exactly one x-omniroute-connection read and no x-connection-id read).
  • Sibling UI suites (providers/[id]/__tests__/*, components/__tests__/{CoolingConnectionsPanel,phase1d}, tests/unit/ui/connection-row-*, connection-quota-panel, confirm-delete-connection-7361, codex-paid-credits-toggle, connectionsSearchFilter, model-hidden-dashboard-visibility, provider-tos-notice-15059, radar-guided-setup-action): 28 passed · 154/155 tests. The one failure was proxySaveRefresh.test.tsx, which hit its 30s timeout under parallel load. Run alone it passes: Tests 1 passed (1).
  • Sibling node:test suites that reference ConnectionRow/ProviderDetailPageClient/the touched docs (22 files): ℹ tests 103 ℹ pass 103 ℹ fail 0.
  • npm run i18n:check-keys: OK — 66 locales carry all 13816 keys. npm run i18n:check-ratio: OK — 66 locales within baseline. npm run i18n:check-new-keys: PASS.
  • tests/unit/i18n*.test.ts (54 files): 603 tests, 599 pass, 4 fail. All 4 failures are inherited from the base: glossary hits at cliTools.toolDescriptions.zed in zh-CN/zh-TW, and the same 提供商 string is on origin/release/v3.8.52.
  • npm run typecheck:core: clean. npm run check:dashboard-typecheck: OK — 195 pre-existing error(s), all within frozen baseline.
  • npx eslint --suppressions-location config/quality/eslint-suppressions.json <changed files>: clean. npx prettier --check <changed files>: clean.
  • node scripts/check/check-fabricated-docs.mjs --strict: the only remaining claim is /api/balance in docs/reference/ENVIRONMENT.md:368, inherited from the base and untouched here. check-fabricated-docs.test.ts and release-green-docs-drift-7253.test.ts fail on that same base claim only.
  • GITHUB_BASE_REF=release/v3.8.52 node scripts/check/check-pr-test-policy.mjs: PASS. GITHUB_BASE_REF=release/v3.8.52 npm run check:test-masking: OK.
live_check:
  where: dashboard → Providers → <any provider with ≥2 connections> (VPS 192.168.0.15)
  steps:
    - each connection row shows an "xxxxxxxx…" chip next to "#<priority>"; hover shows the x-omniroute-connection tooltip
    - click the chip → clipboard holds the full connection id; chip briefly shows "Copied"
    - the tip line renders under the Connections header (not when the provider has 0 connections)
    - curl /v1/chat/completions with -H "x-omniroute-connection: <copied id>" on a provider/model id → call log shows that connection served the request
    - media-providers playground LLM chat card still works (sends x-connection-id, must stay un-pinned)

⚠️ base-red inherited: #15306 — unit/vitest/integration/package-artifact gates on release/v3.8.52

… account pinning

The per-request account pin (x-omniroute-connection) already existed in the
chat handler, but no dashboard surface exposed a connection's id and no
user-facing doc described the header, so the feature was undiscoverable.

- Each provider connection row now shows a copyable id chip (first 8 chars,
  click copies the full id); its tooltip names the x-omniroute-connection
  header.
- A one-line tip under the Connections header explains the pin and its
  strict semantics (exclusive use; cooldown/quota releases it to siblings).
- docs: API reference header row + "Account pinning per request" section and
  a Claude Code ANTHROPIC_CUSTOM_HEADERS example; the fabricated-docs gate
  allowlists ANTHROPIC_CUSTOM_HEADERS as a Claude Code CLI env var.
- i18n: 3 new providers.* keys translated in all 66 locales.

x-connection-id is deliberately NOT aliased on the chat route: the media
playground cards send it with a provider id, which would force a pin to a
non-existent connection. A regression guard test pins that.

Co-authored-by: Nhan Phan <nhan.14t1@gmail.com>
Inspired-by: decolua/9router#4718
@diegosouzapw diegosouzapw added the hold-vps PR verde, merge aguardando validação live (release-drain) label Oct 17, 2026
@diegosouzapw
diegosouzapw merged commit d609217 into release/v3.8.52 Oct 17, 2026
44 of 62 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

CI Coverage Report

  • Coverage job: skipped
  • PR test policy: success

Coverage artifact was not available for this run.

@diegosouzapw
diegosouzapw deleted the feat/port-pr-4718-connection-pin-discoverability branch October 18, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold-vps PR verde, merge aguardando validação live (release-drain)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant