fix(runtime): recover awake ownership and batch model failures
This commit is contained in:
1 parent
6b2c0f199d
commit
baf069854b
17 files changed
+477
-32
No files matched your search
@@ -164,6 +164,7 @@ async def execute_task(
|
||||
config.with_graph_config_callbacks(graph_config_callbacks)
|
||||
|
||||
agent: Agent | None = None
|
||||
task_started = False
|
||||
try:
|
||||
agent = Agent(config=config.build(), session_id=effective_sid)
|
||||
await agent.init(
|
||||
@@ -196,7 +197,14 @@ async def execute_task(
|
||||
request.plugins = plugins
|
||||
elif plugin_choices is not None:
|
||||
request.plugins = TypeAdapter(list[PluginSelection]).validate_json(plugin_choices)
|
||||
task_started = True
|
||||
await agent.run_task(request=request)
|
||||
except Exception as exc:
|
||||
if not task_started and effective_sid:
|
||||
from artemis.runtime.task_result import save_failure_result
|
||||
|
||||
save_failure_result(str(effective_sid), str(exc), code="initialization_failed")
|
||||
raise
|
||||
finally:
|
||||
if agent is not None:
|
||||
await agent.clean()
|
||||
|
||||
Reference in new issue
Block a user