Skip to content

refactor(core): deslop skills, acp, logging, process, flows and wizard second pass - #158906

Merged
steipete merged 1 commit into
mainfrom
deslop/l78-core-misc2-final
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/l78-core-misc2-final

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

This second pass removes redundant forwarding, repeated projections, and duplicate control flow across skills, ACP, logging, process execution, setup flows, and onboarding.

User Impact

The refactors preserve skill instruction bytes, ACP behavior, log redaction, process ownership and signals, wizard copy and step order, and configuration keys. No migration or operator action is required.

Fixes found along the way

The skill scanner counted omitted dangerous-exec findings twice when an imported alias also matched a literal rule after the 32-finding cap. For 40 calls through execFile as spawn, it reported 16 omitted findings instead of 8. Deduplication now records every literal match independently of the reporting cap; the existing bounded-report test covers this case.

The search setup credential-required label test inherited XAI_API_KEY from its host, making it fail in authenticated environments. It now scopes the missing-key condition through the existing environment helper and restores the original value without changing assertions.

Why This Change Was Made

This maintainer-requested sweep read the production files largest-first and checked callers, public exports, and the earlier passes (#157765, #157748, #157982). It removes 1,174 net production lines and adds 9 net test lines. Audit and cron sources are untouched.

Simplifications and retained boundaries
Area Simplification and rationale
Skills discovery Remove a one-use reference iterator and scalar predicate; pass already prepared command options directly to their owner.
Skills loading Keep installer targets in one explicit kind-to-field projection; remove character checks already enforced by the unchanged patterns; use existing path containment and string-list normalization owners.
Skills synchronization Move the only keyed-queue use to the synchronization owner and delete its forwarding module.
Skill snapshots Inline one-use cache key and cache publication helpers while retaining version, authority, waiter, and retry checks.
Skill installation Reuse prerequisite installation and failure projection; derive metadata shapes from canonical contracts; remove redundant typed casts and unreachable discovery state.
Skill scanning Share full-source finding projection and severity accumulation while retaining every detection pattern and evidence-redaction rule.
Workshop Share input and database-row types, rollback projection, target reads, and stale-support handling; remove single-use path/options wrappers and repeated frontmatter parsing.
ACP transport Bind protocol methods to their existing lifecycle owners; use shared deferreds; share ledger fallback and failure handling.
ACP lifecycle Consolidate resume-state clearing with explicit retry/discard differences; inline initialization cleanup; reuse backend health checks and ordered thought/text projection.
Logging Share level thresholds and same-name diagnostic field projection with exact allowlists; remove a dead runtime factory and write-only state.
Support logs Use one safe-field walker for named and structured arguments. Numeric keys and _meta remain excluded by the retained exact field allowlists; no redaction patterns are removed.
Process execution Reuse admission predicates, stdout/stderr capture and flush paths, and EOF/close callbacks; remove redundant timer guards and forwarding layers.
Setup flows Remove temporary provider envelopes, unreachable credential redispatch, duplicate model-option/allowlist projection, redundant channel lookup, and Doctor forwarding layers.
Wizard Share search-status note emission, token/password probe handling, and memory-import failure presentation; retain localization bytes and prompt order.

Watcher custody, process extinction, storage admission, revision pinning, rollback, public SDK compatibility, and distinct redaction coordinate passes remain with their existing owners.

Codex source was inspected directly for turn start/interrupt, model discovery, web-search configuration, and device-code prompts. Relevant contracts: codex-rs/app-server-protocol/src/protocol/v2/turn.rs, codex-rs/app-server-protocol/src/protocol/v2/model.rs, codex-rs/protocol/src/config_types.rs, codex-rs/core/src/config/mod.rs, codex-rs/app-server/src/bespoke_event_handling.rs, and codex-rs/login/src/device_code_auth.rs at sibling revision 8f38d5a877da8c5c2c0b5158e72bb5f2290a3157.

Evidence

Final validation used Blacksmith Testbox tbx_01m3erw8sbwdw7w5bcdg9gqgk2, run 36240114837, with installed frozen-lockfile dependencies, verified source base 3b829ce81bd7d7678858351b83070591a9ce5a58, and candidate tree 3698501b09ad378d59f17a0ab3f493a953175082. The lease was stopped after successful proof.

  • Full-subtree and caller selection via node scripts/run-vitest.mjs: 5,683 passed, 77 existing skips; 411 passing files across 11 shards in 432.71 s. Covers all six subtrees plus model-picker, hosted setup, chat wizard, guided memory import, and Gateway wizard-session callers.
  • Scanner negative control failed on the original code with 16 omitted matches instead of 8; candidate passes all 50 tests. pnpm test src/skills/security/scanner.test.ts --maxWorkers=1: 1.47 s wall.
  • The original search fixture fails with a synthetic parent XAI_API_KEY. The repaired full file passed 20 consecutive Linux runs, 16 tests each, under that same environment. pnpm test src/flows/search-setup.test.ts --maxWorkers=1: 14.83 s wall, 2.76 s Vitest duration. The original 40-file infra selection also passed twice separately (673 tests each; 152.70 s and 143.39 s) and again in the final cross-shard run.
  • Earlier focused node scripts/run-vitest.mjs proof passed 9 shards in 105.96 s; after the first base refresh, wizard/scanner/logging regressions passed 3 shards in 17.77 s. Final full-subtree proof above covers the final candidate.
  • Independent Codex autoreview on the final base and patch: scoped-clean at P0–P2. The isolated review includes complete guard and caller definitions.
  • Final node scripts/check-changed.mjs: passed, including all 25 core-test typecheck graphs, lint, dead-export scans, and boundary guards. pnpm build: passed in 7m36.9s. The complete remote command exited 0.
  • Exact-head hosted CI and openclaw/ci-gate: passed for 0b0730ecca081f0191a9b3390a993976bc0beac9, including macOS and Windows jobs. The added scanner alias case took 0.001 s in the Bun shard; the repaired search-provider label case took 0.003 s in the Node shard. These are reported test-body durations; full-file serial wall costs are recorded above.
  • Local formatting and git diff --check passed. All tests, lint, typechecking, and builds ran remotely.

Upgrade compatibility follow-up

ClawSweeper found no actionable code or security defect and requested the repository's published-updater proof. On Blacksmith Testbox tbx_01m3ezc7nj08wzwj1assjzhvk6 (run 36246182684), the published [email protected] updater installed this exact candidate successfully over the harness's existing-user state. The remote checkout was explicitly pinned to 0b0730ecca081f0191a9b3390a993976bc0beac9 and tree 3698501b09ad378d59f17a0ab3f493a953175082 before packaging.

The recorded first-hop phases passed: candidate package identity, package update (148.03 s), installed package identity, automatic migration, plugin-registry requests, Doctor (14.36 s), post-Doctor config validation, and state-survival assertions. The installed candidate then started through the existing service fixture in 14 s, passed its strict /readyz check, preserved its unit/environment bytes, and answered authenticated Gateway status in 1 s. No live model-provider turn is claimed.

Supplemental restart limitation: the full pnpm test:docker:update-restart-auth lane did not pass. Its later, separate candidate-to-synthetic-future-version hop refused with service-membership-unverified. The source-owned systemd emulator deliberately returns an empty ControlGroup (scripts/e2e/lib/upgrade-survivor/update-restart-auth.sh:401); the native membership guard introduced by merged #158314 correctly refuses that unverifiable service. Both the emulator and guard are unchanged by this PR. This is an unsupported native-ownership proof environment, not evidence of a regression in this patch. The existing first-hop, Doctor, state, readiness, and authentication results above are preserved; native automatic-restart success is not claimed. No ownership check, assertion, retry, or timeout was weakened.

The wrapper's SSH transport returned 255 during packaging while the remote harness continued; its completed log and structured summary were recovered from the same owned lease. Earlier attempts stopped before baseline installation on synthetic sync-commit identity checks. The final attempt fetched and checked out the pinned public commit before building, keeping package and plugin-registry provenance aligned. The lease was stopped after collecting the completed result.

This patch changes no schema, persisted format, config key, default, retention, or migration policy. Doctor's lazy callbacks still call the same runtime owners; the Workshop query still reads the same stored fields.

The first cold source capture expired before any test executed; later leases used a longer idle window. Gates caught and corrected a callback type mismatch, an exhaustive return, and exact baseline shrink/lint cleanup. Unrelated line-cap failures were already owned by #158778 and #158820; the final base includes both merged fixes. The search-fixture failure was reproduced and repaired before the stability runs. No failed test was retried merely to obtain green.

@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 13:23
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 0b0730ecca081f0191a9b3390a993976bc0beac9
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/logging/diagnostic-support-log-redaction.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/logging/diagnostic-support-redaction.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/logging/redact.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/skills/security/scanner.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.

Carefully review these changes before merging.

@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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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, 11:50 AM ET / 15:50 UTC (Revision 4).

ClawSweeper review

What this changes

The branch consolidates internal skill, ACP session, logging, process, setup, and wizard paths while correcting skill-scanner truncation accounting and an environment-sensitive setup test.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open for normal maintainer review. Current main does not contain this second cleanup pass, and the earlier merged passes cover distinct work. No actionable introduced defect was confirmed. The reported restart failure occurs in an unchanged emulator that cannot attest native service membership.

Priority: P3
Reviewed head: 0b0730ecca081f0191a9b3390a993976bc0beac9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Broad but coherent cleanup has focused regression coverage, exact-head CI, and a documented published-updater first hop; the separate emulator limitation is scoped.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The maintainer-authored cleanup is exempt from the external-contributor proof gate. The PR body reports that the published updater installed this candidate over existing state, Doctor and state checks passed, and the candidate served readiness and authenticated status; the separate native-restart hop failed in an unchanged emulator with an empty ControlGroup. The inspected Workshop query changes no stored-data contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored cleanup is exempt from the external-contributor proof gate. The PR body reports that the published updater installed this candidate over existing state, Doctor and state checks passed, and the candidate served readiness and authenticated status; the separate native-restart hop failed in an unchanged emulator with an empty ControlGroup. The inspected Workshop query changes no stored-data contract.
Evidence reviewed 10 items Introduced scanner repair: The introduced hunk records literal dangerous-exec matches even after the reporting cap, preventing an aliased call from being counted twice; the changed test adds the alias case.
SecretRef boundary retained: Search setup's reference mode returns an environment SecretRef before reaching the text-key branch, so removal of the later conversion does not change that mode.
No-daemon boundary retained: The explicit no-daemon return still precedes the moved service setup block.
Findings None None.
Security None None.

How this fits together

These subsystems turn setup choices, plugin skills, and user commands into Gateway sessions, process work, and diagnostics. Their outputs affect configuration, session updates, command results, and support logs.

flowchart LR
A[User commands and configuration] --> B[Setup flows]
A --> C[Skill loading and scanning]
B --> D[Gateway and ACP sessions]
C --> D
D --> E[Process execution]
D --> F[Diagnostic logging]
E --> G[Results and status]
F --> G
Loading

Before merge

  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.
  • 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

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/flows/doctor-core-checks.ts, migration/backfill/repair: src/wizard/setup.finalize.ts, serialized state: src/acp/control-plane/manager.initialize-session.ts, unknown-data-model-change: src/acp/control-plane/manager.initialize-session.ts, unknown-data-model-change: src/flows/doctor-core-checks.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain the consolidated owners and scanner cap repair while preserving existing session, SecretRef, redaction, and Gateway setup contracts.

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

Not applicable to the cleanup as a whole. The included scanner defect has a precise source-level negative control: 40 aliased dangerous-exec calls exceed the 32-finding cap and previously double-counted omitted matches.

Is this the best way to solve the issue?

Yes. The inspected changes reuse existing owners, and the scanner alias test protects the claimed accounting repair without adding a new policy surface.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3f10eb70e8ce.

Labels

Label changes:

  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P3: This is primarily internal cleanup with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 maintainer-authored cleanup is exempt from the external-contributor proof gate. The PR body reports that the published updater installed this candidate over existing state, Doctor and state checks passed, and the candidate served readiness and authenticated status; the separate native-restart hop failed in an unchanged emulator with an empty ControlGroup. The inspected Workshop query changes no stored-data contract.

Evidence

What I checked:

  • Introduced scanner repair: The introduced hunk records literal dangerous-exec matches even after the reporting cap, preventing an aliased call from being counted twice; the changed test adds the alias case. (src/skills/security/scanner.ts:509, 0b0730ecca08)
  • SecretRef boundary retained: Search setup's reference mode returns an environment SecretRef before reaching the text-key branch, so removal of the later conversion does not change that mode. (src/flows/search-setup.ts:630, 0b0730ecca08)
  • No-daemon boundary retained: The explicit no-daemon return still precedes the moved service setup block. (src/wizard/setup.finalize.ts:301, 0b0730ecca08)
  • Stored-event query: The Workshop change replaces an explicit column selection with selection of the same event table; no schema or serialized-field writer changes were identified in this hunk. (src/skills/workshop/store-sqlite-event.ts:94, 0b0730ecca08)
  • Restart-harness limitation: The unchanged systemd emulator explicitly emits an empty ControlGroup, explaining the reported service-membership refusal in the separate synthetic future-version hop. The linked Testbox carrier is marked cancelled; the completed first-hop results are reported in the PR body rather than independently established by that carrier status. (scripts/e2e/lib/upgrade-survivor/update-restart-auth.sh:401, 0b0730ecca08)
  • Exact-head CI: The hosted CI run completed successfully for the pinned PR head. (0b0730ecca08)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • JackS1237: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Amer Sheeny: 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 (3 earlier review cycles)
  • reviewed 2026-09-26T13:31:52.168Z sha 0b0730e :: blocked before merge. :: none
  • reviewed 2026-09-26T14:31:14.264Z sha 0b0730e :: blocked before merge. :: none
  • reviewed 2026-09-26T15:57:54.026Z sha 0b0730e :: blocked before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The Evidence section now records the published 2026.9.6 updater installing the exact candidate, followed by passing automatic-migration, Doctor, config/state preservation, strict candidate /readyz, and authenticated RPC checks. The candidate's service start also preserved its unit/environment bytes.

The separate synthetic future-version restart hop is explicitly recorded as failed, not passing proof: the unchanged source-owned emulator deliberately supplies no native ControlGroup, so the native membership guard from #158314 correctly refuses it. No native automatic-restart or serving-turn success is claimed, and no ownership guard was weakened. The patch changes no schema, persisted format, config key, default, retention, or migration policy. Exact-head CI and the combined gate passed.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 26, 2026
@steipete
steipete merged commit f14c4b5 into main Sep 26, 2026
326 checks passed
@steipete
steipete deleted the deslop/l78-core-misc2-final branch September 26, 2026 16:08
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 26, 2026
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

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: 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