Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions backend/app/api/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,13 @@ async def create_agent(
file_path.parent.mkdir(parents=True, exist_ok=True)
file_path.write_text(sf.content, encoding="utf-8")

# Start container
await agent_manager.start_container(db, agent)
if agent.agent_type == "openclaw":
# Start container
await agent_manager.start_container(db, agent)
else:
# Native Agent. No container needs to be started
agent.status = "idle"
agent.last_active_at = datetime.now(timezone.utc)
Comment on lines +344 to +345
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve running status for newly created native agents

This change now forces every non-OpenClaw agent to idle at creation time and no longer calls agent_manager.start_container, so native agents no longer transition to running even in environments where runtime startup is available. That breaks features that still require running status (for example, backend/app/services/scheduler.py:43 skips scheduled executions, and backend/app/services/collaboration.py:39 rejects delegation), causing newly created native agents to lose automation/collaboration behavior until status is manually changed.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, starting the native agent now also requires starting the OpenClaw container, which is unreasonable. If Docker isn't used for deployment, it will directly enter an idle state, affecting the two points mentioned above. Therefore, setting it to idle here is reasonable, at least it won't cause any further problems.
image
@yaojin3616 PTAL

await db.flush()

return AgentOut.model_validate(agent)
Expand Down