anomalyco / anomalyco/opencode
feature(core): expose active model identifier to the agent runtime
@kitlangton is already working on this.
Since Jul 27, 2026.
- 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
- The session or execution context exposes the active model identifier as a readable property (e.g.
session.model?.idor equivalent). - Agent instructions can reference the active model identifier (e.g.
The model you are running under is {{model_id}}). - The active model identifier is included in session logs and transcript output.
- The feature does not break existing provider routing or fallback logic.
- Unit or integration tests verify that the model identifier is correctly propagated from provider resolution through to session context.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.