Skip to content

fix: resolve 1M context for opencode-free and muse-spark family - #101905

Closed
Steve-prog001 wants to merge 1 commit into
NousResearch:mainfrom
Steve-prog001:fix/opencode-muse-context-length
Closed

Steve-prog001 wants to merge 1 commit into
NousResearch:mainfrom
Steve-prog001:fix/opencode-muse-context-length

Conversation

@Steve-prog001

Copy link
Copy Markdown

Summary

  • Map opencode-free to the opencode-go models.dev catalog. The opencode /models endpoint omits context metadata for all 66 models and opencode-free had no models.dev alias, so every model on that route survived only via the hardcoded catalog and muse-spark fell through to the 256K fallback.
  • Add muse-spark=1048576 to DEFAULT_CONTEXT_LENGTHS (Meta docs: Standard and Contributor tiers share the 1,048,576-token window; verified 2026-09-03; missing from models.dev under every provider id and opencode exposes no metadata to probe).
  • Route commandcode/commandcode-anthropic through the live /models endpoint, which reports authoritative context_length (e.g. 1048576) but was skipped as a known provider.

Test plan

  • get_model_context_length now returns 1048576 for muse-spark-1.3-contributor-free / muse-spark-1.2 on opencode-free and meta/muse-spark-1.3-contributor on commandcode (was 256000); spot-checked qwen/deepseek/claude/gpt on opencode-free unchanged (provider-catalog values).
  • tests/agent/test_model_metadata.py, test_models_dev.py, test_models_dev_meta_mapping.py: 185 passed.
  • New tests/agent/test_opencode_free_mapping.py: 3 passed (with meta-mapping test file).

Note

  • qwen3.6-plus on opencode-free now resolves via the provider catalog (1000000) instead of the DashScope hardcoded value (1048576); provider-specific catalog wins by design (safe direction).

- Map opencode-free to the opencode-go models.dev catalog: opencode
  /models omits context metadata for all 66 models and opencode-free
  had no models.dev alias, so every model on that route survived only
  via the hardcoded catalog and muse-spark fell to the 256K fallback.
- Add muse-spark=1048576 to DEFAULT_CONTEXT_LENGTHS (Meta docs:
  Standard and Contributor tiers share the 1,048,576 window; missing
  from models.dev under every provider id).
- Route commandcode/commandcode-anthropic through the live /models
  endpoint, which reports authoritative context_length (e.g. 1048576)
  but was skipped as a known provider.
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Sep 3, 2026
teknium1 added a commit that referenced this pull request Sep 3, 2026
…in Muse Spark 1M invariant

opencode-free had no PROVIDER_TO_MODELS_DEV entry, so every models.dev
lookup on the free tier missed and Muse Spark fell to the 256K default.
The free tier is served by the Zen relay (hermes_cli/models.py:
"opencode-free is Zen-hosted"), and models.dev's "opencode" provider is
the catalog that lists muse-spark-1.2 / -1.2-contributor-free /
-1.3-contributor-free at 1,048,576 — so the alias is "opencode", not
"opencode-go" (Go's catalog carries only the paid -contributor SKUs).

Missing alias identified by @Steve-prog001 in #101905.

Tests: one parametrized offline invariant (models.dev + live /models
mocked away) asserting 1,048,576 on opencode-free / opencode-go /
meta-ai / commandcode — fails on main, passes here — plus the alias pin.
@teknium1

teknium1 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Closing in favor of #101949 (commit 0b96eaf), which landed the same muse-spark context entry (credited to @GTHell's earlier #98745) and your commandcode routing from #101588. Your models.dev-alias idea for opencode-free is in there too, credited to you — but mapped to opencode rather than opencode-go: the free tier is Zen-hosted (see opencode_model_api_mode, 'opencode-free is Zen-hosted'), and models.dev's opencode provider is where muse-spark-1.3-contributor-free lives. Thanks @Steve-prog001!

@teknium1 teknium1 closed this Sep 3, 2026
@Steve-prog001

Copy link
Copy Markdown
Author

Hi @teknium1 — thanks for salvaging this into #101949 and for the clear explanation of why opencode-free maps to the Zen opencode catalog rather than opencode-go; that makes sense.

Same small follow-up as on #101588: since the merge was a rebase-merge, my commits don't surface in the repo's contributor aggregation (known GitHub gap for rebased commits). Could you add my mapping under contributors/emails/, like sosxradar@gmail.com -> GTHell?

290940015+Steve-prog001@users.noreply.github.com -> Steve-prog001

That would complete the attribution in the repo's own records. Thanks again!

mikeholownych pushed a commit to mikeholownych/charterforge that referenced this pull request Sep 6, 2026
…in Muse Spark 1M invariant

opencode-free had no PROVIDER_TO_MODELS_DEV entry, so every models.dev
lookup on the free tier missed and Muse Spark fell to the 256K default.
The free tier is served by the Zen relay (hermes_cli/models.py:
"opencode-free is Zen-hosted"), and models.dev's "opencode" provider is
the catalog that lists muse-spark-1.2 / -1.2-contributor-free /
-1.3-contributor-free at 1,048,576 — so the alias is "opencode", not
"opencode-go" (Go's catalog carries only the paid -contributor SKUs).

Missing alias identified by @Steve-prog001 in NousResearch#101905.

Tests: one parametrized offline invariant (models.dev + live /models
mocked away) asserting 1,048,576 on opencode-free / opencode-go /
meta-ai / commandcode — fails on main, passes here — plus the alias pin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants