Skip to content

refactor(core): deslop redundant options and state - #166364

Merged
steipete merged 4 commits into
mainfrom
deslop/l424-derivable-core-20261006
Oct 7, 2026
Merged

steipete merged 4 commits into
mainfrom
deslop/l424-derivable-core-20261006

Conversation

@steipete

@steipete steipete commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Core command, reply, channel, and plugin helpers repeatedly reconstruct internal options and maintain bookkeeping already available from an owning object.

Doctor's web-search availability probe also caused a second plugin-registration pass during tool-schema inspection. That could repeat failed registrations, select a different duplicate provider, and leave supplemental providers outside the inspection's cleanup lifetime.

What Changed

Pass existing options through internal helpers, derive Doctor's default-agent flag from its path, remove unread plugin-trust parameters, and derive follow-up and progress bookkeeping from their existing owners. Explicit serialized projections and asynchronous snapshots remain where their behavior matters.

Web-provider discovery reuses matching inspection-owned registrations and loads missing declared or legacy providers under the same inspection's cache lifetime. Matching inspections keep their source checks, provider precedence, and release guard before ordinary registry reuse. Main's prepared-generation and ordinary request-registry selection remain authoritative outside inspections.

Public SDK signatures, CLI/config/protocol shapes, persisted data, search availability, and per-agent tool factories are preserved. No suppression, baseline, ignore, budget, timeout, or retry policy is weakened.

Lane l424 (derivable-core), BELOW-1000: 125 net production lines removed across 35 files (325 added, 450 deleted), excluding tests, fixtures, test support, generated files, and declarations.

Coverage and retained boundaries

The initial structural sweep read production TypeScript files in commands (662), CLI (541), auto-reply (519), plugins (782), and channels (290), then widened to flows (51) and routing (12). Detailed caller/consumer review covered changed helpers plus command registration, plugin rollback, channel finalizers, routing indexes, and setup/discovery flows.

Retained public CLI command-group and plugin test-runtime signatures, exact status output projections, channel SDK contracts, authority/admission snapshots, distinct route/session identities, and lifecycle-owned caches. Cross-repository reference searches covered src, extensions, packages, ui, apps, scripts, docs, and test.

Evidence

  • Original refactor: 778 focused tests across 45 files; the frozen-revision Plugin SDK API comparison found no API changes.
  • Inspection ownership: ten real Doctor fixture cases fail before the repair and pass afterward, covering provider-only and legacy discovery, duplicate-provider precedence, tool-name collisions, empty scope, detector failure, and cleanup failure. The original assertions remain intact. The Linux command pnpm test src/flows/doctor-tool-schema-inspection.test.ts --maxWorkers=1 reported 29.17 seconds runner wall time and 26.81 seconds in Vitest.
  • Conflict integration: the existing real inspection fixture now checks web-provider lookup before and after release without adding another fixture boot. Before the guard, its new release assertion fails; afterward both tests pass. pnpm test src/plugins/tools.inspection.test.ts --maxWorkers=1 reported 419.54 seconds wall time (415.80 seconds in the runner; 368.93 seconds in CI-mode Vitest) on the contended macOS host, mostly compilation; test bodies totaled 4.135 seconds. Fresh independent review was scoped-clean through P2.
  • Full canonical checks, all 27 core test graphs, extension production/test types, three Knip scans with zero findings, lint, and the full build passed before conflict integration. The final rebased candidate passed core production and affected plugin/Doctor/cron test graphs, 51 unique focused tests across seven files, the suppression gate, and lint with zero diagnostics across all three integration files and 264 rules. Clean main and candidate have zero cycles. Exact-head hosted CI remains the landing gate.

CI attribution: the original checks-node-changed-compact-large-9 failure was duplicate Doctor registration, also reproduced on its main parent; this PR repairs the inspection flow. The later checks-node-changed-compact-large-20 failure was cron's built-artifact selection. Main fixed that in f8f80eaff271049014578a54d394face26ea8d83; the rebase preserves that owner and drops the duplicate lane fix. The corresponding CI-gate failures were consequential; 26 and 21 fail-fast cancellations respectively remain historical missing coverage, to be replaced by the final exact-head run. The published 941093c4 head could not attach full CI because it conflicted with that main repair.

Final reviewed head: 656182db410f5c8026ec03436d18ff350a013846, tree 0c082d9e29045783f194f9eedc58b2331ede1fa3. The reviewed, signed tree passed the rebase checks above. Hosted CI on this exact head is required before landing.

@clawsweeper

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

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 656182db410f5c8026ec03436d18ff350a013846
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/plugins/web-search-credential-presence.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes commands Command implementations size: M labels Oct 7, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 3:03 AM ET / 07:03 UTC (Revision 6).

ClawSweeper review

What this changes

This PR simplifies internal option forwarding and reply bookkeeping, and keeps Doctor’s web-provider registrations within its tool-inspection lifetime.

Merge readiness

⛔ Blocked before merge - 1 item remains

The latest head resolves the prior integration concern and has no identified blocking introduced defect. The inspection-lifetime repair remains distinct from current main’s provider-selection fix, and this maintainer-authored PR should remain open for landing.

Priority: P3
Reviewed head: 656182db410f5c8026ec03436d18ff350a013846

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent internal simplification and inspection-lifecycle repair with focused regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The author’s verified maintainer status exempts this PR from the external-contributor proof gate. Reported real-loader Doctor fixtures exercise inspection registration, provider discovery, cleanup, and post-release rejection; they are supplemental validation, not a claimed live deployment. No material stored-data contract or cross-principal authority change was identified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author’s verified maintainer status exempts this PR from the external-contributor proof gate. Reported real-loader Doctor fixtures exercise inspection registration, provider discovery, cleanup, and post-release rejection; they are supplemental validation, not a claimed live deployment. No material stored-data contract or cross-principal authority change was identified.
Evidence reviewed 9 items Pinned introduced patch: Reviewed the merge-base-to-head delta rather than endpoint drift. The changes simplify internal forwarding and add inspection-owned provider reuse; dependency, workflow, protocol, and public SDK declaration changes are absent from this introduced patch.
Integration preserves main’s provider owner: The verified test merge has the pinned base followed by the exact PR head as parents. Its provider-resolution delta preserves ordinary prepared-generation and request-registry selection, while routing matching inspections through their release guard and source-matched registrations.
Current-main necessity check: Fetched main contains prepared-generation and request-owned inventory reuse, but lacks this PR’s inspection matching and supplemental-cache lifetime. The central remaining repair is therefore not established as implemented on main or in the supplied latest release.
Findings None None.
Security None None.

How this fits together

Doctor inspects configured agents and plugin tools to report runtime schema problems. Plugin provider resolution supplies search availability during that inspection, while the inspection owner controls registration reuse and cleanup.

flowchart TD
  A[Agent configuration and plugin manifests] --> B[Doctor tool inspection]
  B --> C[Inspection-owned registrations]
  C --> D[Web-provider resolution]
  D --> E[Reuse matching providers]
  D --> F[Load missing providers in owned cache]
  E --> G[Schema findings]
  F --> G
  B --> H[Release registrations and cache]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -125, Tests +105. Total -20 across 37 files.

View PR surface stats
Area Files Added Removed Net
Source 35 325 450 -125
Tests 2 136 31 +105
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 37 461 481 -20

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor/shared/codex-route-compaction-repair.ts, migration/backfill/repair: src/commands/doctor/shared/codex-route-config-repair.ts, migration/backfill/repair: src/commands/doctor/shared/codex-route-runtime-policy.ts, migration/backfill/repair: src/flows/doctor-tool-schema-projection.ts, migration/backfill/repair: src/flows/doctor-tool-schema-runtime.ts, unknown-data-model-change: src/commands/doctor/shared/codex-route-config-repair.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep one inspection owner for registration, supplemental discovery, and cleanup while preserving ordinary runtime provider selection and existing public contracts.

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

Yes, the Doctor tool-schema check and real-loader fixtures provide a focused path for registration reuse, provider precedence, and release behavior; the captured body reports before/after failures. This review inspected source and coverage without executing that path.

Is this the best way to solve the issue?

Yes, the patch extends the existing inspection lifetime and preserves main’s ordinary provider-selection owner, avoiding a competing registry or public API.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is primarily internal simplification with a bounded Doctor inspection-lifecycle repair and no demonstrated urgent user-facing regression.
  • 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 author’s verified maintainer status exempts this PR from the external-contributor proof gate. Reported real-loader Doctor fixtures exercise inspection registration, provider discovery, cleanup, and post-release rejection; they are supplemental validation, not a claimed live deployment. No material stored-data contract or cross-principal authority change was identified.

Evidence

What I checked:

  • Pinned introduced patch: Reviewed the merge-base-to-head delta rather than endpoint drift. The changes simplify internal forwarding and add inspection-owned provider reuse; dependency, workflow, protocol, and public SDK declaration changes are absent from this introduced patch. (656182db410f)
  • Integration preserves main’s provider owner: The verified test merge has the pinned base followed by the exact PR head as parents. Its provider-resolution delta preserves ordinary prepared-generation and request-registry selection, while routing matching inspections through their release guard and source-matched registrations. (src/plugins/web-provider-runtime-shared.ts:187, 7ab522a26870)
  • Current-main necessity check: Fetched main contains prepared-generation and request-owned inventory reuse, but lacks this PR’s inspection matching and supplemental-cache lifetime. The central remaining repair is therefore not established as implemented on main or in the supplied latest release. (src/plugins/web-provider-runtime-shared.ts:158, 43ca3a7be0c8)
  • Inspection cleanup and invalidation: Release records its completion before invoking cleanup, rejects subsequent matching lookups, joins both the acquired registry and supplemental cache, and propagates cleanup failures. Supplemental loads retain prepared install records, artifact preferences, and source digests. (src/plugins/tool-inspection-state.ts:34, 656182db410f)
  • Focused regression coverage and reported validation: Read the extended real-loader fixtures covering repeated registration, missing and legacy providers, duplicate-provider precedence, empty tool selection, detector failure, cleanup failure, and lookup rejection after release in request and generation scopes. The captured PR body reports before/after failures and passing final integration checks; no tests were executed during this read-only review. (src/flows/doctor-tool-schema-inspection.test.ts:23, 656182db410f)
  • Stored-data concern resolved by the introduced boundary: The Doctor edits remove a flag whose callers computed exactly the same agents.defaults predicate now derived by the callee. The existing runtime-policy field writer and repaired-config output owner remain unchanged. The discussion’s equivalence-replay suggestion was useful context, but this delta does not materially change a stored-data contract or require a migration. (src/commands/doctor/shared/codex-route-runtime-policy.ts:332, 656182db410f)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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 (5 earlier review cycles)
  • reviewed 2026-10-07T00:36:22.686Z sha 4af8770 :: blocked before merge. :: none
  • reviewed 2026-10-07T01:38:10.262Z sha 4af8770 :: blocked before merge. :: none
  • reviewed 2026-10-07T03:52:16.093Z sha 50ef4ff :: needs maintainer review before merge. :: none
  • reviewed 2026-10-07T05:39:26.495Z sha 941093c4ad6043d96a95f567928b653505f9ccab :: needs changes before merge. :: none
  • reviewed 2026-10-07T06:44:27.754Z sha 941093c4ad6043d96a95f567928b653505f9ccab :: blocked before merge. :: none

hippoley commented Oct 7, 2026

Copy link
Copy Markdown

Compatibility-proof scope looks narrowable here.

The stored-data detector appears to be firing because this refactor touches several Doctor repair/runtime-policy files, but the introduced delta is option/state derivation cleanup rather than a persisted-shape change. A useful proof would therefore be behavior-equivalence at the repair boundary rather than a migration narrative:

  • take representative pre-existing Codex route/config fixtures from current main;
  • run the existing repair/projection owners on base and candidate;
  • compare emitted repaired config / persisted representation byte-for-byte (or normalized JSON if ordering is intentionally unstable);
  • separately assert no new keys are written and no existing keys are dropped for the default-agent and explicit-agent cases affected by the removed derived flags.

If those outputs are identical, that directly answers the compatibility blocker the scanner is raising without inventing a migration that this PR does not seem to introduce.

I also checked the changed-file set: the flagged files are present, but the PR surface is entirely source refactoring with no test/config/generated file delta. That makes an equivalence replay more informative than generic upgrade prose.

hippoley commented Oct 7, 2026

Copy link
Copy Markdown

I converted the remaining migration/checklist ambiguity into a concrete compatibility evidence contract:

https://github.com/hippoley/ClawManager/blob/main/docs/evidence/openclaw-166364-compatibility-evidence-contract.md

The key source finding is that the detector-hit files still have the same mutation/output owners. For example, the candidate removes the redundant isDefaults argument and derives it from agentPath, while setModelRuntimePolicy continues to write the same agent.models[modelRef].agentRuntime.id field. The tool-schema changes similarly collapse repeated argument forwarding into ...params; they do not add a persisted field owner.

So the proposed proof is base-vs-candidate equivalence across existing repair fixtures:

  • normalized repaired config equality;
  • persisted-key set equality;
  • default-agent / explicit-agent / provider-pin cases;
  • emitted HealthFinding[] equality for the tool-schema path.

If those pass, the appropriate conclusion is “no stored-data contract change; no migration/backfill required”, which matches the latest review narrative while giving the stale checklist item a concrete verification path.

Remove repeated internal option projections and unread plugin trust parameters.
Derive follow-up and progress bookkeeping from their existing owners while
preserving public SDK, CLI, config, protocol, and persisted data contracts.
@openclaw-barnacle openclaw-barnacle Bot closed this Oct 7, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 7, 2026
@steipete
steipete force-pushed the deslop/l424-derivable-core-20261006 branch from 941093c to 656182d Compare October 7, 2026 06:57
@steipete
steipete merged commit 4c3a5b6 into main Oct 7, 2026
133 checks passed
@steipete
steipete deleted the deslop/l424-derivable-core-20261006 branch October 7, 2026 07:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
Pass existing internal options through core helpers and derive flags and bookkeeping from their existing owners. Preserve public SDK signatures, CLI/config/protocol shapes, persisted data, explicit output projections, and asynchronous snapshots.

Keep Doctor's selected and supplemental provider registrations under one inspection lifetime. Preserve provider precedence and source selection, honor main's ordinary runtime registry ownership, and reject provider lookup after inspection release.

Removes 125 net production lines across 35 files. The derivable-core sweep and BELOW-1000 coverage are recorded in the PR.

Validation includes the original 778 focused tests and SDK API comparison, final 51 focused tests, affected type graphs, zero runtime and Madge cycles, the suppression gate, and independent review. Exact-head hosted CI run 37584466877 passed on 656182d.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: L 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.

2 participants