Skip to content

refactor: simplify diagnostic, backup, and runtime ownership - #140369

Merged
steipete merged 3 commits into
mainfrom
codex/deslop-owner-projections
Sep 6, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/deslop-owner-projections

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Diagnostic, push, backup, and session paths repeat transport selection, value construction, and ordering logic. Several private options and fallback branches survive only for tests. This cleanup gives those decisions one owner while preserving their observable behavior.

Related: #139597

Why This Change Was Made

Owner Production lines removed Preserved behavior
Doctor platform notes 76 Warning text/order, platform guards, service-environment precedence, and bounded probes
APNs dispatch 74 Payloads, transport selection, exact sender options, cancellation/currentness, and approval-specific control omission
Plugin runtime helpers 20 Ollama's public metadata and lazy hooks; Claude memory-read errors and causes
Backup stream and test interfaces 30 Partial-file cleanup, idle deadline, real plan discovery, extraction budgets, and retry counts
Session projections 15 Latest media payload in first-seen row order; final enriched identity-picker order
Diagnostic capture policy 12 Fresh positive policy object, default-off capture, all gates/fields, and system-prompt exclusion
Workspace scratch cleanup 4 Git metadata retention, sequential removal, and errors
Process stdin 10 Explicit piping for supplied input, including empty values; inherited stdin when omitted

Production is 241 lines smaller. Tests/support grow by 108 lines, retaining existing cases and strengthening actual boundary coverage. No public API, configuration option, schema, dependency, retention policy, or authorization change is introduced.

The APNs dispatcher accepts lifecycle controls separately from transport data, so approval notifications continue ignoring even extraneous JavaScript control fields. Its signing, HTTP/2, relay, registration, and result owners stay unchanged. Backup's existing publication owner remains responsible for unidentified or delayed cleanup receipts; only the unused ownerless branch is removed.

User Impact

No intended change to user-visible behavior. Existing diagnostics, pushes, backups, media history, search setup, migration, and subprocess I/O retain their current outcomes with less internal plumbing.

Evidence

  • Original-compatible tests preserve all existing cases and add latest-media ordering, real warning-probe normalization, direct/relay dispatch controls, and default-deadline coverage.
  • Baseline suites passed before applying production changes. Dedicated APNs cases also passed independently after moving them to generated-key fixtures; existing TLS suites remain unchanged.
  • Actual subprocess proof covers inherited stdin and explicit empty text/byte input through the real command runner.
  • Independent P0–P2 reviews cover every implementation scope; no accepted/actionable findings remain. All review scanners and isolation stayed enabled.
  • The core batch passes 873 tests across 25 files and its full changed/build gates. Added backup-boundary and sibling coverage passes 252 tests across 12 files, including the real shared-runner child’s completion/teardown and malformed-receipt checks. Existing platform skips remain unchanged.
  • Mutation controls prove the new tests reject a removed budget check, a check moved after scratch creation, and removal of the real retry-count reset. The hard-cap case uses a small real archive with simulated reported size.
  • Workspace scratch cleanup passes all 53 original and candidate reconciliation tests, including actual Git patch/rollback flows.
  • Final combined changed checks passed, including core/plugin/test types, lint, assertion budgets, dead exports, database guards, and zero runtime import cycles. The final 29-file candidate builds with pnpm build:ci-artifacts; build metadata identifies commit 4a83819421621ab742c40473710e20250bc46eb8.

Filesystem, loopback transport, and subprocess checks use owned synthetic fixtures. The cleanup does not change external provider wire behavior or require operator-state changes. The complete change removes 134 lines overall, including tests/support and one retired assertion-budget entry.

Review follow-up

The data-model compatibility item in the ClawSweeper review is a path-classification false positive. No stored representation, schema, migration, backfill, embedding/vector metadata, retention, or upgrade behavior changes:

  • doctor-platform-notes.ts only reads platform/service/environment state and builds or emits warnings. The removed arguments are private test injection; service-environment precedence, bounded probes, warning text, and ordering remain covered by the baseline/candidate suites. Suggested repair commands are warning text, not executed mutations.
  • extensions/migrate-claude/memory.ts replaces a duplicate readMemoryDir with the existing identical reader at source.ts:98. Both use the same readdir options and error/cause. The item IDs, targets, scan limits, metadata fields, plan construction, and import executor are unchanged. Existing provider tests pass, including actual project imports, overwrite backups, source disappearance, path boundaries, unreadable memory, and oversized scans.
  • No migration or upgrade transformation is needed for this unchanged data contract. The before-merge request is therefore resolved by the source equivalence and existing command/provider behavior proof, without adding a migration.

@clawsweeper

clawsweeper Bot commented Sep 6, 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 6, 2026 18:37
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations plugin: migrate-claude extensions: ollama size: XL maintainer Maintainer-authored PR labels Sep 6, 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 Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 6, 2026, 2:44 PM ET / 18:44 UTC.

ClawSweeper review

What this changes

The PR consolidates diagnostic, notification, backup, session, plugin, and subprocess helpers while replacing private test interfaces with coverage through existing entrypoints.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this remains useful, maintainer-sponsored cleanup, and the inspected changes reveal no blocking correctness defect. The related merged refactor does not supersede this work.

Likely related people: Peter Steinberger and Vincent Koc are routing candidates based on relevant main-branch history; exact line introduction remains unverified.

Priority: P3
Reviewed head: 4a83819421621ab742c40473710e20250bc46eb8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A sound internal consolidation with meaningful boundary coverage and no supported blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a MEMBER-authored PR, so ordinary external-contributor proof is exempt; no material authority change triggers an exception. The body reports real subprocess and owned filesystem checks, while APNs dispatch additions use mocked senders and remain supplemental.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a MEMBER-authored PR, so ordinary external-contributor proof is exempt; no material authority change triggers an exception. The body reports real subprocess and owned filesystem checks, while APNs dispatch additions use mocked senders and remain supplemental.
Evidence reviewed 10 items Pinned introduction and merge boundaries: Reviewed merge-base 74fe7d6 to the pinned head. Raw test-merge records confirm the pinned base followed by the exact PR head; its changed paths match the introduced scope. Base-only changes were not attributed to this PR.
APNs transport and lifecycle preservation: The shared dispatcher retains direct/relay selection and explicit sender fields. Alert and background calls forward lifecycle controls; approval calls omit them, including extraneous JavaScript properties. Existing signing, registration, currentness checks, and transport implementations remain unchanged.
Backup cleanup has an existing production owner: The production archive caller already supplies onPartialArchive and retains receipts in the publication owner. That owner handles unidentified and delayed cleanup. Removing the unused ownerless fallback does not remove the production cleanup path or change archive storage semantics.
Findings None None.
Security None None.

How this fits together

These internal services turn configuration, agent replies, and operator requests into diagnostics, device notifications, backup archives, session views, and subprocess results. The refactor consolidates their implementation while retaining existing output and lifecycle owners.

flowchart TD
  A[Configuration and operator requests] --> B[Diagnostic and backup services]
  C[Agent replies and device registrations] --> D[Session and notification services]
  B --> E[Warnings and verified archives]
  D --> F[Transcript updates and device pushes]
  A --> G[Plugin and subprocess helpers]
  G --> H[Search and command results]
Loading

Before merge

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

Security

None.

PR surface

Source -241, Tests +108, Other -1. Total -134 across 29 files.

View PR surface stats
Area Files Added Removed Net
Source 15 112 353 -241
Tests 13 504 396 +108
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 2 -1
Total 29 617 751 -134

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-platform-notes.ts, unknown-data-model-change: src/commands/doctor-platform-notes.ts, vector/embedding metadata: extensions/migrate-claude/memory.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain one implementation owner for each internal decision, with observable contracts protected through the existing production entrypoints.

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

Not applicable: this PR proposes behavior-preserving cleanup, and source inspection found no concrete introduced failure to reproduce.

Is this the best way to solve the issue?

Yes: the consolidation reuses existing owners and removes private test-only plumbing while retaining production guards, ordering, and public plugin metadata.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is internal cleanup with preserved observable behavior and no identified urgent user-facing defect.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a MEMBER-authored PR, so ordinary external-contributor proof is exempt; no material authority change triggers an exception. The body reports real subprocess and owned filesystem checks, while APNs dispatch additions use mocked senders and remain supplemental.

Label justifications:

  • P3: This is internal cleanup with preserved observable behavior and no identified urgent user-facing defect.
  • 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 supplied repository state identifies a MEMBER-authored PR, so ordinary external-contributor proof is exempt; no material authority change triggers an exception. The body reports real subprocess and owned filesystem checks, while APNs dispatch additions use mocked senders and remain supplemental.

Evidence

What I checked:

  • Pinned introduction and merge boundaries: Reviewed merge-base 74fe7d6 to the pinned head. Raw test-merge records confirm the pinned base followed by the exact PR head; its changed paths match the introduced scope. Base-only changes were not attributed to this PR. (48fe4f21435b)
  • APNs transport and lifecycle preservation: The shared dispatcher retains direct/relay selection and explicit sender fields. Alert and background calls forward lifecycle controls; approval calls omit them, including extraneous JavaScript properties. Existing signing, registration, currentness checks, and transport implementations remain unchanged. (src/infra/push-apns.ts:506, 4a8381942162)
  • Backup cleanup has an existing production owner: The production archive caller already supplies onPartialArchive and retains receipts in the publication owner. That owner handles unidentified and delayed cleanup. Removing the unused ownerless fallback does not remove the production cleanup path or change archive storage semantics. (src/infra/backup-create.ts:675, 4a8381942162)
  • Backup limits and boundary coverage: SQLite extraction budgeting still runs before scratch-directory creation. Replacement tests exercise backupVerifyCommand with a real small archive, injecting available space or reported size and asserting no extraction starts. The retry-count assertion now exercises the production backup command instead of reproducing counter-reset logic inside a test. (src/commands/backup-verify.ts:466, 4a8381942162)
  • Session output remains guarded and ordered: The earlier nonempty persisted-content guard makes the removed later guard redundant. Map replacement preserves first-seen ordering with the latest payload. Identity-picker output retains its final sort after membership enrichment; the other identity consumer uses membership lookup. (src/gateway/server-methods/chat-send-reply-dispatch.ts:251, 4a8381942162)
  • Plugin contract remains canonical: Ollama's public wrapper still spreads web-search-contract-api metadata and lazily loads setup/tool hooks. The narrowed runtime helper is private under extensions policy. Claude memory reading reuses the identical error-and-cause implementation. Neither change depends on the Codex harness contract. (extensions/ollama/src/web-search-provider-registration.ts:22, 4a8381942162)

Likely related people:

  • Peter Steinberger: 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)

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.

@steipete
steipete merged commit 7d95c2f into main Sep 6, 2026
252 checks passed
@steipete
steipete deleted the codex/deslop-owner-projections branch September 6, 2026 18:54
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…w#140369)

* refactor: simplify diagnostic and runtime ownership

* refactor: remove backup test interfaces

* refactor: reuse workspace scratch cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations extensions: ollama gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: migrate-claude rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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