Repository navigation
fix(setup): deploy the system agent once /setup has created the admin (#3237) - #3263
Closed
obasilakis wants to merge 1 commit into
Closed
obasilakis wants to merge 1 commit into
obasilakis wants to merge 1 commit into
Conversation
…#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>
Contributor
|
merge-train (2026-10-06): closing as superseded — #3261 (same fix for #3237, via a lazy-import |
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.
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/setupcreates the admin that owns it, so it fails withAdmin user 'admin' not found, and nothing retries until the backend restarts. Every one-click / marketplace install hits this.Fix
routers/setup.pyschedules_deploy_system_agentas a background task right after the first-run seed pass (Cornelius + starter agents come first). It wrapssystem_agent_service.ensure_deployed()and never raises: setup has already succeeded, and the next backend start retries.ensure_deployedis idempotent, so the startup call stays a no-op afterwards.Verification
tests/unit/test_3237_system_agent_after_setup.py: the deploy is scheduled after the seed pass; a raisingensure_deployeddoes not propagate; the wrapper calls it. All three failed before the fix (no attribute '_deploy_system_agent').v1.0.0-aws.2AMI: removedagent-trinity-system, ran the task inside the backend →System agent after setup: created, container running withNanoCpus=2000000000(the bug: trinity-system agent can never be created on hosts with fewer than 4 CPUs — template cpu:"4" passed to Docker unclamped #2318 cap).🤖 Generated with Claude Code