fix: Unable to create scheduled tasks - #3780
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes scheduled-task creation failures by hardening how agent outputs and user messages are interpreted in the automation flow, and by ensuring LLM calls are wired with an observer.
Changes:
- Prevents misclassifying explicit “Final answer / 最终回答” outputs as incomplete action/tool preambles.
- Strips runtime-injected
[Current time: ...]headers from the persisted user message before language detection and proposal creation. - Passes a
MessageObserverinto automation LLM calls and updates tests accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
sdk/nexent/core/agents/core_agent.py |
Adds explicit final-answer detection to avoid false “incomplete action” classification. |
backend/services/agent_automation/tool_adapter.py |
Strips runtime time header before language detection and proposal request creation. |
backend/services/agent_automation/prompt_generator.py |
Injects MessageObserver into the automation prompt-generation LLM model. |
backend/services/agent_automation/intent_analyzer.py |
Injects MessageObserver into the automation intent-analysis LLM model. |
test/sdk/core/agents/test_core_agent.py |
Adds regression coverage for explicit final-answer outputs. |
test/backend/services/test_agent_automation_tool_adapter.py |
Adds coverage for stripping runtime time headers and updates adapter expectations. |
test/backend/services/test_agent_automation_prompt_generator.py |
Asserts observer is provided to the LLM model config. |
test/backend/services/test_agent_automation_intent_analyzer.py |
Captures LLM model config to assert observer is provided. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+40
to
+44
| if normalized.startswith("[Current time:"): | ||
| close_index = normalized.find("]", len("[Current time:")) | ||
| if close_index >= 0: | ||
| return normalized[close_index + 1:].lstrip("\n").strip() | ||
| return normalized |
Comment on lines
236
to
238
| llm = OpenAIModel( | ||
| observer=MessageObserver(), | ||
| model_id=get_model_name_from_config(self._model_config) if self._model_config.get("model_name") else "", |
Comment on lines
292
to
294
| llm = OpenAIModel( | ||
| observer=MessageObserver(), | ||
| model_id=get_model_name_from_config(self._model_config), |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
before:
after: