Repository navigation
refactor(config): deslop config fifth pass - #161076
Conversation
|
🦞👀 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 September 29, 2026, 5:22 AM ET / 09:22 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch consolidates config environment publication, config reads and writes, session transcript and maintenance code, and related metadata, while updating a timezone test fixture. Merge readiness⛔ Blocked before merge - 4 items remain This cleanup remains distinct from the merged fourth pass and is absent from current main. I found no concrete introduced defect, but the required published-updater check against existing config and session state is still unrecorded. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw loads authored configuration into runtime settings and environment variables, then writes changes with rollback protection. Session migration, maintenance, and transcript readers consume the resulting state. flowchart LR
A[Config file] --> B[Config loading]
B --> C[Runtime environment]
B --> D[Config writes and rollback]
D --> E[Session state]
E --> F[Transcript reader]
F --> G[Gateway responses]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -482, Tests +25, Other -3. Total -460 across 44 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one owner for config publication, write recovery, and session reads while verifying that an upgrade preserves existing operator state and rollback behavior. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR reports no product defect. Its new rollback tests exercise a specific invariant, while the existing-state upgrade path has not been shown. Is this the best way to solve the issue? Yes, the consolidation follows existing config and session owners without adding a public capability; upgrade evidence is still needed before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9c1b41731c1e. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
* refactor(config): deslop config fifth pass * refactor(config): share current-entry worker dispatch * chore(config): shrink removed assertion allowances * test(config): bootstrap timezone subprocess source imports * refactor(config): avoid dispatch callback shadowing
Related: #159588
What Problem This Solves
The fifth config cleanup pass removes repeated orchestration and brings
src/config/config-env-vars.tsfrom 757 to 698 lines, below the 700-line limit, through consolidation inside its existing owner.User Impact
No intended user-visible change. Config schemas and generated snapshots, defaults, environment names/precedence/preservation, Doctor-owned migrations, redaction, and persisted-state contracts remain unchanged. Reserved
src/config/sessions/session-accessor*files are untouched.Why This Change Was Made
Measured production diff: 731 additions / 1,213 deletions, 482 net lines removed. Test diff: 26 additions / 1 deletion. The assertion-safety baseline shrinks three allowances to their measured counts (one reduced, two removed); the max-lines baseline only drops the now-unused disk-budget exception; config-env-vars is never added. This is below the 1,000-line target after completing the file-by-file sweep; the coverage log below records every eligible production file over 200 lines. Recent config changes since September 18, including the fourth-pass name-only diff, were reviewed before editing.
Fixes Found Along the Way
The explicit line-limit target is resolved without a new sibling file or baseline exception. The existing timezone subprocess fixture now preloads the canonical source runtime so the shared normalization import resolves; its eight DST inputs, assertions, and timeout are unchanged. No additional product bug fix is claimed.
Evidence
Landed by the maintainer-authorized pre-existing-failure exception: exact reviewed head
8a0bd340769de1dd29a90e0e1dcdfde3ecd3ccd2was squash-merged asf5e5f75f2b775adef5fd87f5cd5d5017fe2d086b. Verified ancestry onorigin/mainand reconstructed merge-tree equality. Failed/cancelled hosted CI remains explicitly recorded below; no CI rerun or budget increase was used. All task-owned Testbox leases are stopped.Hosted CI on exact head
8a0bd340769de1dd29a90e0e1dcdfde3ecd3ccd2has one independently reproduced root failure:checks-node-compact-small-3, run 36540677740. The two failures intest/scripts/plugin-sdk-surface-report.test.tsarekeeps default public surface budgets pinned to current source countsandrejects callable surface growth from the canonical source graph: actual public SDK exports/callables are 4,594/2,698 against unchanged budgets of 4,591/2,695. The same two tests and exact counts fail on the current unrelated PR run 36537630985, at head7fa68ac79a1133adb2796998719a2f84b9cf6f7c. This config patch changes no SDK entrypoints, report/budget implementation, package exports, or public SDK export names. Its new internal config helpers have no public SDK re-export route. The three inherited additions areloadAgentHarnessMcpConfig,decodeHeaderEnvPlaceholder, andresolveConfiguredMcpTransport, exported bysrc/plugin-sdk/agent-harness-runtime.tsin commitb4ae783fbfd2d50307ef9af357ed944120a1824d(#160931), without updating the 4,591/2,695 budgets. Neither that facade nor its export owners are changed here. The aggregate CI gate failure and sibling cancellations are fail-fast consequences, not passing CI.ClawSweeper completed its exact-head review with no introduced code or security finding. Its requested published-updater compatibility proof now passes through the existing synthetic-state upgrade-survivor harness. Fresh-install defaults are already covered by the passing
io.best-effort.test.tsmissing-config case andio.load-async.test.tsmissing-config parity case (4 ms and 3 ms respectively) in the full config run. The migration ledger edit shares identical insert/upsert values; columns, transaction ownership, conflict keys, stored report bytes, and migration triggers are unchanged. Existing passing mutation tests exercise runtime-refresh rollback through root/include writers and preserve concurrent include edits;legacy-main-session-migration.ledger.test.tscovers ledger completion, rearming, and Doctor rescanning. These fault-path checks complement the published updater/backup-restore scenario rather than being described as the same proof.All required Testbox proof is complete. Final changed-file checks and focused worker proof used source tree
d0fd89afd1c8a21f32c5facf8a691940577845e1, matching the final commit tree. Provider:blacksmith-testbox; final leasetbx_01m3nvw7hs5e85fke4dhd34sxm(run).node scripts/check-changed.mjs: passed in 1,548 s, including full core/script lint, all type shards, Knip, schema/storage guards, formatting, and narrowed baselines. Core lint had zero errors and five pre-existing line-count warnings outside the edited files;config-env-vars.tsis 698 physical lines.pnpm build: passed in 310 s.pnpm config:schema:checkandpnpm config:docs:check: passed with zero generated drift. These ran on the same production changes before the final callback rename/comment removal (earlier Testbox run).node scripts/run-vitest.mjs src/config: 469 files passed, 3 skipped; 5,806 tests passed, 10 skipped (eight Windows-only cases and two opt-in benchmarks), in 750 s. The only later production delta is the reviewed callback rename and obsolete lint comment removal.node scripts/run-vitest.mjs import-boundary import-boundaries: 19 files / 98 tests passed, 89 s, including fs-safe and all sibling boundary tests.OPENCLAW_UPGRADE_SURVIVOR_PUBLISHED_BASELINE=1 [email protected] OPENCLAW_UPGRADE_SURVIVOR_CANDIDATE=current OPENCLAW_UPGRADE_SURVIVOR_SCENARIO=legacy-operator-state OPENCLAW_UPGRADE_SURVIVOR_UPDATE_RESTART_MODE=manual bash scripts/e2e/upgrade-survivor-docker.shpassed, 1,183 s including candidate package build/validation. Providerblacksmith-testbox, leasetbx_01m3p5zcg64sa0ek970zfmytbc(run); source tree was verified as the exact final candidate. Published baseline CLI-authored state and its updater survived automatic migration for both agents, schema validation, cron ownership, candidate agent turn, Gateway health/status, a second update with no package mutations, clean Doctor, formerly bundled plugin repair, and backup restoration. All state and providers were synthetic/isolated; no live Gateway was modified.Changed-test cost:
pnpm test src/config/config.env-vars.test.ts --maxWorkers=1passed 27 tests in 34 s wall (32.01 s Vitest duration, 94% cold transformation; the two new overlap cases each took 1 ms).pnpm test src/config/sessions/reset-policy.test.ts --maxWorkers=1passed 20 tests in 3 s wall. The timezone cases need real subprocess-local TZ semantics; the patch only supplies the repository loader. Hosted CI stopped early on the inherited SDK-budget failure; no additional per-file CI timings are claimed.Independent review through P2 is complete. A reported blank-agent-ID concern was rejected against the unchanged canonical guard, which throws before normalization. The rebase integration, fixture correction, and final lint changes received separate clean reviews. No accepted actionable findings remain.
Initial validation exposed the required assertion-baseline shrink, two callback-shadowing lint errors, an obsolete max-lines suppression, and eight deterministic subprocess loader failures. All were corrected without weakened assertions, added retries, timeout increases, schema updates, or new lint allowances.
File-by-file coverage (141 production files over 200 lines)
Config fifth-pass coverage
Base: dc7fe2a. Production files over 200 lines, sorted by initial size. Reserved src/config/sessions/session-accessor* files are excluded by lane instruction. Each module was read in full; smaller production modules were also swept.
src/config/io.write-prepare.tssrc/config/mutate.tssrc/config/zod-schema.core.tssrc/config/sessions/types.tssrc/config/zod-schema.agent-runtime.tssrc/config/schema.labels.tssrc/config/sessions/disk-budget.tssrc/config/config-env-vars.tssrc/config/sessions/combined-store-gateway.tssrc/config/sessions/session-transcript-reconcile.tssrc/config/sessions/transcript.tssrc/config/io.snapshot.tssrc/config/io.observe-recovery.tssrc/config/sessions/store-maintenance.tssrc/config/sessions/targets.tssrc/config/runtime-snapshot.tssrc/config/sessions/legacy-main-session-migration-operations.tssrc/config/sessions/session-transcript.worker.tssrc/config/io.write.tssrc/config/sessions/session-entry-read-runtime.tssrc/config/sessions/legacy-main-session-migration.tssrc/config/doc-baseline.tssrc/config/sessions/cleanup-service.tssrc/config/sessions/session-transcript-worker.types.tssrc/config/includes.tssrc/config/schema.help.runtime.tssrc/config/sessions/session-transcript-projection-rebuild.tssrc/config/redact-snapshot.tssrc/config/channel-compat-normalization.tssrc/config/env-preserve.tssrc/config/validation-plugin-rules.tssrc/config/sessions/session-transcript-worker-resources.tssrc/config/sessions/session-transcript-index.tssrc/config/sessions/session-history-eviction.tssrc/config/sessions/session-transcript-worker-runtime.tssrc/config/zod-schema.root-shape.tssrc/config/io.write-safety.tssrc/config/sessions/session-cold-storage.tssrc/config/sessions/session-canonical-key.tssrc/config/io.audit.tssrc/config/sessions/session-cold-storage-worker.tssrc/config/defaults.tssrc/config/sessions/session-history-worker-runtime.tssrc/config/sessions/restart-recovery-state.tssrc/config/zod-schema.gateway.tssrc/config/plugin-auto-enable.shared.tssrc/config/io.runtime.tssrc/config/sessions/transcript-tree.tssrc/config/schema.tssrc/config/validation-core.tssrc/config/sessions/session-transcript-reconcile.worker.tssrc/config/paths.tssrc/config/sessions/conversation-delivery-store.tssrc/config/validation-plugin-config.tssrc/config/schema.lookup.tssrc/config/sessions/transcript-write-context.tssrc/config/channel-config-metadata.tssrc/config/sessions/transcript-payload.tssrc/config/mcp-config.tssrc/config/io.context.tssrc/config/sessions/paths.tssrc/config/sessions/session-sqlite-target.tssrc/config/sessions/conversation-registry.tssrc/config/sessions/delivery-info.tssrc/config/sessions/session-snapshot-merge.tssrc/config/schema.help.core.tssrc/config/write-lock.tssrc/config/schema.tiers.tssrc/config/plugin-auto-enable.materialize.tssrc/config/sessions/startup-migration.tssrc/config/sessions/session-delivery-generation.tssrc/config/sessions/session-entry-navigation.tssrc/config/schema.help.automation.tssrc/config/sessions/session-entry-read.worker.tssrc/config/sessions/goals-operations.tssrc/config/zod-schema.root-support.tssrc/config/sessions/store-entry-shape.tssrc/config/io.load.tssrc/config/mutate.include-io.tssrc/config/sessions/lifecycle.tssrc/config/io.clobber-snapshot.tssrc/config/types.discord.tssrc/config/sessions/metadata.tssrc/config/codex-plugin-diagnostics.tssrc/config/io.health-state.tssrc/config/io.plugin-metadata.tssrc/config/io.read-helpers.tssrc/config/sessions/session-transcript-worker-readers.tssrc/config/issue-location.tssrc/config/sessions/session-suggestion-store.kernel.tssrc/config/zod-schema.agent-defaults-base.tssrc/config/sessions/store-entry.tssrc/config/env-substitution.tssrc/config/sessions/session-store-target-inventory.tssrc/config/sessions/session-transcript-reconcile-pool.tssrc/config/sessions/session-canonical-validation.tssrc/config/validation-issues.tssrc/config/config-journal-snapshot.tssrc/config/talk.tssrc/config/sessions/session-sharing-store.async.tssrc/config/docs-config-examples.tssrc/config/types.secrets.tssrc/config/sessions/restart-recovery-receipt.tssrc/config/sessions/session-history-archive-pruning.tssrc/config/resolution-facts.tssrc/config/sessions/skill-prompt-blobs.tssrc/config/utility-model-separation-migration.tssrc/config/schema.help.models.tssrc/config/sessions/session-transcript-search.tssrc/config/sessions/targets-read-availability.tssrc/config/include-write-boundary.tssrc/config/sessions/store-maintenance-operations.tssrc/config/model-provider-config.tssrc/config/tools-by-sender.tssrc/config/sessions/session-entry-codec.tssrc/config/io.write-topology.tssrc/config/sessions/session-placement-evidence.tssrc/config/schema.help.agents.tssrc/config/sessions/conversation-identity.tssrc/config/channel-alias-migration.tssrc/config/schema.hints.tssrc/config/types.openclaw.tssrc/config/validation.tssrc/config/sessions/goals.tssrc/config/sessions/plugin-host-cleanup.tssrc/config/backup-rotation.tssrc/config/io.runtime-write-finalization.tssrc/config/sessions/session-transcript-read-fence.tssrc/config/io.observe.tssrc/config/zod-schema.channel-messaging-common.tssrc/config/group-policy.tssrc/config/merge-patch.tssrc/config/legacy.roster.tssrc/config/sessions/session-canonical-validation-readiness.tssrc/config/validation-channel-rules.tssrc/config/sessions/session-transcript-projection-writer.tssrc/config/sessions/session-entry-provenance.tssrc/config/sessions/targets-collision.tssrc/config/sessions/session-history-types.tssrc/config/types.telegram.tssrc/config/sessions/group.ts