Skip to content

fix(coders): initialize reflected_message in __init__ to prevent AttributeError#571

Merged
dwash96 merged 1 commit into
cecli-dev:v0.100.6from
Digital-Defiance:pr/fix-reflected-message-init
Jun 12, 2026
Merged

fix(coders): initialize reflected_message in __init__ to prevent AttributeError#571
dwash96 merged 1 commit into
cecli-dev:v0.100.6from
Digital-Defiance:pr/fix-reflected-message-init

Conversation

@JessicaMulein

Copy link
Copy Markdown

Summary

reflected_message was only initialized in init_before_message(), called from the normal run() loop. Code paths that bypass run() — such as run_one_shot() or run_message() — could trigger check_for_file_mentions() before init_before_message() was called, raising:

AttributeError: 'EditBlockCoder' object has no attribute 'reflected_message'

This occurred when a local model emitted a [ContextManager] file reference during a headless session (spec generation), causing check_for_file_mentions to access self.reflected_message at line 2541 of base_coder.py.

Fix

Initialize self.reflected_message = None in Coder.__init__() so the attribute always exists regardless of entry point.

Test plan

  • All existing pytest pass (no behavioral change — init_before_message still resets to None on every normal run())
  • Reproducer: spec-gen explore turn with qwen3.6:35b emitting [ContextManager] no longer crashes

…ibuteError

The reflected_message attribute was only initialized in init_before_message(),
which is called from the normal run() loop. Code paths that bypass run() — such
as run_one_shot() used by spec generation, or run_message() used by headless
agent sessions — could trigger check_for_file_mentions() before
init_before_message() was ever called, raising:

    AttributeError: 'EditBlockCoder' object has no attribute 'reflected_message'

This occurred in production when a local model (qwen3.6:35b) emitted a
[ContextManager] file reference during a spec-gen explore turn, causing
check_for_file_mentions to access self.reflected_message on line 2541.

Fix: set self.reflected_message = None in Coder.__init__() so the attribute
always exists regardless of entry point.
JessicaMulein added a commit to Digital-Defiance/BrightVision that referenced this pull request Jun 12, 2026
…ror in spec-gen

Cherry-pick of cecli-dev/cecli#571: initialize reflected_message in
Coder.__init__() so headless paths (run_one_shot, run_message) don't crash
when check_for_file_mentions accesses the attribute before init_before_message.
@dwash96 dwash96 changed the base branch from main to v0.100.6 June 12, 2026 19:01
@dwash96 dwash96 merged commit ea9e218 into cecli-dev:v0.100.6 Jun 12, 2026
12 checks passed
@dwash96 dwash96 mentioned this pull request Jun 12, 2026
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.

2 participants