Skip to content

feat(opencode-plugin): auto-discover models while running + force sync - #8101

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
RaviTharuma:pr/opencode-auto-model-discovery
Jul 24, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
RaviTharuma:pr/opencode-auto-model-discovery

Conversation

@RaviTharuma

@RaviTharuma RaviTharuma commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds Pi-parity live model discovery to @omniroute/opencode-plugin so OpenCode picks up new OmniRoute models while the harness is running, and can force-refresh on demand.

Why

OpenCode previously only re-fetched the catalog on demand via modelCacheTtl after a provider/models hook. New models added in OmniRoute while a long-running OpenCode session was open could stay invisible until restart/TTL expiry + next hook. Pi already supports /omni sync + background discovery; OpenCode users need the same.

What changed

  • autoSyncIntervalMs (default 300000 / 5 min, min 60000, 0 = off): background timer invalidates cache and re-fetches GET /v1/models (plus combos/enrichment when enabled) while OpenCode is running.
  • omniroute_sync_models tool: force cache invalidate + refetch (OpenCode equivalent of Pi /omni sync).
  • Command templates (OpenCode has no Pi-style slash-command API):
    • /omni-sync → asks the agent to call omniroute_sync_models
    • /omni-autosync → report current auto-sync / TTL status
  • README docs for auto + force refresh paths.
  • Plugin version 0.2.0 → 0.2.1.

Config example

{
  "plugin": [
    [
      "@omniroute/opencode-plugin",
      {
        "providerId": "omniroute",
        "baseURL": "https://or.example.com",
        "autoSyncIntervalMs": 300000
      }
    ]
  ]
}

Notes

Test plan

  • cd @omniroute/opencode-plugin && npm test (281 pass, 0 fail)
  • npm run build (ESM + DTS success)
  • tests/auto-sync.test.ts (10 pass) covering sanitize/default/clamp/0 disable
  • Manual: run OpenCode with plugin, add a model in OmniRoute UI, wait ≤ autoSyncIntervalMs, confirm it appears without restart
  • Manual: run /omni-sync (or ask agent to call omniroute_sync_models) and confirm immediate catalog refresh
  • Manual: set autoSyncIntervalMs: 0 and confirm no background polling (TTL still works)

Closes #8106

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@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.

@RaviTharuma

Copy link
Copy Markdown
Contributor Author

Tracking issue: #8106

This PR implements Pi-parity live model discovery for OpenCode:

  • background autoSyncIntervalMs (default 5m, min 60s, 0 = off)
  • force tool omniroute_sync_models
  • command templates /omni-sync + /omni-autosync

No credentials or host-specific secrets are included in the diff (examples only).

@RaviTharuma
RaviTharuma force-pushed the pr/opencode-auto-model-discovery branch 3 times, most recently from 20cab05 to da47eeb Compare July 22, 2026 19:45
@RaviTharuma
RaviTharuma marked this pull request as draft July 23, 2026 08:23
@RaviTharuma
RaviTharuma marked this pull request as ready for review July 23, 2026 08:23
@RaviTharuma
RaviTharuma marked this pull request as draft July 23, 2026 12:42
@RaviTharuma
RaviTharuma marked this pull request as ready for review July 23, 2026 12:42
@RaviTharuma
RaviTharuma marked this pull request as draft July 23, 2026 13:18
@RaviTharuma
RaviTharuma marked this pull request as ready for review July 23, 2026 13:18
@RaviTharuma
RaviTharuma marked this pull request as draft July 23, 2026 13:18
@RaviTharuma
RaviTharuma marked this pull request as ready for review July 23, 2026 13:18
@RaviTharuma
RaviTharuma marked this pull request as draft July 23, 2026 13:32
@RaviTharuma
RaviTharuma marked this pull request as ready for review July 23, 2026 13:32
Add Pi-parity discovery for OpenCode:
- autoSyncIntervalMs background refresh (default 5m, min 60s, 0=off)
- omniroute_sync_models tool to force cache invalidate + /v1/models refetch
- /omni-sync and /omni-autosync command templates (OpenCode has no slash API)
Document Pi-parity catalog refresh for OpenCode:
- autoSyncIntervalMs background discovery (default 5m)
- omniroute_sync_models force-refresh tool
- /omni-sync and /omni-autosync command templates
@diegosouzapw
diegosouzapw force-pushed the pr/opencode-auto-model-discovery branch from dbc3b0c to 7d30a19 Compare July 23, 2026 23:19
@diegosouzapw
diegosouzapw merged commit 4e85e3d into cheaper-inference:release/v3.8.49 Jul 24, 2026
5 checks passed
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Merged into release/v3.8.49 — thanks @RaviTharuma! Validated via local merge-train (32-core) + a per-file discriminator confirming zero regressions vs the pure release tip. 🙏

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

* feat(opencode-plugin): auto-discover models while running + force sync

Add Pi-parity discovery for OpenCode:
- autoSyncIntervalMs background refresh (default 5m, min 60s, 0=off)
- omniroute_sync_models tool to force cache invalidate + /v1/models refetch
- /omni-sync and /omni-autosync command templates (OpenCode has no slash API)

* docs(opencode-plugin): document auto model discovery + /omni-sync

Document Pi-parity catalog refresh for OpenCode:
- autoSyncIntervalMs background discovery (default 5m)
- omniroute_sync_models force-refresh tool
- /omni-sync and /omni-autosync command templates

---------

Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
@RaviTharuma
RaviTharuma deleted the pr/opencode-auto-model-discovery branch September 23, 2026 19:38
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
cheaper-inference#8101)

* feat(opencode-plugin): auto-discover models while running + force sync

Add Pi-parity discovery for OpenCode:
- autoSyncIntervalMs background refresh (default 5m, min 60s, 0=off)
- omniroute_sync_models tool to force cache invalidate + /v1/models refetch
- /omni-sync and /omni-autosync command templates (OpenCode has no slash API)

* docs(opencode-plugin): document auto model discovery + /omni-sync

Document Pi-parity catalog refresh for OpenCode:
- autoSyncIntervalMs background discovery (default 5m)
- omniroute_sync_models force-refresh tool
- /omni-sync and /omni-autosync command templates

---------

Co-authored-by: Ravi Tharuma <RaviTharuma@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(opencode-plugin): auto-discover models while running + force sync (Pi /omni sync parity)

2 participants