Skip to content

fix(setup): deploy the system agent once /setup has created the admin (#3237) - #3263

Closed
obasilakis wants to merge 1 commit into
devfrom
fix/3237-system-agent-after-setup
Closed

obasilakis wants to merge 1 commit into
devfrom
fix/3237-system-agent-after-setup

Conversation

@obasilakis

Copy link
Copy Markdown
Contributor

Closes #3237.

Problem

trinity-system's only deploy attempt runs at backend startup (main.py::_init_docker_and_system_agent). On a fresh install that is before /setup creates the admin that owns it, so it fails with Admin user 'admin' not found, and nothing retries until the backend restarts. Every one-click / marketplace install hits this.

Fix

routers/setup.py schedules _deploy_system_agent as a background task right after the first-run seed pass (Cornelius + starter agents come first). It wraps system_agent_service.ensure_deployed() and never raises: setup has already succeeded, and the next backend start retries. ensure_deployed is idempotent, so the startup call stays a no-op afterwards.

Verification

🤖 Generated with Claude Code

…#3237)

The system agent's only deploy attempt ran at backend startup. On a fresh
install that is before /setup creates the admin it is owned by, so it failed
with "Admin user 'admin' not found" and stayed missing until the backend next
restarted.

/setup now schedules system_agent_service.ensure_deployed() as a background
task after the first-run seed pass. It never raises (setup has already
succeeded; the next start retries), and ensure_deployed is idempotent, so the
startup path stays a no-op afterwards.

Verified on an AWS instance from the v1.0.0-aws.2 AMI: with agent-trinity-system
removed, the task recreated it (NanoCpus capped to the host's 2 CPUs).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@obasilakis
obasilakis requested a review from vybe October 6, 2026 08:08
@vybe

vybe commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-10-06): closing as superseded — #3261 (same fix for #3237, via a lazy-import _deploy_system_agent_after_setup background task) landed on dev this morning at 7787712, and this branch now conflicts with it on the add/add test file. Nothing from here is lost; if there is a behaviour in this PR that #3261 does not cover, reopen with that delta.

@vybe vybe closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants