fix(claude): honor authoritative context windows in generated profiles - #854
fix(claude): honor authoritative context windows in generated profiles#854park285 wants to merge 6 commits into
Conversation
📝 WalkthroughWalkthroughClaude model metadata now uses registry context windows. Claude roster and self-clone definitions normalize ChangesSubagent context marker handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Pre-merge review result: not merge-ready yet. The narrow GPT fix direction is correct (
Happy to re-review once the metadata source of truth is reconciled and CI runs. |
- align Anthropic registry and generated catalog windows with the 1M source values - preserve exact routed selectors while honoring provider context caps - normalize marker case and cover roster, self, catalog, and registry boundaries
|
Addressed the pre-merge findings in
The branch now includes the latest This PR now absorbs the overlapping source-of-truth work requested on #839. Please re-review this head; hosted cross-platform CI and maintainer approval remain the external merge gates. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/claude/agents-inject.ts`:
- Around line 62-71: Update withSubagentContextMarker to preserve an existing
[1m] marker when no positive matching window metadata exists; only strip the
marker when an authoritative positive window indicates a sub-1M context, while
retaining current auto-marking behavior for eligible windows. Add an end-to-end
regression using incomplete catalog-derived Claude 4.6 and 4.7 metadata that
covers both roster and self-clone generation paths.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 01e943b1-2719-4c8c-831f-db41e09ad3e0
📒 Files selected for processing (2)
scripts/generate-jawcode-metadata.tssrc/claude/agents-inject.ts
|
Follow-up on the CodeRabbit finding:
Verification on head
|
|
Superseded by #889, which ports this PR's |
|
특붕이 잘쓰고있어요 유지보수 감사합니다. |
…m] picker rows The service-tier gate stripped the field for UNCLASSIFIED custom providers too, silently rewriting caller requests against unknown gateways; only an explicit supportsServiceTier: false strips now (true supports, false strips, undefined preserves-without-injection). The Claude picker emitted [1m] rows for sub-1M models under auto-context (the #854 defect at the picker level — a 372K route marked [1m] makes Claude Code account 1e6); variants now require an authoritative >=1M window. Adds the real DeepSeek tool-call continuation shape (reasoning → call → output) to the replay tests.
Campaign preparation (docs-only): five units under devlog/_plan/260802_wtN_* with 000 research + 010 implementation roadmaps, claim ledgers verified by a lunasearch fan-out (Anthropic 1M windows, Copilot mixed-wire, DeepSeek service_tier, WHATWG extension origins, POSIX rename-over-symlink). wt1 update-path: PR lidge-jun#871, issue lidge-jun#879 (star-prompt deferral leakage), lidge-jun#557 optional wt2 zero-leak: PRs lidge-jun#840 lidge-jun#841 lidge-jun#843 lidge-jun#844 lidge-jun#845 lidge-jun#847 (tracker lidge-jun#820) wt3 provider-wire: PRs lidge-jun#746 lidge-jun#860 lidge-jun#839/lidge-jun#854, issue lidge-jun#875 triage, lidge-jun#616/lidge-jun#837 optional wt4 server-config: PRs lidge-jun#850 (CORS origin confusion), lidge-jun#869 (symlink destruction) wt5 windows-service: PRs lidge-jun#868, lidge-jun#861 (issue lidge-jun#848)
Summary
[1m]markers to authoritative effective context windows of at least 1M[1m]model IDs while honoring provider caps and case-insensitive marker spelling[1m]selector when context metadata is missing or non-positive, stripping it only when a positive authoritative window proves sub-1MProblem
Generated agent profiles reused the main-session auto-context predicate, so a 372K native route could be written with
[1m]. The Anthropic registry and generated jawcode metadata also disagreed about Claude 4.6/4.7 windows, allowing valid 1M selectors to lose their marker during catalog-to-profile generation.The marker is also overloaded: it can be Claude's context-accounting suffix or part of a real routed selector such as Kimi
k3[1m]. Unconditional stripping loses the real selector, while unconditional preservation can ignore an effective provider context cap.Missing metadata is not evidence of a sub-1M context. Catalog-derived selectors that already carry
[1m]must therefore keep it unless a positive effective window explicitly proves otherwise.Fix
fetchProviderModels()andbuildClaudeContextWindows()in regression coverage[1m]marker for exact lookup, preserving the rest of the model ID and honoring raw exact-key precedenceThis absorbs the shared source-of-truth reconciliation requested on #839.
Verification
JAWCODE_MODELS_JSON=/tmp/opencodex-jawcode-854/opencodex-snapshot.json npx --yes bun@1.3.14 test --isolate tests/claude-agents-inject.test.ts tests/claude-context-windows.test.ts tests/codex-catalog.test.ts tests/provider-registry-parity.test.ts tests/jawcode-metadata-sync.test.ts— 178 passed, 0 failednpx --yes bun@1.3.14 x tsc --noEmit— passedJAWCODE_MODELS_JSON=/tmp/opencodex-jawcode-854/opencodex-snapshot.json npx --yes bun@1.3.14 scripts/test.ts— 6,963 passed, 9 skipped, 0 failedgit diff --check origin/dev— passed for the PR-relative diffChecklist
Summary by CodeRabbit
[1m]marker.