fix: centralize Claude and GPT context capabilities - #333
Open
dgokeeffe wants to merge 2 commits into
Open
Conversation
Expose the GLM and Kimi coding-model cohort through Pi and OpenCode with shared token limits and reasoning metadata. Keep unsupported chat models out of discovery, including Inkling until gateway issue databricks#215 is fixed, and retain the GPT-OSS Responses API routing guard.
Centralize Claude family/version parsing so Pi metadata, adaptive-thinking compatibility, and Claude Code's [1m] selector cannot drift. Cover Sonnet 4.5, Opus 4.6, future major versions, Fable fallback, and prefixed model IDs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue and stack
Closes #222.
Depends on #217. GitHub must target
mainfor fork PRs; review the concern-isolated incremental range:dgokeeffe/ucode@036572c...f299e50
Do not merge before #217. After #217 merges, the visible PR diff collapses to this six-file context-policy unit.
Unit 03 — shared Claude/GPT context capability policy
Objective and user-visible behavior
Centralize Claude family/version capabilities and GPT token windows so Pi does not truncate custom gateway models to small defaults and Claude Code applies the 1M selector consistently.
Candidate:
review/shared-context-policy(f299e50), mandatory PR targetreview/oss-base(036572c), existing PR #223 after unit 02 is separated.Exact scope
Production:
src/ucode/databricks.py,src/ucode/agents/claude.py,src/ucode/agents/pi.py.Tests:
tests/test_databricks.py,tests/test_agent_claude.py,tests/test_agent_pi.py.Non-goals: GPT off-thinking mapping, OpenCode routing, dynamic OSS discovery, proxying, cache retention.
Before / after reproduction
Focused validation:
Full suite:
uv run --frozen pytest -q # 2 failed, 1614 passed, 36 skippedOnly installed Claude/Pi capture tests fail on this older stack. Unit 01/integrated
devresolves the Pi path isolation case; integrateddevindependently reproduces the Claude capture failure.Capability evidence
Table-driven tests cover dotted,
system.ai.*,databricks-*, provider-qualified,[1m]-suffixed, malformed, and future-major IDs. Verified policy includes GPT-5.6 Sol/Terra/Luna 1.05M windows, model-specific GPT fallbacks, Claude Opus 4.6+, Sonnet 4.5+, Fable 5, Haiku, and conservative unknown-model behavior. No credentials or endpoint identifiers are recorded.Impact map
contextWindow,maxTokens, reasoning/image metadata; Claude selector may gain[1m]only from shared policy.Rollback and residual risk
Revert
f299e50; this restores duplicated policy and Pi's smaller custom-model defaults. Residual risk is provider capability evolution; update the centralized table and table-driven tests together.Hygiene
git diff --check review/oss-base..review/shared-context-policypasses. PR #223 must target the OSS base; its target-relative diff is the review contract. Six-file range; no generated files, credentials,uv.lock,.pi-subagents/, orgoal.md; no merge markers or unresolved index entries.