fixed annoying error, when starting up the assistant with jobs = true#184
fixed annoying error, when starting up the assistant with jobs = true#184sproft wants to merge 1 commit intodnhkng:mainfrom
Conversation
…tonomy_loop = None
📝 WalkthroughWalkthroughA single conditional check in the autonomy loop wiring logic is refactored from a presence check ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can use your project's `pylint` configuration to improve the quality of Python code reviews.Add a pylint configuration file to your project to customize how CodeRabbit runs |
There was a problem hiding this comment.
Pull request overview
Fixes a startup crash in the core engine when autonomy jobs are enabled by preventing an attempt to call methods on a None autonomy loop during subagent registration.
Changes:
- Replace
hasattr(self, "autonomy_loop")with a truthiness check onself.autonomy_loopbefore wiring the emotion agent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if self.autonomy_config.enabled and self.autonomy_loop: | ||
| self.autonomy_loop.set_emotion_agent(emotion_agent) |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/glados/core/engine.py`:
- Around line 713-714: The call to set_emotion_agent in _register_subagents() is
skipped because self.autonomy_loop is not yet created; either move the wiring to
after the autonomy_loop is instantiated or implement a pending-attach mechanism:
when _register_subagents() sees autonomy_config.enabled but autonomy_loop is
None, save emotion_agent to self._pending_emotion_agent (or similar), and ensure
the code that creates/assigns self.autonomy_loop (where the loop is constructed)
checks for self._pending_emotion_agent and calls
self.autonomy_loop.set_emotion_agent(self._pending_emotion_agent) (then clear
the pending field). This preserves the existing autonomy_config.enabled check,
uses the existing symbols (_register_subagents, autonomy_loop,
set_emotion_agent, emotion_agent), and guarantees emotion wiring regardless of
init order.
| if self.autonomy_config.enabled and self.autonomy_loop: | ||
| self.autonomy_loop.set_emotion_agent(emotion_agent) |
There was a problem hiding this comment.
Emotion agent wiring now never happens due init order
At Line 713, self.autonomy_loop is always None when _register_subagents() runs (the loop is only created later at Line 511), so set_emotion_agent(...) is skipped permanently. This fixes the startup error, but it also silently disables vision→emotion forwarding.
Suggested fix
@@
- # Wire emotion agent to autonomy loop for vision events
- if self.autonomy_config.enabled and self.autonomy_loop:
- self.autonomy_loop.set_emotion_agent(emotion_agent)
+ # Autonomy loop is initialized later in __init__; wiring is done there.@@
if self.autonomy_config.enabled:
assert self.autonomy_event_bus is not None
assert self.autonomy_slots is not None
self.autonomy_loop = AutonomyLoop(
@@
pause_time=self.PAUSE_TIME,
)
+ if self._emotion_agent is not None:
+ self.autonomy_loop.set_emotion_agent(self._emotion_agent)
if not self.vision_config:
self.autonomy_ticker_thread = threading.Thread(🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/glados/core/engine.py` around lines 713 - 714, The call to
set_emotion_agent in _register_subagents() is skipped because self.autonomy_loop
is not yet created; either move the wiring to after the autonomy_loop is
instantiated or implement a pending-attach mechanism: when _register_subagents()
sees autonomy_config.enabled but autonomy_loop is None, save emotion_agent to
self._pending_emotion_agent (or similar), and ensure the code that
creates/assigns self.autonomy_loop (where the loop is constructed) checks for
self._pending_emotion_agent and calls
self.autonomy_loop.set_emotion_agent(self._pending_emotion_agent) (then clear
the pending field). This preserves the existing autonomy_config.enabled check,
uses the existing symbols (_register_subagents, autonomy_loop,
set_emotion_agent, emotion_agent), and guarantees emotion wiring regardless of
init order.
because hassattr evaluated to true when self.autonomy_loop = None
Summary by CodeRabbit