feat: expose --max-cost CLI flag with cost threshold warnings#247
Merged
rubenmarcus merged 1 commit intomainfrom Feb 25, 2026
Merged
feat: expose --max-cost CLI flag with cost threshold warnings#247rubenmarcus merged 1 commit intomainfrom
rubenmarcus merged 1 commit intomainfrom
Conversation
Wire the existing maxCost infrastructure to a new --max-cost CLI option. When no budget is set, warn users at $2/$5/$10 thresholds to encourage setting a limit. This is opt-in only — no default limit that could break existing long-running loops. Closes #211 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Issue Linking ReminderThis PR doesn't appear to have a linked issue. Consider linking to:
Using If this PR doesn't need an issue, you can ignore this message. |
Contributor
✔️ Bundle Size Analysis
Bundle breakdown |
Contributor
Greptile SummaryThis PR exposes the existing Key Changes:
Implementation Quality:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User runs CLI with --max-cost flag] --> B[cli.ts parses flag with parseFloat]
B --> C[run.ts receives maxCost in options]
C --> D[maxCost passed to executor.ts LoopOptions]
D --> E[CostTracker initialized with maxCost config]
E --> F[Loop iteration executes]
F --> G[CostTracker.recordIteration tracks cost]
G --> H{maxCost set?}
H -->|Yes| I[CostTracker.isOverBudget checks budget]
H -->|No| J[Check threshold crossings]
I -->|Over budget| K[Break loop with cost_ceiling exit]
I -->|Under budget| L[Continue loop]
J -->|Crossed $2/$5/$10| M[Display yellow warning with --max-cost tip]
J -->|No crossing| L
M --> L[Continue loop]
L --> F
Last reviewed commit: 9164b09 |
This was referenced Mar 3, 2026
Merged
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.
Summary
maxCostinfrastructure as a--max-cost <amount>CLI flag⚠ Estimated cost has reached $5. Use --max-cost to set a budget limit.Context
User feedback: spent $10 on a simple task with no visibility into costs. The
maxCostplumbing existed inexecutor.tsandcost-tracker.tsbut was never wired to the CLI.Test plan
ralph-starter run --helpshows--max-costoptionralph-starter run --max-cost 1 "test"stops loop when cost reaches $1--max-cost, warnings appear at $2/$5/$10 thresholdspnpm buildcompiles cleanlypnpm test:runpasses all 171 tests🤖 Generated with Claude Code