anomalyco / anomalyco/opencode

feature(core): expose active model identifier to the agent runtime

Open
#39,159 0 comments 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Jul 27, 2026.

2.0 core enhancement
Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Allow the agent runtime to know and report the exact model identifier (e.g. gpt-5.6-sol) it is currently executing under. Currently the agent can see configured providers and model names from opencode.json — but not the runtime-selected active model, which may differ due to dynamic provider routing, fallback, or user overrides.

Rationale

  • Debugging: When a model behaves unexpectedly, the agent logs and transcripts should include the exact model that was used, not just the provider name or the configured default.
  • Transparency: Users and operators should be able to verify which model served a given response, especially in multi-provider or fallback scenarios.
  • Reproducibility: Sessions replayed or resumed later need to record the exact model so that results can be attributed and re-run against the same model version.

Context

The agent currently has access to the provider configuration (via the opencode config) and can list configured models, but no runtime API or service exposes the resolved active model identifier after a session is established. This means that even though gpt-5.6-sol is configured, the agent cannot programmatically report that it is running under that model mid-session — particularly if the actual selected model changes due to routing logic.

Acceptance Criteria

  1. The session or execution context exposes the active model identifier as a readable property (e.g. session.model?.id or equivalent).
  2. Agent instructions can reference the active model identifier (e.g. The model you are running under is {{model_id}}).
  3. The active model identifier is included in session logs and transcript output.
  4. The feature does not break existing provider routing or fallback logic.
  5. Unit or integration tests verify that the model identifier is correctly propagated from provider resolution through to session context.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.