fix(agent): report paper cycles as mode=paper, not mode=confirm - #126
Merged
Conversation
`_effective_mode` returns the executor string "confirm" for any non-live
config -- paper included -- because paper never reaches an executor. The
loop summary and the `agent.mode_resolved` log event surfaced that raw
value verbatim, so a paper cycle printed `mode=confirm`, telling the user
a confirm-mode (live) run had happened when the cycle only ever hit the
paper path and never touched the broker.
Split "what the executor uses" from "what we report": `mode` still drives
`executor.execute`/`_handle_exits` on the live path, while a new
`reported_mode` ("paper" when the paper trader is active, else `mode`)
drives the log event and `LoopResult.mode`. Confirm and autonomous runs
are unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
Running
keel agentwith the defaultconfig.yaml(which ismode: paper) printed:The
mode=confirmwas misleading — it told the user a live confirm-mode run had happened when the cycle only ever hit the paper simulation path and never touched the broker. (This directly caused a support question: "why didn't it place the order in Coinbase?")Root cause
_effective_modereturns the executor string"confirm"for any non-live config — paper included — because paper never reaches an executor (it routes toPaperTraderupstream).run_oncesurfaced that raw value in both theagent.mode_resolvedlog event andLoopResult.mode.Fix
Split "what the executor uses" from "what we report":
mode(executor mode) is unchanged and still passed toexecutor.execute/_handle_exitson the live path.reported_mode = "paper" if paper_trader is not None else modedrives the log event andLoopResult.mode.Confirm and autonomous runs are unchanged.
Verification
test_paper_mode_is_reported_as_paper_not_confirm(written failing first).config.yamlnow printsmode=paper;--config config.local.yamlstill printsmode=confirm.🤖 Generated with Claude Code