Skip to content

refactor(agents): move implicit-main fallback into load-time roster injection - #112678

Merged
steipete merged 108 commits into
mainfrom
claude/roster-only-agents
Jul 25, 2026
Merged

steipete merged 108 commits into
mainfrom
claude/roster-only-agents

Conversation

@steipete

@steipete steipete commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw implicitly assumed a main agent in roughly 38 runtime sites, so the configured roster was not the single source of truth. That scattered fallback made the default-agent boundary hard to reason about and blocked clean groundwork for named agents.

Why This Change Was Made

A single load-time injection now materializes { id: "main", default: true } for pre-roster configurations. The injection is in memory only: read-only commands do not rewrite the config, and JSON5 comments, includes, and environment references remain untouched. Roster validation requires exactly one explicit default.

The parse layer returns an absent agent instead of silently choosing main, and routing boundaries inject the configured default where ownership is known. LEGACY_IMPLICIT_AGENT_ID names the historical fallback; the public DEFAULT_AGENT_ID export remains as a deprecated alias because module/routing is an SDK surface.

openclaw doctor --fix owns authored-layer roster persistence, including include-provenance handling. Default deletion protection is dynamic. main remains undeletable while agents/main/agent continues to serve as the shared legacy auth store.

User Impact

Behavior is identical for every shipped installation, with zero operator action required. Existing pre-roster installs continue to run as main, while the runtime now has a single authoritative roster/default boundary that provides groundwork for named agents.

The deferred follow-up for named first agents, literal-main unreserving, and legacy session-key migration remains on h2-named-agents-archive.

Evidence

  • 24 adversarial review rounds converged to clean before landing phase 1; a fresh post-rebase Codex autoreview accepted and drove the keyed-roster, Doctor persistence, malformed-ID, and include-provenance fixes. The only rejected repeat finding described removing a gateway compatibility bridge, but the final gateway file has no behavioral diff from current origin/main and no unresolved-claim producer survives in this branch.
  • Post-rebase focused proof: 11 Vitest shards, 616 tests passed across agents, deletion, config/setup/Doctor, sessions, secrets/security, system-agent, wizard, gateway, and channel transcript context.
  • Final freshness rebase smoke: 5 Vitest shards, 220 tests passed; core and core-test typechecks passed.
  • Patch-identical node scripts/check-changed.mjs passed on Blacksmith Testbox immediately before the final conflict-free two-commit freshness rebase, including formatting, API/boundary guards, core and core-test typechecks, full core lint, database-first guards, and import-cycle checks: https://github.com/openclaw/openclaw/actions/runs/29925729176
  • Read-only config tests prove byte-identical files, including JSON5 comments. ${ENV} and $include preservation and include-owned roster provenance are covered by focused config/setup/Doctor tests.
  • Final exact-head CI passed at 92d208608160be6873a6e88225d412827a7d706f: https://github.com/openclaw/openclaw/actions/runs/30145438053
  • AI-assisted change. I understand the ownership boundaries and reviewed the final conflict resolutions against current origin/main.

ClawSweeper Rank-up Moves

  • Applied: explicit maintainer direction confirms the load-time roster injection, deprecated Plugin SDK alias, and Doctor-owned persistence/migration boundary for this landing.
  • Skipped for this PR: live upgrade proof against an operator's existing implicit-main install. That proof requires mutable operator state and credentials outside this repository landing; the compatibility path is instead covered by focused Testbox tests, QA Smoke, and exact-head CI.
  • Skipped for this PR: credentialed live proof for a configured non-main default across sessions, tool policy, auth, and channel context. Those external-state scenarios are intentionally deferred rather than silently simulated; named-first-agent and legacy session-key work remains on h2-named-agents-archive.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes commands Command implementations agents Agent runtime and tooling labels Jul 22, 2026
@steipete
steipete marked this pull request as ready for review July 22, 2026 14:12
@steipete
steipete requested a review from a team as a code owner July 22, 2026 14:12
@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Jul 22, 2026
@steipete steipete self-assigned this Jul 22, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Jul 23, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Jul 23, 2026
@steipete
steipete force-pushed the claude/roster-only-agents branch from 94e3495 to 969fbae Compare July 23, 2026 04:10
@openclaw-barnacle openclaw-barnacle Bot added channel: msteams Channel integration: msteams channel: telegram Channel integration: telegram docker Docker and sandbox tooling scripts Repository scripts labels Jul 23, 2026
@steipete
steipete force-pushed the claude/roster-only-agents branch 4 times, most recently from 694fc47 to c14e1d4 Compare July 23, 2026 12:41
@openclaw-barnacle openclaw-barnacle Bot added the channel: discord Channel integration: discord label Jul 23, 2026
@steipete
steipete force-pushed the claude/roster-only-agents branch 2 times, most recently from f3eee2a to 25b3b1e Compare July 23, 2026 17:13
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh /allow-dependencies-change comment after the guard blocks that new head SHA.

  • Current SHA: 92d208608160be6873a6e88225d412827a7d706f

@steipete
steipete force-pushed the claude/roster-only-agents branch from 25b3b1e to 2c517cf Compare July 23, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord channel: msteams Channel integration: msteams channel: telegram Channel integration: telegram cli CLI command changes commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant