Skip to content

fix: fail headless coder-switch commands clearly - #5637

Open
ump45nose wants to merge 1 commit into
Aider-AI:mainfrom
ump45nose:fix/message-switchcoder-exit
Open

fix: fail headless coder-switch commands clearly#5637
ump45nose wants to merge 1 commit into
Aider-AI:mainfrom
ump45nose:fix/message-switchcoder-exit

Conversation

@ump45nose

Copy link
Copy Markdown

Summary

  • return a non-zero status when --message triggers a coder-switching slash command
  • print a clear interactive-only error instead of silently exiting successfully
  • add focused coverage for the SwitchCoder path

Why

The one-shot --message branch swallowed SwitchCoder, reported a completed run, and returned success even though commands such as /ask, /model, and /architect were not applied.

Fixes #5623

Test

  • python -m pytest tests/basic/test_main.py::TestMain::test_message_coder_switch_returns_error -q

@kvnloo

kvnloo commented Sep 1, 2026

Copy link
Copy Markdown

Live check on PR head 2eed4e2: --message currently excepts SwitchCoder and falls through to analytics "Completed --message" with a None exit. That is a silent success after a coder switch that never happened.

This fail-loud path is the right shape: tool_error + exit 1 + a distinct analytics reason. The test (SwitchCoder(edit_format="ask") from Coder.run) pins the headless case.

Collision: #5638 patches the same three lines with a different error string that interpolates the full --message. Prefer this wording (names the command class, not the payload). Do not merge both.

I would take this one.

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.

aider --message '<slash-command>' silently does nothing and exits 0 (SwitchCoder swallowed)

2 participants