Skip to content

Adding ACP agent to agents.list silently hijacks all routing from implicit main agent #44375

Description

@barronlroth

Summary

Adding a single ACP-bound agent to agents.list (e.g. for a persistent Codex binding on a Telegram topic) silently takes over as the default agent for all traffic — DMs, every group topic, heartbeats, crons — replacing the implicit main agent. No warning is shown. The user has no indication that their primary agent identity has changed.

Steps to Reproduce

  1. Start with a working single-agent setup (no agents.list entries, implicit main agent with 596+ sessions of history).
  2. Want to bind a persistent ACP Codex session to a single Telegram forum topic.
  3. Run: openclaw config set agents.list '[{"id":"codex-cubby","runtime":{"type":"acp","acp":{"agent":"codex","backend":"acpx","mode":"persistent","cwd":"/path/to/project"}}}]'
  4. Add a binding for that specific topic.
  5. Restart gateway.

Expected Behavior

  • Only the bound Telegram topic routes to codex-cubby.
  • All other traffic (DMs, other topics, heartbeats, crons) continues routing to main.
  • If the implicit main agent would be displaced, show a warning.

Actual Behavior

  • All traffic routes to codex-cubby because it is the first (and only) entry in agents.list, making it the default per the routing fallback rule.
  • The implicit main agent is completely abandoned — 596 sessions, QMD index, auth profiles, all orphaned.
  • New sessions are created under ~/.openclaw/agents/codex-cubby/ with fresh history.
  • Session keys change from agent:main:... to agent:codex-cubby:..., breaking any hardcoded references (e.g. in HEARTBEAT.md sessions_history calls).
  • No warning or confirmation is shown during the config change.

Impact

  • Complete loss of conversational continuity (weeks/months of session history orphaned).
  • QMD memory search index orphaned (built under main, now unused).
  • All cron jobs, heartbeats, and topic sessions silently re-keyed.
  • User discovers the problem days later when debugging unrelated issues.

Suggested Fixes

  1. Warn when implicit main would be displaced. If agents.list is being set for the first time and does not include an entry with id: "main" or default: true, warn the user that the implicit main agent will no longer receive traffic.
  2. Auto-include implicit main. When agents.list is populated, auto-add {"id": "main", "default": true} if no default is specified and main agent state exists on disk.
  3. Require explicit default: true. Instead of falling back to "first list entry," require at least one entry to have default: true when multiple agents exist (or when any agent is added).

Environment

  • OpenClaw 2026.3.8 → 2026.3.11
  • macOS (Apple Silicon)
  • Single Telegram bot account
  • Config change made via openclaw config set from an agent topic session

Workaround

Delete the ACP agent from agents.list, merge its sessions back into main, and restart. Requires manual session file migration and sessions.json re-keying.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions