fix(opencode-go): register model catalog to fix context window detection#92913
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 14, 2026, 3:53 AM ET / 07:53 UTC. Summary PR surface: Source +10. Total +10 across 2 files. Reproducibility: yes. at source level: current opencode-go onboarding is a no-op, while memory flush resolves context with async loading disabled and falls back to the default when no config/cache metadata is available. I did not run a live gateway reproduction in this read-only review. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land a corrected provider-owned fix that compiles under NodeNext, proves opencode-go context-window resolution after onboarding, and preserves or intentionally normalizes existing provider config during upgrade. Do we have a high-confidence way to reproduce the issue? Yes at source level: current opencode-go onboarding is a no-op, while memory flush resolves context with async loading disabled and falls back to the default when no config/cache metadata is available. I did not run a live gateway reproduction in this read-only review. Is this the best way to solve the issue? No, not as submitted: the catalog-registration direction is plausible and matches sibling providers, but the patch is not mergeable until the NodeNext import, proof, and upgrade/config evidence are fixed. Maintainers should also confirm whether onboarding persistence is the intended layer versus a prepared metadata/cache repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e99ab385cfe1. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +10. Total +10 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
…odelCatalog Previously, applyOpencodeGoProviderConfig was an empty no-op that returned cfg unchanged. This meant the opencode-go plugin's static model catalog (including correct contextWindow values like deepseek-v4-pro: 1M) was never registered into the runtime model context window cache. As a result, resolveContextTokensForModel() failed to look up any opencode-go model and fell back to the hardcoded 200K default, causing premature compaction (threshold 156K instead of 956K). Changes: - Export OPENCODE_GO_MODELS and OPENCODE_GO_OPENAI_BASE_URL from extensions/opencode-go/provider-catalog.ts - Implement applyOpencodeGoProviderConfig to call applyProviderConfigWithModelCatalog with the full static model catalog, matching the pattern used by deepseek and other built-in providers. Fixes: agent compaction triggering at ~156K tokens on 1M context models Refs: openclaw#92912
996d7b7 to
8255227
Compare
|
Land-ready proof for exact head
The implementation uses the plugin-owned static catalog discovery seam; it does not persist the provider catalog into user config. OpenAI and Anthropic tool-calling paths are untouched. |
…aw#92913) Register OpenCode Go's provider-owned static catalog so lifecycle cache warmup supplies the correct context window to memory flush and compaction without persisting catalog rows in user config. Fixes openclaw#92912. Co-authored-by: kumaxs <[email protected]>
…aw#92913) Register OpenCode Go's provider-owned static catalog so lifecycle cache warmup supplies the correct context window to memory flush and compaction without persisting catalog rows in user config. Fixes openclaw#92912. Co-authored-by: kumaxs <[email protected]>
…aw#92913) Register OpenCode Go's provider-owned static catalog so lifecycle cache warmup supplies the correct context window to memory flush and compaction without persisting catalog rows in user config. Fixes openclaw#92912. Co-authored-by: kumaxs <[email protected]>
…aw#92913) Register OpenCode Go's provider-owned static catalog so lifecycle cache warmup supplies the correct context window to memory flush and compaction without persisting catalog rows in user config. Fixes openclaw#92912. Co-authored-by: kumaxs <[email protected]>
Summary
Fix OpenCode Go context-window metadata for existing and newly onboarded installations without writing the plugin catalog into user config.
providerCatalogEntryfor the plugin's complete offline 18-model catalog.opencode-go/deepseek-v4-proas a 1,000,000-token model before synchronous memory-flush/compaction checks.Closes #92912.
Why this shape
The original patch copied all catalog rows into
models.providers.opencode-goduring onboarding. That only fixed newly configured installations and persisted a stale duplicate provider override. Core already has a lifecycle-owned static-catalog warmup seam; the missing piece was the plugin's lightweight discovery entry.Real behavior proof
node --import tsx --input-type=module -e '<refresh context cache and resolve opencode-go/deepseek-v4-pro memory-flush context>'{"contextWindowTokens":1000000,"wroteModelConfig":false}Verification
node scripts/run-vitest.mjs extensions/opencode-go/index.test.ts extensions/opencode-go/onboard.test.ts src/agents/context.opencode-go.test.ts src/agents/embedded-agent-runner/model.static-catalog.test.ts src/agents/context.lookup.test.ts— 5 files, 52 tests passed.pnpm tsgo:extensions— passed.pnpm check:test-types— passed.contextWindowTokens: 1000000,wroteModelConfig: false.tbx_01kv3q8mwzxsfz01eftsym4kr0— passed.tbx_01kv3qsfkdpddjaerr3ghprjn1— passed.