fix(coders): initialize reflected_message in __init__ to prevent AttributeError#571
Open
JessicaMulein wants to merge 1 commit into
Open
fix(coders): initialize reflected_message in __init__ to prevent AttributeError#571JessicaMulein wants to merge 1 commit into
JessicaMulein wants to merge 1 commit into
Conversation
…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.
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.
Summary
reflected_messagewas only initialized ininit_before_message(), called from the normalrun()loop. Code paths that bypassrun()— such asrun_one_shot()orrun_message()— could triggercheck_for_file_mentions()beforeinit_before_message()was called, raising:This occurred when a local model emitted a
[ContextManager]file reference during a headless session (spec generation), causingcheck_for_file_mentionsto accessself.reflected_messageat line 2541 ofbase_coder.py.Fix
Initialize
self.reflected_message = NoneinCoder.__init__()so the attribute always exists regardless of entry point.Test plan
init_before_messagestill resets to None on every normalrun())[ContextManager]no longer crashes