Skip to content

refactor(config): retire Doctor-only agents.defaults keys from the authored config type - #165014

Merged
steipete merged 2 commits into
mainfrom
steipete/agent-defaults-legacy-keys
Oct 4, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/agent-defaults-legacy-keys

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Related: #164103, #164586

What Problem This Solves

The authored agents.defaults config type still declared nine keys that config validation rejects, so typed fixtures and config writers could author defaults that Gateway startup then refuses.

User Impact

No user-visible change. Developers and plugin authors now get a type error instead of a startup rejection when they put imageGenerationModel, videoGenerationModel, musicGenerationModel, envelopeTimezone, envelopeTimestamp, envelopeElapsed, timeFormat, promptOverlays, or agentRuntime on agents.defaults. Stored configs keep their existing handling: openclaw doctor --fix migrates or removes eight of the keys, while a stored agents.defaults.agentRuntime remains a retired format that Doctor refuses, so those installs still upgrade through OpenClaw 2026.9.5 first (the SDK migration guide now says so). Type-only Plugin SDK change, documented in the SDK migration guide.

Why This Change Was Made

Third step of the cutover from #164103 and #164586. The authored type drops the nine keys; Doctor and pre-admission readers use the existing Doctor-owned legacy config type (OpenClawConfigWithLegacyRoster), which now also carries retired defaults fields and stays structurally assignable to OpenClawConfig, so legacy fixtures need no casts. Runtime readers and fixtures move to the canonical owners: agents.defaults.mediaModels.{image,video,music}, userTimezone with built-in envelope and time formatting, plugins.entries.openai.config.personality, and per-model models[ref].agentRuntime.

Readers, fixtures, and SDK impact
  • The system-agent inference route stops snapshotting 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 (fix(openai): harden codex catalog, routing opt-out, and WHAM half-open reprobe #108683) keeps reading agents.defaults.agentRuntime through the legacy type for pre-admission plugin repair; it stays outside SDK-reachable modules.
  • The WhatsApp test envelope mock honored the retired envelope toggles while the product resolver ignores them; it now mirrors resolveEnvelopeFormatOptions. A test-only shim that translated legacy media keys is deleted; the image, video, and music tool tests author mediaModels directly.
  • Runtime-selection fixtures that set an inert defaults-level agentRuntime now configure the per-model runtime they exercise. Doctor and migration tests keep raw legacy inputs typed as OpenClawConfigWithLegacyRoster; media-model migration cases move verbatim into legacy-config-migrate.media-models.test.ts and two test helpers move into 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: OpenClawConfig["agents"]["defaults"] loses the nine keys. No bundled plugin reads them outside test fixtures and validated configs never held a value, so no compatibility record is added.

Evidence

Blacksmith Testbox. The full proof ran on the pre-rebase head (same patch on 1660c032); rebasing onto current main changed only two Telegram test fixtures (main had consolidated those tests), proven separately below.

Lane (pre-rebase head 93871b33) Result
tsgo:core, tsgo:ui, tsgo:extensions, tsgo:extensions:test, tsgo:scripts pass
All 34 test/tsconfig shard projects behind tsgo:test:{src,packages,ui,root}, each run individually pass (34/34)
lint, check:assertion-safety, check:line-cap-ratchet, check:max-lines-ratchet, format:check, git diff --check pass
Vitest: every changed test file plus every test importing a changed helper (45 files) 1,582 passed, 2 failed; the 2 were a header assertion added during the migration, removed, then 2/2 after the fix
plugin-sdk:api:diff AgentDefaultsConfig loses exactly the nine keys; legacy.roster is not reachable from public declarations
Codex autoreview (P1) scoped-clean

Rebased head 68e34abc, conflict-delta lane (lease tbx_01m43wrrms6vnax5ftp42skjw6): tsgo:core, tsgo:ui, tsgo:extensions, tsgo:extensions:test, and format pass; Telegram suites 65/65 and 71/71; dead-config-keys 218/218.

No product-code behavior change; one runtime rejection case added (agents.defaults.agentRuntime in dead-config-keys).

…ed 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.
@clawsweeper

clawsweeper Bot commented Oct 4, 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.

@steipete
steipete marked this pull request as ready for review October 4, 2026 16:42
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: line Channel integration: line channel: mattermost Channel integration: mattermost channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web extensions: memory-core Extension: memory-core commands Command implementations agents Agent runtime and tooling extensions: anthropic size: XL labels Oct 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 1:13 PM ET / 17:13 UTC (Revision 3).

ClawSweeper review

What this changes

Remove nine retired agent-default fields from the public configuration type, retain them in Doctor’s legacy-input type, and update fixtures and SDK migration guidance.

Merge readiness

⛔ Blocked before merge - 1 item remains

The prior upgrade-guidance finding is resolved, and no blocking patch defect remains. Current main still exposes the nine rejected fields, so this cleanup remains useful.

Priority: P2
Reviewed head: b77cccd692fced2fcdf812a794deb5f7bc665a0f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused contract cleanup with substantial reported validation and the prior documentation finding resolved.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author is exempt from ordinary contributor runtime proof. The changed types and dead projections do not alter an authority boundary or stored-data contract; reported Testbox checks supplement source review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author is exempt from ordinary contributor runtime proof. The changed types and dead projections do not alter an authority boundary or stored-data contract; reported Testbox checks supplement source review.
Evidence reviewed 8 items Introduced change: The pinned merge-base-to-head patch removes the nine public type fields and moves their declarations into the existing legacy-input type. Schema, migration, update-driver, dependency, and workflow implementations are unchanged.
Current-main necessity: Fetched main still declares all nine Doctor-only fields in AgentDefaultsConfig. The merged roster and per-agent cleanups cover adjacent contracts rather than this defaults-level contraction.
Existing runtime contract: The defaults schema is strict and already omits the retired fields. The existing unknown-key validation table covers eight; this patch adds the missing defaults-level agentRuntime case without changing validation.
Findings None None.
Security None None.

How this fits together

OpenClaw’s configuration types guide developers and plugin authors, while schema validation admits configuration into the runtime. Doctor separately handles stored legacy inputs before they reach that boundary.

flowchart TD
  A[Authored configuration] --> B[Public configuration type]
  B --> C[Strict schema validation]
  C --> D[Agent runtime]
  E[Stored legacy configuration] --> F[Doctor legacy input]
  F --> G[Repair or intermediate upgrade]
  G --> C
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
Agent review details

Security

None.

PR surface

Source -3, Tests -97, Docs +10. Total -90 across 42 files.

View PR surface stats
Area Files Added Removed Net
Source 4 27 30 -3
Tests 37 435 532 -97
Docs 1 10 0 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 42 472 562 -90

Review metrics

Metric Value Why it matters
Public configuration contract 9 retired fields removed; 0 runtime configuration options added Plugin source using these rejected fields must adopt the documented canonical owners.

Technical review

Best possible solution:

Keep authored configuration aligned with the strict schema while preserving legacy reads exclusively at Doctor and pre-admission boundaries.

Do we have a high-confidence way to reproduce the issue?

Not applicable to runtime bug reproduction: source confirms that current main’s authored type admits nine fields its strict schema rejects.

Is this the best way to solve the issue?

Yes. Moving rejected fields into the existing legacy-input owner aligns the public type with validation without adding runtime compatibility readers or changing stored-config repair.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e9edda349fae.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This fixes a bounded developer-facing mismatch between authored types and runtime validation.
  • merge-risk: 🚨 compatibility: The documented public type contraction can require plugin source updates; the current compatibility tradeoff is explicitly acknowledged by a verified repository admin.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified repository-admin author is exempt from ordinary contributor runtime proof. The changed types and dead projections do not alter an authority boundary or stored-data contract; reported Testbox checks supplement source review.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-04T16:48:38.896Z sha 68e34ab :: blocked before merge. :: [P3] [P3] Distinguish the runtime key's intermediate-upgrade requirement
  • reviewed 2026-10-04T16:57:29.245Z sha 68e34ab :: blocked before merge. :: [P3] [P3] Distinguish the runtime key's intermediate-upgrade requirement

…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.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Config compatibility review for this PR:

  • Stored configs: no change in handling. Validation already rejected all nine keys before this PR (the agents.defaults schema is strict, and dead-config-keys asserts each rejection; this PR adds the missing agentRuntime case). Doctor's existing migrations for the eight migratable keys are untouched. A stored agents.defaults.agentRuntime remains a retired format Doctor refuses with the existing upgrade-through-2026.9.5 guidance; b77cccd fixes the SDK guide and PR body to say so (ClawSweeper's P3).
  • Updates: no Doctor, migration, or update-driver code changes, so openclaw update behaves the same. The private pre-admission runtime opt-out reader in openai-routing still reads the legacy key through the Doctor-owned legacy type.
  • Runtime: validated configs could never hold these keys. The only production change drops an always-undefined agentRuntime snapshot from the system-agent inference projection.
  • Plugin SDK: type-only source contraction of OpenClawConfig["agents"]["defaults"], documented in the SDK migration guide. No bundled plugin reads these keys. plugin-sdk:api:diff shows only AgentDefaultsConfig losing the nine keys, and the Doctor-owned legacy.roster types stay outside public declarations. No runtime compatibility record is needed because no value was ever observable at runtime.

@steipete
steipete merged commit 3aec983 into main Oct 4, 2026
131 of 137 checks passed
@steipete
steipete deleted the steipete/agent-defaults-legacy-keys branch October 4, 2026 17:51
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

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

@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Inherited CI failure retained for this admin landing: run 37219328423, job 111486461813 failed ui/src/e2e/worker-initial-setup.real-gateway.e2e.test.ts > Initial setup custody with a real Gateway > holds browser and sessions_send input during sync, then launches each exactly once.

The inspected log shows expected 1 to be 2 at the launched.length poll on line 323; it does not reach the following new Set(launched).size assertion. The identical test and assertion fail on unrelated PR runs 37218912405, job 111485328044 (dbasync/compound3b) and 37216567580, job 111478400444 (codex/literal-ignore-directories).

This PR cannot introduce that pending-input launch failure: the test, Gateway/worker code, session and pending-input storage, sessions_send entry point, and queue drain are unchanged between CI's main parent e9edda349faee43c13244cf3f4547fcbcb9c37fe and tested merge 16e686bba106c1b3c2aa93ff4d91b1dda52521f7. Its production edits are type declarations, an unused local type field, a comment, and removal of an always-undefined legacy defaults projection; the failing fixture already uses canonical per-model runtime policy. The CI gate failure is downstream of the one failed shard, and no jobs were cancelled.

All four required scoped guards passed on exact head b77cccd692fced2fcdf812a794deb5f7bc665a0f in Blacksmith Testbox proof 37221079677: CI test planning 8/8, eager-import closure 17/17, PR-wrapper source closure 3/3, and export-name collisions. Each Vitest invocation ended with the wrapper's [test] passed line; the overall wrapper exited 0. The inherited CI run was not retriggered, and no current-head CI success is claimed.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…thored config type (openclaw#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 (openclaw#164103) and per-agent agentRuntime/compaction
(openclaw#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 channel: line Channel integration: line channel: mattermost Channel integration: mattermost channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web commands Command implementations docs Improvements or additions to documentation extensions: anthropic extensions: memory-core Extension: memory-core merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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