Repository navigation
refactor(config): retire Doctor-only agents.defaults keys from the authored config type - #165014
Conversation
…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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed October 4, 2026, 1:13 PM ET / 17:13 UTC (Revision 3). ClawSweeper reviewWhat this changesRemove 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 Review scores
Verification
How this fits togetherOpenClaw’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
Before merge
Agent review detailsSecurityNone. PR surfaceSource -3, Tests -97, Docs +10. Total -90 across 42 files. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
…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.
|
Config compatibility review for this PR:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
|
Inherited CI failure retained for this admin landing: run 37219328423, job 111486461813 failed The inspected log shows This PR cannot introduce that pending-input launch failure: the test, Gateway/worker code, session and pending-input storage, All four required scoped guards passed on exact head |
…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.
Related: #164103, #164586
What Problem This Solves
The authored
agents.defaultsconfig 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, oragentRuntimeonagents.defaults. Stored configs keep their existing handling:openclaw doctor --fixmigrates or removes eight of the keys, while a storedagents.defaults.agentRuntimeremains 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 toOpenClawConfig, so legacy fixtures need no casts. Runtime readers and fixtures move to the canonical owners:agents.defaults.mediaModels.{image,video,music},userTimezonewith built-in envelope and time formatting,plugins.entries.openai.config.personality, and per-modelmodels[ref].agentRuntime.Readers, fixtures, and SDK impact
agentRuntime; per-model policy already travels in the projected model map.current-timedrops an unusedtimeFormatfield from its local config shape.openai-routing(fix(openai): harden codex catalog, routing opt-out, and WHAM half-open reprobe #108683) keeps readingagents.defaults.agentRuntimethrough the legacy type for pre-admission plugin repair; it stays outside SDK-reachable modules.resolveEnvelopeFormatOptions. A test-only shim that translated legacy media keys is deleted; the image, video, and music tool tests authormediaModelsdirectly.agentRuntimenow configure the per-model runtime they exercise. Doctor and migration tests keep raw legacy inputs typed asOpenClawConfigWithLegacyRoster; media-model migration cases move verbatim intolegacy-config-migrate.media-models.test.tsand two test helpers move into support modules to stay under line caps.dead-config-keysnow also asserts that validation rejectsagents.defaults.agentRuntime, so all nine keys have runtime rejection coverage.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.93871b33)tsgo:core,tsgo:ui,tsgo:extensions,tsgo:extensions:test,tsgo:scriptstest/tsconfigshard projects behindtsgo:test:{src,packages,ui,root}, each run individuallylint,check:assertion-safety,check:line-cap-ratchet,check:max-lines-ratchet,format:check,git diff --checkplugin-sdk:api:diffAgentDefaultsConfigloses exactly the nine keys;legacy.rosteris not reachable from public declarationsRebased head
68e34abc, conflict-delta lane (leasetbx_01m43wrrms6vnax5ftp42skjw6):tsgo:core,tsgo:ui,tsgo:extensions,tsgo:extensions:test, and format pass; Telegram suites 65/65 and 71/71;dead-config-keys218/218.No product-code behavior change; one runtime rejection case added (
agents.defaults.agentRuntimeindead-config-keys).