Skip to content

refactor(config): deslop config third pass - #159054

Merged
steipete merged 1 commit into
mainfrom
deslop/l83-config3
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/l83-config3

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The third config cleanup pass removes remaining duplicate projections, schema/type declarations, and forwarding code across config and session storage.

Related: #157146, #158295. This is a maintainer-requested subsystem sweep following those passes.

User Impact

No intended user-visible change. Config acceptance, rejection messages, keys, public exports, secret redaction and resolution, Doctor migration order, config/include writes, environment substitution, audit records, session authority, transactions, and retention keep their existing contracts. No new migration or operator action is needed.

Why This Change Was Made

The production sweep read the whole config subtree, largest files first. The resulting diff removes 1,264 net production lines (+1,215/-2,479); tests and schema baselines are unchanged.

  • Schema builders reuse the canonical channel-account shape, identical nested tool/image schemas, agent-runtime policy, and configuration types. Allowed-value diagnostics derive completeness directly from the collected values.
  • Plugin auto-enable shares its cache-miss execution path and eliminates repeated channel resolution, one-use signal adapters, and paired web-provider projection logic. MCP aliases retain their ordered migration through one descriptor list.
  • Config environment publication shares normalized-value indexing and compare-and-swap rollback. Active and escaped authored templates share their same-index structural identity predicate. Config loading drops duplicate value aliases.
  • Validation diagnostics keep source-location and secret-omission decisions at their only renderer; Talk and port normalization reuse their existing value contracts. The live secret-omission predicates are unchanged. The removed string-path fallback was unreachable: the only caller supplies nonempty structured path segments. A differential renderer probe and existing plugin/channel/SecretRef tests cover that removal.
  • Session worker readers share request sizing, reply discrimination, and result projection while retaining specialized streaming and admission paths.
  • Session discovery shares traversal between live-store and recovery-candidate selection, retaining their different containment and existence rules. Canonical key validation returns its metadata directly.
  • Session entry, delivery, recovery, and Goal updates share repeated field projection and persistence logic. Public forwarding aliases remain exported from their implementation owners.
  • SQLite entry/archive/transcript owners share identical queries and result handling, remove unnecessary mutable transaction result carriers, and reuse canonical writer-scope and paging normalization helpers. Existing SQL, commit ordering, cleanup settlement, and authority checks are preserved.
  • Maintenance shares removal accounting and divergence reporting, and retains one representative index per connected removal group instead of arrays used only for their first element.

Fixes Found Along the Way

No independent product defect has been confirmed during the sweep.

Evidence

Current head d7ec402c6a4668cb35eb62a8836b534fc3fa47ba is green in hosted CI, including openclaw/ci-gate, Linux/Windows selections, types, lint, build, and guards.

Remote validation passed on Blacksmith Testbox tbx_01m3ffjdj9b4v3x9yjqpjb3vqs (runner). The wrapper's transport commit was e23e36ab6ad2deda468076a11ff6be8c928ddcb4; the validation shell asserted its physical checkout and exact source tree 9da97dfeb5c539bdea927f0ad0c3bd40af2cdea0, matching the PR head, before installing frozen dependencies and running any gate. The complete command and both Docker lanes exited 0; Docker cleanup joined.

  • node scripts/check-changed.mjs --base df50212501d139a38d264f15f2a62b4a2ca501f8 --head HEAD: passed, including core types, all 25 core test-type shards, dead-export scanning, lint with zero warnings/errors, channel metadata, config documentation baselines, and structural guards.
  • Focused run-vitest selection: src/plugin-sdk/api-baseline.test.ts, test/scripts/native-declaration-boundary.test.ts, src/config/issue-location.test.ts, src/config/schema.test.ts, src/config/env-preserve.test.ts, src/config/config.env-vars.test.ts, and src/config/sessions/session-accessor.sqlite-mutation-worker.runtime.test.ts. Passed 288 tests across seven files/three shards in 41.32s, with three existing platform-specific skips.
  • node scripts/run-vitest.mjs src/config src/plugin-sdk/channel-policy.test.ts packages/gateway-protocol/src/talk-config.contract.test.ts src/commands/doctor/shared/legacy-config-migrate.test.ts src/commands/doctor/shared/legacy-config-migrate.e2e.test.ts: all five shards passed in 1,231.38s including runtime preparation. Runtime-config passed 6,476 tests across 473 files in 747.10s, with six existing skips; the other shards passed 288 tests, including 17 Doctor migration E2E tests.
  • 108 diagnostic-redaction differential cases matched the original renderer, covering channel/plugin paths, dotted plugin IDs, sensitive keys, SecretRefs, objects, structured path metadata, and positive disclosure controls. This proof remains valid across the rebase: both the baseline and candidate renderer blobs are identical to those tested.
  • pnpm build: passed in 6m 17.8s, including all 158 public plugin SDK subpaths. node scripts/package-openclaw-for-docker.mjs --skip-build --allow-unreleased-changelog produced the candidate tarball and passed package integrity checks.
  • node scripts/test-docker-all.mjs with OPENCLAW_DOCKER_ALL_LANES='published-upgrade-survivor npm-onboard-channel-agent' passed both lanes on their first attempt: published updater in 317s and clean onboarding in 103s.

The published-updater cell used [email protected] → candidate 2026.9.6, scenario base, and manual restart. Its inspected receipt records candidateInstallMode=updater, updateOutcome=success, and updateRecovery=null; installed package identity, automatic migration before standalone Doctor, post-Doctor config validation, config/session-state survival, and Gateway health/readiness/status all passed. Startup took 27s; the three probes took 1s each. Env-backed SecretRefs are covered by this fixture; $include and ${VAR} preservation are covered by the config tests rather than this updater cell.

The clean-install lane starts from an asserted empty home, installs the candidate npm tarball with its matching companion package, performs noninteractive onboarding using SecretRefs, checks channel/config/status surfaces, runs Doctor and a mocked model turn, and proves installed Gateway startup/restart with persisted execution identity. This is packaged CLI/Gateway proof with synthetic credentials, not a live channel or model-service claim. Together, these results address the automated review's outstanding first-install and current-head existing-state compatibility requests. No stored format or migration contract changes in this PR.

This PR changes no tests, config schema snapshots, or validation baselines. The assertion-safety baseline only shrinks to match removed assertions. Earlier validation attempts lost SSH transport; the completed run used heartbeat/log supervision. An attempted local fallback was stopped because of host load. The first hosted run exposed an unrelated SDK fixture whose diagnostic-method spy had become stale after main moved validation into emission. The branch was rebased onto main's repair 2b2ae319c923751bc9621af6942867ccf4f3302e (also tracked in #159085), preserving the patch, and current-head validation above passed.

Independent review disposition

Codex autoreview completed at P2 scope. Its four findings were checked against the full source and rejected; none is an accepted/actionable finding:

  • restart-recovery-receipt.ts: both hasActiveClaim and hasClaimlessLiveDeliveryState already require entry.sessionId === scope.sessionId. The removed caller comparisons duplicated these unchanged fences.
  • session-accessor.sqlite-maintenance-store.ts: applySessionEntryMaintenanceInDatabase returns an empty plan for maintenance.mode === "warn" before its sole call to the private canSkipSessionEntryMaintenanceInDatabase helper. Warn-only mode still cannot reach enforcement.
  • store-maintenance-operations.ts: applyEnforcedMaintenance creates a new local map, and its only setter writes undefined. The planner callback finishes before the map reaches cleanup; no concrete transcript path can be overwritten by that setter.
  • session-accessor.types.ts: SessionTranscriptAccessScope explicitly retains sessionFile?: string, so intersecting it with the required sessionKey preserves the deprecated locator. All core test-type shards, including public SDK callers, passed.

@clawsweeper

clawsweeper Bot commented Sep 26, 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 September 26, 2026 17:25
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 26, 2026, 2:49 PM ET / 18:49 UTC (Revision 3).

ClawSweeper review

What this changes

The branch consolidates duplicated configuration validation, plugin activation, and session storage logic while aiming to preserve existing behavior.

Merge readiness

⛔ Blocked before merge - 5 items remain

This is a distinct third cleanup pass; the two related passes are merged, but current main still has the code this branch consolidates. I found no definite introduced defect. The captured PR evidence still leaves fresh setup and current-head upgrade compatibility unverified.

Priority: P3
Reviewed head: d7ec402c6a4668cb35eb62a8836b534fc3fa47ba

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The cleanup appears coherent and current-head CI is green, but installation and existing-state compatibility evidence has not caught up with the rebased head.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The supplied member-author classification exempts ordinary contributor proof. The PR body reports an earlier-head published-updater run, but still describes current-head validation as pending; the changed session migration path therefore lacks verified current-head existing-state compatibility, and no clean-install observation is reported.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied member-author classification exempts ordinary contributor proof. The PR body reports an earlier-head published-updater run, but still describes current-head validation as pending; the changed session migration path therefore lacks verified current-head existing-state compatibility, and no clean-install observation is reported.
Evidence reviewed 10 items Distinct work on current main: Current main still has separate configuration-loader aliases and separate session-migration divergence branches that this PR consolidates.
Configuration path: The PR head still hashes authored config input and validates the migrated effective configuration for both synchronous and asynchronous loading.
Plugin activation path: The refactored cache still checks discovery, registry, and environment-trigger fingerprints before returning a cached plugin activation result.
Findings None None.
Security None None.

How this fits together

OpenClaw loads operator configuration to validate settings and select plugins before the Gateway starts. The Gateway then reads and writes session state for conversations, history, recovery, and cleanup.

flowchart LR
A[Operator configuration] --> B[Load and validate]
B --> C[Plugin selection]
B --> D[Gateway]
D --> E[Session reads and writes]
E --> F[SQLite session state]
F --> G[History and recovery]
Loading

Before merge

  • Resolve merge risk (P1) - No completed clean installation through config validation and first Gateway start is recorded for this head, leaving initial defaults and plugin activation unverified.
  • Resolve merge risk (P1) - The published-updater and session-survival result in the PR body applies to an earlier head; current-head compatibility with existing operator state has not yet been established.
  • Complete next step (P2) - Record current-head clean setup through first Gateway start and a published-updater check of existing config and session survival, then update the PR evidence.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Installed-path coverage 1 reported earlier-head upgrade scenario; 0 reported current-head clean-install scenarios The changed defaults and migration paths need observations from both new and existing installations.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/config/sessions/legacy-main-session-migration.ts, unknown-data-model-change: src/config/sessions/legacy-main-session-migration.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify both installation paths (recommended)
    Record a clean candidate setup and a published-updater run on this head that checks config, Gateway readiness, and retained sessions.
  2. Defer the sweep
    Pause this broad refactor if representative existing-state and first-start compatibility cannot be established.

Technical review

Best possible solution:

Keep the consolidated owners only after fresh setup and an existing-state upgrade confirm preserved defaults, plugin activation, migration outcomes, and session history.

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

Not applicable: this refactor reports no independent product defect; review turns on preserving existing behavior.

Is this the best way to solve the issue?

Yes, provisionally: the inspected changes reuse existing owners and reveal no definite defect, while installation-path compatibility still needs confirmation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 910145c4195d.

Labels

Label changes:

  • add merge-risk: 🚨 session-state: Session migration, transcript, and retention owners change without current-head installed-state survival evidence.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P3: This is an internal cleanup with no confirmed independent product defect.
  • merge-risk: 🚨 compatibility: The branch changes config loading and plugin activation while current-head first-install and upgrade behavior remain unreported.
  • merge-risk: 🚨 session-state: Session migration, transcript, and retention owners change without current-head installed-state survival evidence.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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 supplied member-author classification exempts ordinary contributor proof. The PR body reports an earlier-head published-updater run, but still describes current-head validation as pending; the changed session migration path therefore lacks verified current-head existing-state compatibility, and no clean-install observation is reported.

Evidence

What I checked:

  • Distinct work on current main: Current main still has separate configuration-loader aliases and separate session-migration divergence branches that this PR consolidates. (src/config/io.load.ts:178, 910145c4195d)
  • Configuration path: The PR head still hashes authored config input and validates the migrated effective configuration for both synchronous and asynchronous loading. (src/config/io.load.ts:178, d7ec402c6a46)
  • Plugin activation path: The refactored cache still checks discovery, registry, and environment-trigger fingerprints before returning a cached plugin activation result. (src/config/plugin-auto-enable.apply.ts:143, d7ec402c6a46)
  • Persisted-session migration: The introduced migration hunk combines the existing divergent-canonical and divergent-alias branches while retaining their outcome kinds and repair call. This path rewrites existing session state, so upgrade compatibility remains relevant. (src/config/sessions/legacy-main-session-migration.ts:530, d7ec402c6a46)
  • Session write authority: The changed append guard delegates to the existing current-scope predicate, which compares session ID, lifecycle revision, and writer run ID before a fenced write. (src/config/sessions/session-accessor.sqlite-transcript-write-guard.ts:63, d7ec402c6a46)
  • Prior review and current proof: The previous completed review recorded no findings and requested a clean candidate setup and first Gateway start. The captured and live PR body still calls the new-head validation provisional and reports an earlier-head published-updater scenario, with no completed clean-install result. (d7ec402c6a46)

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record clean setup and first Gateway start on this head, plus a published-updater check that existing config and sessions survive.

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-09-26T17:24:52.158Z sha 985be77 :: blocked before merge. :: none
  • reviewed 2026-09-26T17:32:24.636Z sha 985be77 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 Sep 26, 2026
@steipete
steipete merged commit aec71ea into main Sep 26, 2026
242 checks passed
@steipete
steipete deleted the deslop/l83-config3 branch September 26, 2026 20:21
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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