Skip to content

refactor(claws): split lifecycle modules and preserve test coverage - #163306

Closed
Patrick-Erichsen wants to merge 15 commits into
codex/claw-1093-v2-26-remove-package-worker-admissionfrom
codex/claw-1093-v2-27-line-cap-extractions
Closed

Patrick-Erichsen wants to merge 15 commits into
codex/claw-1093-v2-26-remove-package-worker-admissionfrom
codex/claw-1093-v2-27-line-cap-extractions

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Publication Refresh: October 7

Layer 11/16. Previous: #163305 | Next: #163307. Published checkpoint: 4cac01dcb10a.

The stack now includes 45 previously local follow-up commits in four additional draft PRs, ending at #166801 (9e653a8ed286). Fresh combined-tip checks passed: 100 backend tests and 13 built-UI browser tests with a mocked Gateway. Before/after review captures are attached. Evidence below that names 6765a8741e4 remains historical evidence for that revision, not a new real-ClawHub run or per-layer CI result.

The stack remains draft and its first layer conflicts with current main. Reconciliation, exact-head CI/review, and the existing release gates remain outstanding. No merge or deployment is authorized by this publication.

What Problem This Solves

The launch changes grew several lifecycle and UI files beyond the repository's maintainability limits.

User Impact

No intended user-visible behavior changes. The same Claw flows remain covered while modules and tests become reviewable under existing file-size and CI rules.

Why This Change Was Made

Shared-state reads, package preflight, Add/Update helpers, official-source checks, CLI export, and large test suites are separated by responsibility. CI test inventory and assertion/config baselines reflect the moved coverage rather than waiving it.

Evidence

Split suites and coverage-tier checks are committed in this diff. At final stack tip 6765a8741e4, pnpm check:changed passed its structural ratchets, documentation checks, typecheck shards, dead-code check, lint, and UI checks. Focused backend tests passed 63/63 and Agents UI tests passed 34/34 at that tip. The installable tarball build/integrity also passed with build-info matching HEAD. No independent behavior proof is claimed for this refactor layer.

Release gate: Land the OpenClaw stack together only after ClawHub #3883 and local publish-to-real-task lifecycle proof.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts size: XL labels Oct 2, 2026
@Patrick-Erichsen Patrick-Erichsen changed the title codex/claw 1093 v2 27 line cap extractions refactor(claws): split lifecycle modules and preserve test coverage Oct 2, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The branch separates Claw agent-package lifecycle helpers, CLI export handling, and large test suites into smaller modules while retaining their existing entry points and coverage routing.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The extraction is coherent and coverage is retained, while historical runtime evidence only partially covers the refreshed source.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains useful work in an active coordinated stack. No concrete introduced defect was found, but the integrated stack and refreshed runtime evidence are not yet ready for landing.

Priority: P3
Reviewed head: 4cac01dcb10a76fca035dc7664805a0bb6597f95

Before merge

  • Resolve merge risk - The coordinated stack's current-main integration remains unverified: its body records a first-layer conflict, and the supplied test merge does not match the pinned parents.
  • Complete next step - Have the stack owner reconcile the conflicting base, validate the integrated result, refresh real lifecycle evidence, and complete the explicitly retained ClawHub and coordinated-stack gates before landing.

Findings

None.

Agent review details

How this fits together

Claws packages create agents and manage their workspace files, plugins, skills, and scheduled jobs. CLI and Gateway requests enter the lifecycle owner, which reviews package identity and ownership before changing configuration or installed resources.

flowchart TD
  A[CLI and Control UI] --> B[Gateway and lifecycle requests]
  B --> C[Package and ownership review]
  D[ClawHub package metadata] --> C
  E[Stored lifecycle facts] --> C
  C --> F[Add Update and Remove]
  F --> G[Agent configuration and resources]
Loading

Technical review

Best possible solution:

Retain the focused extractions and preserved coverage within one reconciled, behavior-verified stack.

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

Not applicable: this refactor reports file-size and reviewability concerns, rather than a runtime defect; no introduced failing behavior was established.

Is this the best way to solve the issue?

Yes: extracting existing responsibilities and retaining caller contracts is a focused solution, provided the reconciled stack preserves its lifecycle behavior.

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the focused extractions and preserved coverage within one reconciled, behavior-verified stack.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Security

None.

Evidence

What I checked:

  • Pinned production extraction: The introduced delta moves existing Add configuration mutation, package preflight, plugin-probe comparison, Update preflight, cron planning, and worker read dispatch into helpers. The inspected conditions and invocation ordering remain equivalent to the pinned base. (src/claws/package-plugin-probe-match.ts:19, 4cac01dcb10a)
  • Authority checks remain at their callers: Add retains its live-authority and reviewed-config checks immediately before calling the extracted synchronous config transformer. Package installation retains its post-probe assertion before the extracted identity/capability comparison. The extraction does not materially introduce or transfer authority. (src/claws/add.ts:492, 4cac01dcb10a)
  • Preserved test routing: Extracted cleanup, preflight-inspection, and agent-guard suites are explicitly added to the database-worker lane and protected runtime inventory. The CLI outcome suite retains the original CLI suite's exemption tier. A read-only comparison accounting for moved lines found retained assertions rather than discarded scenarios. (scripts/lib/ci-proof-test-inventory.mts:1666, 4cac01dcb10a)
  • Current main still has inline lifecycle logic: Pinned main's packages module still defines package preflight and probe comparison inline. Its tree lacks the sampled extracted Add, state-read, and official-source modules; no verified merged replacement establishes that this refactor is obsolete. The supplied latest release is v2026.9.8, but release inclusion of this branch is not established. (src/claws/packages.ts:148, 40d735e451b1)
  • Historical real setup evidence inspected: The captured discussion for fix(claws): recover interrupted ownership and preserve safe removal #163307 describes a packaged isolated Gateway using local ClawHub, reviewed Add, real Lobster tasks, canary Update, Labs-off removal, and restart persistence at 6765a87. All four prepared images were inspected and show Labs settings, catalog, capability review, and a task result. This is useful historical local evidence, not production-registry verification. (6765a8741e49)
  • Historical proof has a concrete source coverage gap: Pinned GitHub tree/blob inspection found six of eight sampled extracted production helpers byte-identical to the historical runtime revision. Add configuration mutation differs: the reviewed head uses applyAgentConfig and a different implicit-main representation. Update preflight's extracted function is retained, although the historical module also contains later helpers. These differences are not attributed as regressions introduced by this PR; they prevent treating the historical Add run as complete current-head evidence. (src/claws/add-agent-config.ts:64, 4cac01dcb10a)

PR surface

Source +247, Tests +410, Generated 0, Other +5. Total +662 across 45 files.

View PR surface stats
Area Files Added Removed Net
Source 20 585 338 +247
Tests 20 3328 2918 +410
Docs 0 0 0 0
Config 0 0 0 0
Generated 2 3 3 0
Other 3 9 4 +5
Total 45 3925 3263 +662

Review metrics

Metric Value Why it matters
Code growth by purpose production +120, tests and support +534, tooling and baselines +8 net lines Production growth is explained by helper-module boundaries; most additional code supports splitting retained test coverage.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is maintainability and coverage-routing work with no intended user-visible behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rank-up moves

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

  • Refresh real Add/Update lifecycle evidence on the reconciled stack, including preserved agent configuration, and redact private information.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-02T06:14:25.122Z sha df4d831 :: blocked before merge. :: none
  • reviewed 2026-10-02T11:07:42.211Z sha df4d831 :: blocked before merge. :: none

Reviewed October 7, 2026, 7:26 PM ET / 23:26 UTC (Revision 3).

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Oct 2, 2026
@Patrick-Erichsen
Patrick-Erichsen force-pushed the codex/claw-1093-v2-27-line-cap-extractions branch from df4d831 to 4cac01d Compare October 7, 2026 23:15
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Closing as superseded: #171623 replaced the Claws plan/review/update/remove lifecycle with a one-way Add operation, and main no longer has the lifecycle modules this layer changes. Any hardening here that still matters should be redone against the new Add flow.

Closed by Roboclaw at the author's request after an audit of his open PRs. The branch is kept, so this can be reopened if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants