Skip to content

refactor(config): retire agents.list and default markers from the authored config type - #164103

Merged
steipete merged 15 commits into
mainfrom
steipete/nervous-sanderson-aec952
Oct 3, 2026
Merged

steipete merged 15 commits into
mainfrom
steipete/nervous-sanderson-aec952

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Related: #162612, #163766, #163623

What Problem This Solves

Fixes: test fixtures and code kept writing the retired agents.list roster and agent default markers because the config type still allowed them, even though config validation has rejected both since #162612. Gateway startup then refused those configs (#163766, #163623), and production code reading the untyped runtime agents.list silently saw an empty roster in config-mutation drafts and canonical configs.

User Impact

User impact: several features now work on canonical keyed rosters (agents.entries), including multi-agent installs migrated by Doctor:

  • Feishu dynamic-agent creation no longer creates duplicate agents or ignores maxAgents, and no longer writes an agents.list that the next config load rejects.
  • TUI abort, sessions_send, and compaction preflight no longer fail with "Multiple agents are configured" when the agent is already known.
  • models.list without an agentId uses the configured system agent; run-session lookup honors the configured fixed session-store owner.
  • The Control UI Devices page now marks the configured system agent as the default agent in exec node bindings and lists it first in exec-approval scopes. Canonical rosters carry no default marker, so on main no agent was marked and scopes sorted alphabetically.
  • ACP session-metadata migration includes plugin-declared agents; Talk keeps configured agent wake names; per-agent model normalization and model-auth policy cleanup apply to agents.entries.

Plugin developers: OpenClawConfig (re-exported by the plugin SDK) no longer declares agents.list or AgentConfig.default. Plugins that read them must use cfg.agents.entries, or listAgentIds / resolveAgentConfig from openclaw/plugin-sdk/agent-runtime. Already-built plugins keep working: the deprecated, non-enumerable runtime agents.list projection stays until after 2027-01-02 (compatibility record agent-list-runtime-projection; see docs/plugins/sdk-migration/how-to-migrate.md#agent-roster-config). This source-incompatibility was accepted by the maintainer.

Upgrade and config compatibility: no stored-config change and no new migration. Config validation has rejected agents.list and agent default markers since #162612, and Doctor already rewrites stored rosters to agents.entries with explicit owners; this PR only makes the TypeScript type match that contract. Doctor and pre-admission migrations keep reading old files through the legacy type, so openclaw update and openclaw doctor behave as before on unmigrated installs. Raw SDK inputs that still carry a single default: true marker keep resolving that agent (including memory workspace inheritance).

Why This Change Was Made

The authored type is now the single gate: satisfies OpenClawConfig rejects both retired shapes, so fixtures and writers fail at compile time instead of at Gateway startup. Doctor and pre-admission migration code read old configs through the Doctor-owned OpenClawConfigWithLegacyRoster type (src/config/legacy.roster.ts), which stays structurally assignable to OpenClawConfig, so legacy inputs need no casts. Runtime code reads the roster only through its owners (listAgentEntries, resolveAgentEntry, resolveAgentConfig). Raw default: true marker compatibility for raw SDK inputs is unchanged, and so is the #162612 owner contract (no implicit default in a multi-agent roster).

About 1,075 test fixtures now author canonical agents.entries with the explicit owners Doctor materializes for upgraded installs (systemAgent, sessionStore, authInheritance, bindings); Doctor/migration tests keep legacy input typed as legacy.

Evidence

All suite runs on Blacksmith Testbox through scripts/crabbox-wrapper.mjs unless noted.

  • Typecheck: 36/36 lanes and shards pass with zero errors on the branch merged with main ca77256127e6 (tsgo:core, tsgo:extensions, tsgo:ui, tsgo:scripts, tsgo:extensions:test, the four root shards, packages, and all 27 core-test shards run individually, since tsgo:core:test / tsgo:test:root stop at the first failing shard). PR CI re-runs the typecheck lanes on the current head.

  • Tests: all 983 changed unit/integration test files (~10,000 tests) plus 36 e2e files on the pre-merge tree; Control UI e2e 14/14; core/QA-lab e2e includes the disk-written Gateway fixtures from fix(test): exec approval Gateway e2e fails at startup on its legacy agents.list fixture #163766 and fix(test): Gateway E2E shard 1/4 fails after the concise error copy and keyed agent roster changes #163623 (exec approval, dreaming startup cleanup, WhatsApp login authority). After each merge of main, every test file touched by the merge or its conflict resolution passed (105 unit/integration + 3 e2e for the first merge).

  • Regression tests (each fails on the pre-change code): Feishu lock-time duplicate/maxAgents against a cloned canonical draft; TUI cross-agent abort on a canonical multi-agent roster; models.list system-agent owner; per-agent model normalization on agents.entries without emitting agents.list; plugin-declared owners in ACP metadata migration; Talk agent/identity wake names on an entries-only roster; memory-host SDK workspace inheritance for a raw roster whose marked default agent is not first (restored after ClawSweeper flagged it; fails with the fix reverted).

  • Control UI, Devices page (mock Control UI, canonical roster main/ops/research with system agent ops; captures inspected, fixture data only):

    Before (main) After (this PR)
    Exec node binding Before: no agent is marked as default After: Ops is marked default agent
    Exec approvals scope Before: agents sorted alphabetically, no default badge After: Ops listed first with Default badge
  • Type contract: a fresh OpenClawConfig literal with agents.list, with an entry default, or via satisfies is a compile error; an OpenClawConfigWithLegacyRoster value passes where OpenClawConfig is expected without a cast.

  • Current head (690ce3c50689, merged with main 66cbf25fa624): conflicts resolved keeping main's consolidated tests with canonical fixtures; fixtures main added since the last merge converted; line-cap, assertion-safety, max-lines, Docker e2e boundary, and oxlint checks pass locally. Ratchet baselines changed only by exact shrinks where this branch removed casts. CI on 3ec784de9dd1 (run 37132997751) found one PR-caused failure, a split memory-core QMD test that lost its raw legacy-config type; it is fixed, and tsgo on test/tsconfig/tsconfig.extensions.test.json passes with zero errors on Testbox together with the memory-core and Doctor tests. CI on 9a4c1a26d58e (run 37135863141) failed only the inherited Feishu case below. The latest merge's one production conflict (src/infra/update-candidate-rehearsal.ts) keeps main's new startup-only migration behavior unchanged; the branch only types its raw config input as legacy.

  • Autoreview (Codex, P2): whole-branch review findings resolved (one verified false positive in a JSONC fixture, one restored zalouser legacy-list Doctor case); each later fix and merge resolution reviewed scoped-clean.

Known unrelated failures: tests that fail identically on the untouched base were left alone: state-database lifecycle cases (doctor auth/state-integrity, status summary, session listing/placement/sharing, session accessor, host-hook cleanup, startup-index and fleet preflight), the Tlon monitor, doctor-health-contributions, doctor-config-preflight.admission.process, three embedded-runner integration files, and published-driver-update (also red on main's scheduled runs). extensions/feishu/src/outbound-delivery.test.ts ("routes oversized presentation media…") fails the same way on clean main 2a5875d200f1: #164137 added openFile to outbound media access and the test still expects the old exact shape. It only runs in PR changed-extension lanes, and this PR touches none of its files.

New regression cases live in existing test files; no real timers, sleeps, per-test Gateway boots, or worker pins were added.

… the authored config type

The authored OpenClawConfig type still declared AgentsConfig.list and
AgentConfig.default after #162612 made config validation reject both, so
`satisfies OpenClawConfig` kept admitting fixtures and writers that Gateway
startup then refused (#163766, #163623). Production code also read the
untyped runtime agents.list projection, which structuredClone drops, so
config-mutation drafts and canonical configs silently saw an empty roster.

The authored type now rejects both shapes. Doctor and pre-admission
migration inputs use the Doctor-owned OpenClawConfigWithLegacyRoster type
(src/config/legacy.roster.ts), which stays structurally assignable to
OpenClawConfig, so legacy fixtures need no casts. Runtime readers use the
roster owners (listAgentEntries, resolveAgentEntry, resolveAgentConfig).
Raw default-marker compatibility for raw SDK inputs is unchanged.

The non-enumerable runtime agents.list projection is kept, untyped, for
plugins built against SDK releases through 2026.9.x and registered as the
deprecated compatibility record agent-list-runtime-projection (removal after
2027-01-02), documented in docs/plugins/sdk-migration/how-to-migrate.md.

Fixes found by the cutover:
- Feishu dynamic agents: lock-time duplicate and maxAgents checks saw an
  empty cloned roster and wrote an agents.list that validation rejects.
- TUI abort, sessions_send, harness compaction preflight, and run-session
  lookup resolved a default agent even when an explicit owner was known;
  models.list now uses the ambient owner like models.ts.
- ACP session-metadata migration ignored plugin-declared owners; Talk lost
  configured wake names; per-agent model normalization and model-auth policy
  cleanup skipped canonical agents.entries.

About 1,075 test fixtures now author canonical agents.entries with the
explicit per-surface owners Doctor materializes; Doctor/migration tests keep
legacy input typed as OpenClawConfigWithLegacyRoster.
Keep runtime fixtures canonical and preserve explicit per-call ownership. Pin the Doctor schema rehearsal session-store owner without restoring an implicit default. Remove file-transfer reload selectors for rejected list and default fields; canonical workspace paths continue to cover roster changes.
…on test

The legacy-list case had been converted to keyed entries, duplicating the keyed-roster case. Doctor state migrations receive raw pre-migration config, so restore the raw agents.list input under a plugin-local raw roster type.
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalouser Channel integration: zalouser app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb cli CLI command changes scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling channel: feishu Channel integration: feishu labels Oct 3, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 3, 2026
The QMD cases moved into doctor-contract-api.qmd.test.ts lost the raw pre-Doctor config type, so check-test-types rejected their agents.list fixture. Share RawLegacyDoctorConfig from the test support module and use it in both files.
…es warning

The warning reads agents through listAgentEntries, so it now labels configured workspaces as agents.entries.<id>.workspace instead of the retired agents.list path.
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 3, 2026
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer confirmation for the two remaining ClawSweeper checklist items on head 9a4c1a26d58e:

  • Config compatibility / upgrade impact: stored configs need no change and get no new migration. Config validation has rejected agents.list and agent default markers since refactor(config): move legacy agent roster reads into Doctor #162612, and Doctor already rewrites stored rosters to agents.entries with explicit owners. This PR narrows the TypeScript type to match. Doctor and pre-admission migrations keep reading old files through OpenClawConfigWithLegacyRoster, and their tests stay on the raw legacy shape. So openclaw doctor and openclaw update behave as before on unmigrated installs. Built plugins keep the deprecated runtime agents.list projection through 2027-01-02; the plugin-source break is an accepted maintainer decision.
  • Data-model proof: the persisted data model does not change. config/assertion-safety-baseline.txt is a lint ratchet baseline (exact shrinks where this branch removed casts), not stored data. No SQLite schema, state store, or config file format changes.

steipete added a commit that referenced this pull request Oct 3, 2026
Commit 42e9715 (#164137) made the core outbound media resolver
return a bounded native openFile alongside localRoots, readFile, and
workspaceDir. Feishu and iMessage forward the core-resolved access to
their senders unchanged, but their real-core delivery tests deep-compared
it against the caller-supplied object, so both failed deterministically.
These files only run in changed-extension PR lanes, so hourly main
stayed green (surfaced on PR #164103, run 37132997751).

Keep the comparison exact-shape and expect openFile as a function; the
identity checks on localRoots and readFile are unchanged. Sibling channel
tests that reach the core resolver (Discord, Slack, WhatsApp, Matrix,
MSTeams, Telegram, ClickClack, Feishu send authority) already pass.
@steipete
steipete merged commit 48d366f into main Oct 3, 2026
239 of 245 checks passed
@steipete
steipete deleted the steipete/nervous-sanderson-aec952 branch October 3, 2026 19:12
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
Commit 5c36f7f (openclaw#164137) made the core outbound media resolver
return a bounded native openFile alongside localRoots, readFile, and
workspaceDir. Feishu and iMessage forward the core-resolved access to
their senders unchanged, but their real-core delivery tests deep-compared
it against the caller-supplied object, so both failed deterministically.
These files only run in changed-extension PR lanes, so hourly main
stayed green (surfaced on PR openclaw#164103, run 37132997751).

Keep the comparison exact-shape and expect openFile as a function; the
identity checks on localRoots and readFile are unchanged. Sibling channel
tests that reach the core resolver (Discord, Slack, WhatsApp, Matrix,
MSTeams, Telegram, ClickClack, Feishu send authority) already pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
…hored config type (openclaw#164103)

* refactor(config): remove retired agents.list and default markers from the authored config type

The authored OpenClawConfig type still declared AgentsConfig.list and
AgentConfig.default after openclaw#162612 made config validation reject both, so
`satisfies OpenClawConfig` kept admitting fixtures and writers that Gateway
startup then refused (openclaw#163766, openclaw#163623). Production code also read the
untyped runtime agents.list projection, which structuredClone drops, so
config-mutation drafts and canonical configs silently saw an empty roster.

The authored type now rejects both shapes. Doctor and pre-admission
migration inputs use the Doctor-owned OpenClawConfigWithLegacyRoster type
(src/config/legacy.roster.ts), which stays structurally assignable to
OpenClawConfig, so legacy fixtures need no casts. Runtime readers use the
roster owners (listAgentEntries, resolveAgentEntry, resolveAgentConfig).
Raw default-marker compatibility for raw SDK inputs is unchanged.

The non-enumerable runtime agents.list projection is kept, untyped, for
plugins built against SDK releases through 2026.9.x and registered as the
deprecated compatibility record agent-list-runtime-projection (removal after
2027-01-02), documented in docs/plugins/sdk-migration/how-to-migrate.md.

Fixes found by the cutover:
- Feishu dynamic agents: lock-time duplicate and maxAgents checks saw an
  empty cloned roster and wrote an agents.list that validation rejects.
- TUI abort, sessions_send, harness compaction preflight, and run-session
  lookup resolved a default agent even when an explicit owner was known;
  models.list now uses the ambient owner like models.ts.
- ACP session-metadata migration ignored plugin-declared owners; Talk lost
  configured wake names; per-agent model normalization and model-auth policy
  cleanup skipped canonical agents.entries.

About 1,075 test fixtures now author canonical agents.entries with the
explicit per-surface owners Doctor materializes; Doctor/migration tests keep
legacy input typed as OpenClawConfigWithLegacyRoster.

* refactor: convert roster fixtures added on main to keyed agents.entries

Keep runtime fixtures canonical and preserve explicit per-call ownership. Pin the Doctor schema rehearsal session-store owner without restoring an implicit default. Remove file-transfer reload selectors for rejected list and default fields; canonical workspace paths continue to cover roster changes.

* test(zalouser): keep raw legacy-list coverage in Doctor state migration test

The legacy-list case had been converted to keyed entries, duplicating the keyed-roster case. Doctor state migrations receive raw pre-migration config, so restore the raw agents.list input under a plugin-local raw roster type.

* fix(memory-host-sdk): preserve raw default-marker workspace inheritance

Use the shared raw legacy default-marker reader before first-agent workspace inheritance. Preserve explicit ownership resolution and restore the marked secondary-agent regression with the legacy input type.

* refactor: split oversized files below their line-cap baselines

Extract Mistral cache-cost normalization, sessions-send input readers, and Feishu roster collection. Move session-repair and QMD migration coverage into protected sibling suites and consolidate existing test fixtures without dropping assertions.

* fix(ci): clear lint, Docker e2e boundary, and ratchet failures for the roster cutover

Keep the npm Telegram live runner on a local historical-config type instead of importing src, fix oxlint diagnostics in converted tests, move the agents.list runtime projection compat record into its own module, split branch-grown files back under their line-cap allowances, and shrink the assertion-safety baseline for casts this branch removed.

* test: canonicalize fixtures added during main merge

* test(memory-core): type split QMD Doctor fixture as raw legacy config

The QMD cases moved into doctor-contract-api.qmd.test.ts lost the raw pre-Doctor config type, so check-test-types rejected their agents.list fixture. Share RawLegacyDoctorConfig from the test support module and use it in both files.

* fix(doctor): name canonical agent workspace paths in removed-workspaces warning

The warning reads agents through listAgentEntries, so it now labels configured workspaces as agents.entries.<id>.workspace instead of the retired agents.list path.

* test: type preserved canary inputs as legacy rosters
steipete added a commit that referenced this pull request Oct 4, 2026
…thored config type (#165014)

* refactor(config): remove retired agents.defaults keys from the authored config type

AgentDefaultsConfig still declared nine keys that the strict agents.defaults
schema rejects (imageGenerationModel, videoGenerationModel,
musicGenerationModel, envelopeTimezone, envelopeTimestamp, envelopeElapsed,
timeFormat, promptOverlays, agentRuntime), so `satisfies OpenClawConfig`
admitted fixtures and writers that validation refuses. This is the same trap
the agents.list/default (#164103) and per-agent agentRuntime/compaction
(#164586) cutovers closed.

The authored type now omits all nine. The Doctor-owned
OpenClawConfigWithLegacyRoster in src/config/legacy.roster.ts carries them as
retired defaults fields, each naming what Doctor does and the canonical owner.
It stays structurally assignable to OpenClawConfig, so Doctor and
pre-admission fixtures need no casts.

Readers:
- The system-agent inference route no longer snapshots a defaults-level
  agentRuntime; per-model policy already travels in the projected model map.
- current-time drops an unused timeFormat field from its local config shape.
- The private retired whole-agent runtime opt-out in openai-routing keeps
  reading agents.defaults.agentRuntime through the legacy type for
  pre-admission plugin repair.
- The WhatsApp test envelope mock honored the retired envelope toggles; it
  now mirrors resolveEnvelopeFormatOptions (timezone from userTimezone,
  timestamps and elapsed time always on).
- The test-only shim that translated legacy media keys is removed; the
  image, video, and music tool tests author agents.defaults.mediaModels.

Fixtures move to canonical owners: mediaModels.{image,video,music},
userTimezone instead of envelope/time-format toggles, and per-model
models[ref].agentRuntime. Runtime-selection tests now configure the per-model
runtime they exercise instead of an inert defaults key. Doctor and migration
tests keep raw legacy inputs typed as OpenClawConfigWithLegacyRoster; media
model migration coverage moves to legacy-config-migrate.media-models.test.ts
and two test helpers move to support modules to stay under line caps.
dead-config-keys now also asserts that validation rejects
agents.defaults.agentRuntime, so all nine keys have runtime rejection
coverage.

Plugin SDK impact: type-only. OpenClawConfig agents.defaults loses the nine
keys; no bundled plugin reads them and validated configs never hold them.
plugin-sdk:api:diff confirms legacy.roster stays outside the public
declaration closure. docs/plugins/sdk-migration/how-to-migrate.md names the
canonical owners.

* docs(plugins): route stored agents.defaults.agentRuntime through the intermediate upgrade

Doctor refuses a stored agents.defaults.agentRuntime as a retired format
(findRetiredConfigUpgradeRequirement), so the blanket doctor --fix guidance
in the SDK migration paragraph did not hold for that key. Point it at the
existing upgrade-through-2026.9.5 instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: a2a channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalouser Channel integration: zalouser cli CLI command changes commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: active-memory extensions: anthropic extensions: clickclack extensions: codex extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: memory-wiki extensions: oc-path extensions: ollama extensions: openai extensions: policy extensions: qa-lab extensions: xai gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: facetime FaceTime plugin plugin: file-transfer plugin: google-meet plugin: migrate-claude plugin: migrate-hermes plugin: workboard proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts security-sensitive-changed size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant