feat: persist agent's soul_template to prevent overwriting on reprovision

This commit is contained in:
Abhimanyu Saharan
2026-02-08 00:47:46 +05:30
parent 460d4adddf
commit da1559fc98
2 changed files with 8 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ from app.api import tasks as tasks_api
from app.api.deps import ActorContext, get_board_or_404, get_task_or_404
from app.core.agent_auth import AgentAuthContext, get_agent_auth_context
from app.core.config import settings
from app.core.time import utcnow
from app.db.pagination import paginate
from app.db.session import get_session
from app.integrations.openclaw_gateway import GatewayConfig as GatewayClientConfig
@@ -572,6 +573,12 @@ async def update_agent_soul(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail="content is required",
)
# Persist the SOUL in the DB so future reprovision/update doesn't overwrite it.
target.soul_template = content
target.updated_at = utcnow()
session.add(target)
await session.commit()
try:
await openclaw_call(
"agents.files.set",