Skip to content

fix(opencode-plugin): support separate management read token - #7885

Merged
diegosouzapw merged 5 commits into
cheaper-inference:release/v3.8.49from
RaviTharuma:fix/opencode-separate-read-token
Jul 20, 2026
Merged

diegosouzapw merged 5 commits into
cheaper-inference:release/v3.8.49from
RaviTharuma:fix/opencode-separate-read-token

Conversation

@RaviTharuma

Copy link
Copy Markdown
Contributor

Summary

  • add optional top-level managementReadToken to @omniroute/opencode-plugin
  • use it only for management-plane catalog GETs (/api/combos, auto combos, pricing/enrichment, compression metadata, and providers)
  • keep /v1/models, inference/chat, and generated provider apiKey on the OpenCode inference credential
  • preserve the existing apiKey fallback when the option is absent
  • keep mcpAutoEmit token selection independent and include both credentials in the catalog cache identity
  • document the least-privilege configuration and add a changelog fragment

Tests

  • npm run build (@omniroute/opencode-plugin)
  • npm test (268 passing)
  • npx tsc --noEmit

Closes #7884

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an optional managementReadToken configuration to the OmniRoute OpenCode plugin. This token is used specifically for management-plane catalog reads (such as combos, pricing, and providers) to support least-privilege deployments, while inference requests continue to use the primary apiKey. The changes include updates to the options schema, cache key generation, provider and config hooks, documentation, and a comprehensive suite of unit tests verifying the token's isolation and fallback behavior. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@RaviTharuma

Copy link
Copy Markdown
Contributor Author

Addressed both Important review findings in 4d09fff:

  • Scoped inference-key injection to same-origin /v1/chat/completions and /v1/models only (normalized trailing slash handling); management/MCP/unrelated /v1/* and cross-origin requests now pass through without plugin credentials while query strings, bodies, and streaming headers remain intact.
  • Versioned disk snapshots to v2 and bound hydration to an internal SHA-256 identity over normalized base URL + inference key + effective management-read token. Mismatched or legacy snapshots are rejected; the identity is never logged or emitted in provider/MCP config.
  • Added regressions for /api/combos, /api/mcp/stream, unrelated /v1/*, trailing/query handling, streaming preservation, and token-A snapshot rejection under token-B.

Validation: Prettier, package build, full 269-test package suite, tsc --noEmit, and git diff --check all pass.

@RaviTharuma

Copy link
Copy Markdown
Contributor Author

Fixed the remaining path-prefix auth finding in 7e31ffc02.

The fetch interceptor now derives its exact allowed inference paths from the configured base URL pathname after normalizing it to /v1, so path-mounted gateways authenticate only <base>/chat/completions and <base>/models. Same-origin root /v1/..., sibling tenants, and nested endpoint paths remain unauthenticated. Root-mounted behavior, request query/trailing slash handling, and streaming body/headers are covered.

Validation:

  • TDD regression reproduced before implementation
  • focused interceptor + management-token tests: 21 passed
  • full plugin tests: 270 passed
  • plugin build: passed
  • tsc --noEmit: passed
  • Prettier + git diff --check: passed

diegosouzapw and others added 2 commits July 20, 2026 17:25
…bullet

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@diegosouzapw
diegosouzapw merged commit 161de7d into cheaper-inference:release/v3.8.49 Jul 20, 2026
14 of 15 checks passed
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Merged — thanks @RaviTharuma! The separate management-read-token scoping is a clean addition, and it correctly keeps the server-facing omnirouteProviderId routing untouched (I checked it doesn't regress #6859). Validated in local merge-train (combined tree, full unit + vitest green) on tomni-proxmox-113 @ 250181493b then squash-merged.

@diegosouzapw diegosouzapw mentioned this pull request Jul 23, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…-inference#7885)

* fix(opencode-plugin): separate management read token

* fix(opencode-plugin): scope inference auth and snapshots

* fix(opencode-plugin): scope auth to base path

* docs(changelog): format opencode management-read-token fragment as a bullet

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

---------

Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@RaviTharuma
RaviTharuma deleted the fix/opencode-separate-read-token branch September 23, 2026 19:38
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…-inference#7885)

* fix(opencode-plugin): separate management read token

* fix(opencode-plugin): scope inference auth and snapshots

* fix(opencode-plugin): scope auth to base path

* docs(changelog): format opencode management-read-token fragment as a bullet

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

---------

Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
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(auth): opencode-plugin — support a separate read-only management token

2 participants