-
Notifications
You must be signed in to change notification settings - Fork 32
🤖 feat: add model selection to /compact command #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR.
- Add -m <model> flag to /compact command for choosing compaction model - Reuse MODEL_ABBREVIATIONS for consistent abbreviation handling - Support both abbreviated (sonnet, haiku, opus) and full model strings - Update StreamingBarrier to show model name during compaction - Falls back to workspace model when -m flag not specified - Add comprehensive tests covering all flag combinations Examples: /compact -m haiku /compact -m opus -t 8000 /compact -m anthropic:claude-opus-4-1 Generated with `cmux`
Generated with `cmux`
Move thinking policy enforcement from frontend to backend (agentSession.streamWithHistory) to ensure it's applied consistently regardless of where the request originates (compact command, manual override, etc.). This prevents bugs where custom model overrides might bypass policy requirements (e.g., gpt-5-pro requiring 'high' thinking). Single source of truth pattern - no need to remember to call enforceThinkingPolicy in multiple places. Generated with `cmux`
Haiku is the fastest good coding model, making it ideal for compaction. Generated with `cmux`
Replace dynamic import with static import to satisfy linter rules. Generated with `cmux`
Extract compaction transformation logic into shared utility to ensure consistency between initial send (ChatInput) and resume (useResumeManager). This eliminates the architectural fragility where custom model/token overrides could be lost during stream resumption. Now both code paths call the same applyCompactionOverrides() function. Key changes: - Add CompactionRequestData shared type (includes model field) - Create applyCompactionOverrides(baseOptions, compactData) utility - Update prepareCompactionMessage to use shared function - Update useResumeManager to detect compaction and apply overrides - Add comprehensive tests for transformation logic Benefits: - Single source of truth for option transformation - Impossible to have divergent behavior between paths - Custom model preserved across interruption/resume - Works retroactively (user message metadata already persisted) Generated with `cmux`
fc9e193 to
c4154ca
Compare
Check if cached shfmt binary works before using it. If the cache contains a broken binary, reinstall it. Fixes CI failure where cache hit but binary was unusable. Generated with `cmux`
Overview
Adds support for choosing the compaction model via
/compact -m <model>flag. Reuses existing model abbreviation infrastructure for consistency and shows the model name in the streaming barrier during compaction.Changes
-mflag parsing to/compactcommand with model abbreviation resolutionParsedCommandto include optionalmodelfield for compact commandprepareCompactionMessage()to use custom model when specifiedStreamingBarrierto show model name during compaction (e.g., "claude-haiku-4-5 compacting...")-mflag, updated 27 existing testsUsage
Design Notes
MODEL_ABBREVIATIONSmap for consistency with/modelcommandTesting
✅ All 34 slash command tests passing
✅ All 547 unit tests passing
✅ TypeScript compilation successful
✅ ESLint checks passing
Generated with
cmux