Repository navigation
fix(agents): pre-acknowledge Claude Code's cost-threshold notice - #587
Merged
Merged
Conversation
added 2 commits
October 27, 2026 15:15
An API-billed Claude Code session that crosses $5 shows a blocking "You've spent $5 on the Anthropic API this session." notice. Nobody answers it in an automatic step, so the pane goes silent and the no-output watchdog kills the session after 30 minutes (runs 3390, 5341). Write hasAcknowledgedCostThreshold into ~/.claude.json, the flag the CLI itself records once the notice is answered (confirmed on 2.1.310), and teach InteractivePromptDetector the notice so a CLI that shows it anyway fails at once with a message that names it. Signed-off-by: Aixle Flow <[email protected]>
Signed-off-by: Aixle Flow <[email protected]>
artempartos
added a commit
to Hitin/flow
that referenced
this pull request
Oct 28, 2026
* origin/develop: docs(workflows): describe workflows as sessions made of steps (AixleHQ#595) feat(workflows): open archived workflows read-only in the builder (AixleHQ#594) feat(task-comments): let authors delete their own recent comments (AixleHQ#593) feat(mcp): log the JSON-RPC method and tool name of each MCP call (AixleHQ#592) fix(board): show a run waiting for a session slot as Queued on its card (AixleHQ#591) feat(brand): use the new Aixle Flow lockup and route fonts through tokens (AixleHQ#590) feat(overview): show tokens used and session time instead of token cost (AixleHQ#589) fix(agents): pre-acknowledge Claude Code's cost-threshold notice (AixleHQ#587) test(playwright): QA helpers batch 2 (appRequest, readInertiaPage, shot, probeRoutes, signOut) (AixleHQ#586) test(playwright): plain-JS QA helpers for browser_run_code on staging (AixleHQ#584) feat(runners): add the runners table and the Runner model (AixleHQ#583) refactor(feature-flags): plain cached reads, no usage tooling (AixleHQ#579) # Conflicts: # CHANGELOG.md
artempartos
added a commit
to Hitin/flow
that referenced
this pull request
Oct 28, 2026
* origin/develop: docs(workflows): describe workflows as sessions made of steps (AixleHQ#595) feat(workflows): open archived workflows read-only in the builder (AixleHQ#594) feat(task-comments): let authors delete their own recent comments (AixleHQ#593) feat(mcp): log the JSON-RPC method and tool name of each MCP call (AixleHQ#592) fix(board): show a run waiting for a session slot as Queued on its card (AixleHQ#591) feat(brand): use the new Aixle Flow lockup and route fonts through tokens (AixleHQ#590) feat(overview): show tokens used and session time instead of token cost (AixleHQ#589) fix(agents): pre-acknowledge Claude Code's cost-threshold notice (AixleHQ#587) test(playwright): QA helpers batch 2 (appRequest, readInertiaPage, shot, probeRoutes, signOut) (AixleHQ#586) test(playwright): plain-JS QA helpers for browser_run_code on staging (AixleHQ#584) feat(runners): add the runners table and the Runner model (AixleHQ#583) refactor(feature-flags): plain cached reads, no usage tooling (AixleHQ#579) # Conflicts: # CHANGELOG.md
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.
Board task #184.
Problem
An API-billed Claude Code session that crosses $5 shows a blocking notice ("You've spent $5 on the Anthropic API this session.") and waits for a keypress. In an automatic step nobody answers, the pane goes silent and
Sessions::NoOutputWatchdogkills the session after 30 minutes, failing the run even when its work was done (runs 3390, 5341).Changes
Agents::ClaudeCodeAdapter#generate_configwrites"hasAcknowledgedCostThreshold" => truenext tohasSeenAutoDefaultNudge, with a comment. No other config key changes.InteractivePromptDetectorgets a:claude_cost_thresholdsignature (claude_code only). Markers: the notice title and its single optionGot it, thanks!. Footer:Enter to confirm · Esc to cancel. That footer is shared by all Claude Code select dialogs, so the markers carry the specificity. If a later CLI shows the notice anyway, the session fails right away with a message naming the notice and the config flag.generate_configasserts the key. Detector tests cover detection and the message, moving past the notice, another dialog with the same footer, and another agent type.How the key was confirmed against the pinned version
The pin is
cli_version: "2.1.310"inconfig/agent_runtimes.json(theCLI_VERSIONbuild arg ofdocker/claude-code/Dockerfile).https://downloads.claude.ai/claude-code-releases/2.1.310/linux-x64/claude. Its sha256b7367643…47df56matches the release manifest, andclaude --versionreports2.1.310 (Claude Code).cost-thresholdnotification skips the dialog whenue().hasAcknowledgedCostThreshold(the global~/.claude.jsonconfig) is set. Its threshold is5USD (Gh()=costLedger.totalCostUSD()), and acknowledging runsRe(H => ({...H, hasAcknowledgedCostThreshold: !0})).oauthAccount(the notice'sWBr()gate needs this). After one turn the notice appeared. The detector test fixture is that capture. Pressing Enter wrotehasAcknowledgedCostThreshold: trueto~/.claude.json. A fresh run with the key preset and the same cost showed no notice.How to test
bin/rails test test/services/agents/claude_code_adapter_test.rb test/services/interactive_prompt_detector_test.rb, then the full suite.