Skip to content

fix(agent): report paper cycles as mode=paper, not mode=confirm - #126

Merged
eaitbrahim merged 1 commit into
mainfrom
fix/agent-paper-mode-report
Jul 22, 2026
Merged

fix(agent): report paper cycles as mode=paper, not mode=confirm#126
eaitbrahim merged 1 commit into
mainfrom
fix/agent-paper-mode-report

Conversation

@eaitbrahim

Copy link
Copy Markdown
Contributor

Problem

Running keel agent with the default config.yaml (which is mode: paper) printed:

mode=confirm polled=0 products=[] stale=[] signals=0 entered=0 exited=0

The mode=confirm was 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_mode returns the executor string "confirm" for any non-live config — paper included — because paper never reaches an executor (it routes to PaperTrader upstream). run_once surfaced that raw value in both the agent.mode_resolved log event and LoopResult.mode.

Fix

Split "what the executor uses" from "what we report":

  • mode (executor mode) is unchanged and still passed to executor.execute / _handle_exits on the live path.
  • A new reported_mode = "paper" if paper_trader is not None else mode drives the log event and LoopResult.mode.

Confirm and autonomous runs are unchanged.

Verification

  • New test test_paper_mode_is_reported_as_paper_not_confirm (written failing first).
  • Full suite: 1323 passed.
  • Manual: default config.yaml now prints mode=paper; --config config.local.yaml still prints mode=confirm.

🤖 Generated with Claude Code

`_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>
@eaitbrahim
eaitbrahim merged commit 6960eb5 into main Jul 22, 2026
1 check passed
@eaitbrahim
eaitbrahim deleted the fix/agent-paper-mode-report branch July 23, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant