Repository navigation
feat(gui): add a Context accounting control to the Claude Code page - #6782
Conversation
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…, en, light) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd9b47ea94
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const marker = state.authMode === "auto" ? (state.markerMode ?? "subscription") : state.authMode; | ||
| const autoCompactActive = state.autoContext && state.maxContextTokens === null; | ||
| // The 200k opt-in injects no compact window, so the pasted block must not either. | ||
| const autoCompactActive = state.contextAccounting !== "200k" && state.autoContext && state.maxContextTokens === null; |
There was a problem hiding this comment.
Keep the manual snippet on one accounting snapshot
When the loaded 1M state has server-derived effectiveModelEnv entries ending in [1m], selecting 200k makes this condition remove CLAUDE_CODE_AUTO_COMPACT_WINDOW immediately, while modelEnvExports still emits those stale 1M-marked model IDs. This inconsistency also persists after a successful save if the refresh fails, because the save acknowledgement preserves server-derived fields. Copying the Quickstart block then launches an explicitly 1M-accounted model without the matching compaction threshold, contrary to the selected policy; derive both parts from the same confirmed state or refresh/recompute the effective model environment before exposing the snippet.
AGENTS.md reference: gui/AGENTS.md:L10-L10
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This was a real mix. gui/src/pages/claude-manual-env.ts dropped CLAUDE_CODE_AUTO_COMPACT_WINDOW as soon as the draft was 200k, while effectiveModelEnv was still the server's 1M snapshot, including after a save whose refresh had not landed (gui/src/pages/claude-code-save.ts keeps server-derived fields). eb0c7e50a builds both parts from one snapshot: a 200k draft strips automatic [1m] marks, keeps a marker already on the configured selector, and omits unset native tier fills. A 1m draft over a 200k env does not add the compact window until that env is rebuilt.
68b46e3 to
2688bb0
Compare
fb5e7d4 to
3d7efed
Compare
3d7efed to
eb0c7e5
Compare
d5af50e to
bd2f44c
Compare
eb0c7e5 to
857c660
Compare
bd2f44c to
a1b7037
Compare
857c660 to
acf923e
Compare
a1b7037 to
1e445a4
Compare
acf923e to
2ba95bc
Compare
1e445a4 to
041b580
Compare
2ba95bc to
5790ac8
Compare
The Claude Code settings page gets a 1M (default) / 200k select for claudeCode.contextAccounting. Under 200k the auto-context and auto-summarize rows are hidden (they have no effect there) and the manual env block stops exporting a compact window, matching what the runtime injects. A state cached by an older proxy, or read from one, normalizes to the 1m default. Strings are added to all eleven locales. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up: the description now says 200k only stops automatic 1M marking (an explicit 1M row and a context override still apply), and the two component fixtures that mount the settings card directly carry the new field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nch guard Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Selecting 200k dropped the compact window while the pasted model ids still carried the server's automatic [1m] marks. The snippet now strips those marks, keeps an explicit [1m], and omits the compact window until the model env was built under the same policy. Co-authored-by: JUN <jun@lidgeai.com>
5790ac8 to
6611945
Compare
Summary
Adds the dashboard control for
claudeCode.contextAccounting(#6781) on the Claude Code settings page.1M (default)/200k.200k, the "Use big context automatically" and "Auto-summarize point" rows are hidden because they have no effect there. Their saved values stay, so they come back unchanged when you return to 1M.CLAUDE_CODE_AUTO_COMPACT_WINDOWunder200k, matching what the runtime injects.normalizeContextAccounting, used bynormalizeFirstPartyStatefor both the session cache and the GET).EDITABLE_KEYS).200kis allowlisted in the zh-TW placeholder test as a token count.Stack (merge bottom-up):
claudeCode.contextAccounting: "200k"opt-inprompt is too longDepends on #6781. Review this PR's diff only.
Screenshots
Default (1M):
200k selected (auto-context rows hidden, unsaved draft):
Verification
bun run typecheck; ingui/:bun run lint,bun run lint:i18n,bun x tsc -b,bun run build.claude-code-save,claude-code-sidecar-draft,anthropic-instance-helper-controls,claude-code-types,claude-code-first-party,i18n-locales,locale-parity): 100 pass, 0 fail.tests/gui/claude-manual-env.test.tsandclaude-context-accounting.test.ts: 15 pass.HOME/CODEX_HOME/OPENCODEX_HOME). I checked the default state and the 200k draft state (rows hidden, "Unsaved changes") and reverted without saving. Persistence is covered by the management API round-trip test in feat(claude): add a 200k context-accounting opt-in #6781.Checklist
🤖 Generated with Claude Code