Skip to content

bug: system agent is never created when ADMIN_USERNAME is not 'admin' — SYSTEM_AGENT_OWNER is hard-coded #3262

Closed

Description

@dolho

Summary

services/system_agent_service.py hard-codes SYSTEM_AGENT_OWNER = "admin". _create_system_agent looks up that literal username and raises Admin user 'admin' not found when it is missing. The platform provisions its admin under utils/admin_identity.admin_username(), which honours ADMIN_USERNAME. With ADMIN_USERNAME set to anything else, trinity-system is never created, on any boot or after /setup (#3237).

#2381 fixed the same mismatch in routers/setup.py and the setup_completed_backfill migration. The admin_identity docstring records that history.

Where

  • src/backend/services/system_agent_service.py: SYSTEM_AGENT_OWNER = "admin", the _create_system_agent lookup, the MCP key's owner_username, and register_agent_owner.

Reproduction

  1. Set ADMIN_USERNAME=root (with ADMIN_PASSWORD set) and start Trinity.
  2. The backend log shows System agent: create_failed - Failed to create system agent: Admin user 'admin' not found.
  3. docker ps shows no agent-trinity-system.

Acceptance Criteria

  • The system agent's owner resolves through admin_username(), not a literal.
  • On an ADMIN_USERNAME=root install the system agent is created and owned by root.
  • Existing installs, where the owner is admin, are unaffected.
  • A test pins the owner resolution.

Related

Activity

  1. added
    priority-p3
    type-bug
    theme-reliability
    complexity-low
    on Oct 6, 2026
  2. dolho commented on Oct 6, 2026

    @dolho
    ContributorAuthor

    /claim

  3. added
    status-in-progress
    on Oct 6, 2026
  4. github-actions commented on Oct 6, 2026

    @github-actions

    Claimed by @dolho. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/3262-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #3262
  5. added
    status-in-dev
    and removed
    status-in-progress
    on Oct 7, 2026
  6. removed
    status-in-dev
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-lowpriority-p3theme-reliabilitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions