Skip to content

fix(doctor): report remaining systemd units after cleanup - #158034

Merged
steipete merged 5 commits into
mainfrom
codex/doctor-alias-cleanup-20260925
Sep 25, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/doctor-alias-cleanup-20260925

Conversation

@steipete

@steipete steipete commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Doctor could remove the confirmed user-scope systemd unit and claim the system service was the sole Gateway manager while another canonical or legacy user unit remained installed.

User Impact

Doctor reports a remaining matching user unit or an unverifiable follow-up and gives inspection/rerun guidance. It still removes only the unit the operator confirmed. Additional units require separate inspection and confirmation.

Why This Change Was Made

An uninstall result describes one selected unit, not every possible manager. After successful selected-unit cleanup, Doctor passively consults the existing profile/selector-scoped discovery owner. A clean result says only that no other matching installed user unit was found; it does not claim global exclusivity or service health. A later inspection failure does not turn successful removal into a removal error.

This follows #119674 and preserves its installation identity, confirmation, update admission, and uninstall operation. The published updater's in-progress policy defers this service-repair path. No configuration, schema, persisted format, or deletion authority changes are introduced.

The temporary catalog-inference changes imported during CI repair have been withdrawn, not accepted. Catalog files now match fixed canonical main 168d454d, retaining the landed scoped-outcome correction #158139 and real-HTTP fixture correction #158115. Returned provider configuration alone is not promoted to a live discovery outcome. The separate legacy-retention repair is not a prerequisite for this PR.

Evidence

Two regression controls failed on the original false “sole gateway manager” report after deleting the selected synthetic unit while the second alias's bytes remained intact. The corrected service path passed 18 identity cases, 130 Doctor siblings, and seven selected-unit removal cases: 155 distinct cases. Native transport and uninstall are mocked at that boundary; this is not a new live-systemd or published-package claim.

The pending-read fixture uses the landed reader/staging attribution correction from #145043 and mock-lifetime cleanup from #158074. All five cases pass with reader reuse, balanced staging, and natural child-settlement assertions unchanged.

After withdrawing catalog inference, 100 direct composition cases pass, including the unchanged native-catalog worker assertion, the real HTTP discovery lifecycle, auth provenance, and explicit alias-scoped outcomes. Selected core and test type graphs, lint, formatting, line-cap checks, and the full all-import cycle check passed. Fresh managed P2 review of the reversal is clean. The original service review and applicable proof are retained.

The local five-file invocation stopped before any Vitest case because the freshness fixture requires a runtime build and its publication guard could not establish the affected Gateway's offline/disjoint state. No operator Gateway was stopped, no guard was bypassed, and no freshness pass is claimed for that invocation. The exact landed #158115 fixture has its own standalone, contended, and original-shard qualification; current-head hosted CI remains the landing gate.

Historical failures remain recorded: 36117727204 exposed the reader/staging fixture; 36130205590 exposed missing explicit success in the HTTP discovery fixture; 36147791257 exposed the withdrawn inference's native augmentation regression. Failed heads were not rerun unchanged, and no merge request was submitted against them.

A separate historical macOS Canvas control had 298/300 passing cases in its original group and 7/10 alone, with timeout, stale-config, and coordinator-scope failures. Their cause remains unproved. Those logs and the limitation are retained; no Canvas assertions or deadlines were changed.

The confirmed unit's disable result does not establish that no other
canonical or legacy user unit remains. Consult the existing scoped
installation discovery passively after cleanup and report remaining or
unverifiable state without deleting another unit.

Keep the successful removal distinct from a later inspection failure, and
limit clean wording to the supported matching installed-unit search.

Add causal Doctor-boundary regressions for a surviving alias and failed
post-cleanup inspection. Native transport and uninstall are mocked; the
selected synthetic file is actually removed and legacy bytes stay intact.

Follow-up to #119674.
@clawsweeper

clawsweeper Bot commented Sep 25, 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 commands Command implementations size: S labels Sep 25, 2026
@steipete
steipete marked this pull request as ready for review September 25, 2026 09:18
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 25, 2026, 11:31 AM ET / 15:31 UTC (Revision 6).

ClawSweeper review

What this changes

The branch makes Doctor report surviving Linux user units after confirmed cleanup and carries related service, provider-discovery, and test changes.

Merge readiness

⛔ Blocked before merge - 4 items remain

Current main still claims the system unit is the sole Gateway manager after removing one user unit. This PR addresses that reporting error while keeping removal bound to the confirmed unit. Its earlier provider-catalog compatibility concern no longer applies to the current branch.

Priority: P2
Reviewed head: 0b4a988df8240c533bb17d1e05023884004caa85

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The narrowed patch has focused regression coverage and no identified blocking code defect, while the required installed-flow proof remains outstanding.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its Doctor-entrypoint cases exercise synthetic unit files and reported results with mocked systemd transport and uninstall; they do not establish the repository-required published-updater × candidate Linux result. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its Doctor-entrypoint cases exercise synthetic unit files and reported results with mocked systemd transport and uninstall; they do not establish the repository-required published-updater × candidate Linux result. No stored-data contract changes.
Evidence reviewed 8 items Current-main defect: Main reports the system unit as the sole Gateway manager when the selected unit's uninstall result says it was disabled; that result does not account for another installed user alias.
Proposed Doctor boundary: After the existing target-bound uninstall, Doctor passively rediscovers units and distinguishes a remaining user unit, a scoped clean result, and an unverifiable result.
Discovery owner: The existing systemd owner checks candidate user-unit files, then returns user, system, dueling, or none; Doctor reuses this scoped result.
Findings 1 actionable finding [P3] Report the cost of the new Doctor cases
Security None None.

How this fits together

On Linux, Doctor reads systemd service identities before offering to remove a duplicate user unit. The proposed change reads service state again after that removal and reports what remains.

flowchart LR
  A[Selected profile] --> B[Systemd unit discovery]
  B --> C[Identity and ownership check]
  C --> D[Operator confirmation]
  D --> E[Confirmed unit removal]
  E --> F[Read remaining units]
  F --> G[Doctor result]
Loading

Before merge

  • Report the cost of the new Doctor cases (P3) - These two new cases add per-PR CI work, but the PR gives passing-case counts without their measured cost. Root AGENTS.md requires the focused test-file wall time and CI seconds once the current-head run exists; add those figures to the PR evidence.
  • Resolve merge risk (P1) - The required published-updater × candidate Linux systemd cell has not exercised this post-cleanup report; the supplied Doctor cases mock native transport and uninstall.
  • Complete next step (P2) - Add a redacted published-updater × candidate Linux systemd trace reaching the post-cleanup report, and record the new Doctor cases’ measured wall and CI cost.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P3] Report the cost of the new Doctor cases — src/commands/doctor-gateway-dueling.identity.test.ts:375-377
Agent review details

Security

None.

PR surface

Source +23, Tests +202, Docs +3. Total +228 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 4 66 43 +23
Tests 6 235 33 +202
Docs 2 6 3 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 307 79 +228

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-gateway-dueling.ts, unknown-data-model-change: src/commands/doctor-gateway-dueling.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep removal limited to the confirmed unit, then report a surviving scoped user unit or an unverifiable inspection without claiming global service exclusivity.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep removal limited to the confirmed unit, then report a surviving scoped user unit or an unverifiable inspection without claiming global service exclusivity.

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

Yes, at the source and synthetic Doctor boundary: current main makes the sole-manager claim after one selected removal, and the PR supplies two cases with a surviving alias. I did not execute the cases or a live systemd run.

Is this the best way to solve the issue?

Yes. Reusing scoped discovery after the existing confirmed removal is a narrow repair that adds no deletion authority.

Full review comments:

  • [P3] Report the cost of the new Doctor cases — src/commands/doctor-gateway-dueling.identity.test.ts:375-377
    These two new cases add per-PR CI work, but the PR gives passing-case counts without their measured cost. Root AGENTS.md requires the focused test-file wall time and CI seconds once the current-head run exists; add those figures to the PR evidence.
    Confidence: 0.92

Overall correctness: patch is correct
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

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

Label justifications:

  • P2: This corrects misleading Doctor output after a limited Linux service-cleanup case.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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 member-authored PR is exempt from the external-contributor proof gate. Its Doctor-entrypoint cases exercise synthetic unit files and reported results with mocked systemd transport and uninstall; they do not establish the repository-required published-updater × candidate Linux result. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Sebastien Tardif: Raw commit d8b5ea0 adds src/commands/doctor-gateway-dueling.ts:110 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d8b5ea001701; files: src/commands/doctor-gateway-dueling.ts)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Show a redacted published-updater × candidate Linux systemd run that reaches the post-cleanup Doctor report.
  • Record the focused Doctor test wall time and current-head CI seconds in the PR.

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-09-25T09:24:35.954Z sha 2fe6fcf :: blocked before merge. :: none
  • reviewed 2026-09-25T11:58:20.512Z sha d3825c3 :: blocked before merge. :: none
  • reviewed 2026-09-25T14:14:23.203Z sha 8322ec3 :: blocked before merge. :: none
  • reviewed 2026-09-25T14:37:35.535Z sha 432526c :: blocked before merge. :: none
  • reviewed 2026-09-25T15:01:57.205Z sha 432526c :: blocked before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Data-model disposition for 2fe6fcf1e87392afe76a69b9adc5927c11cc1ad7: this patch introduces no schema, serialization, configuration-key, retention, or migration change. The existing uninstallUserSystemdGatewayUnit owner and its confirmed-target arguments are unchanged. The added operation is a passive findSystemdGatewayInstallation read (requireLoaded: true, no loading grant) and a scoped human-readable result.

The regression actually removes the selected synthetic file, verifies the surviving alias's bytes remain identical, and checks that a failed follow-up read is reported separately from successful cleanup. The published updater's existing in-progress marker still defers service repair before this branch, as the review also verifies. The prior documented no-dueling updater flow likewise exits before it.

The path-based Doctor/repair classification therefore does not identify a new stored-data contract needing migration proof here. No new live-systemd or rebuilt-package result is claimed; the 155 focused cases, full changed-file checks, and managed review support this reporting-only correction. Normal CI and merge gates remain required.

@steipete

Copy link
Copy Markdown
Contributor Author

Hosted CI 36117727204 completed with one failed test job plus its aggregate gate. The failure is in the unchanged config-preflight cohort: job 108017066985, doctor-config-preflight.pending-read.test.ts, “reuses Doctor's readonly child for pending records and discovery, then joins it,” expected one child process and observed two (299 other cases passed).

The tested merge was 1f370f310b74f0116121dbdff0795d826831b225; the failing file is byte-identical to this branch's main baseline. An existing maintainer investigation owns the reader-versus-staging-child attribution and is comparing its qualified fixture correction against this exact preimage. The actual two-child result is retained; no specific cause is claimed for this run yet.

No unchanged-head rerun or auto-merge request was submitted. The alias-reporting source remains at the reviewed 2fe6fcf1e87392afe76a69b9adc5927c11cc1ad7, with its local causal proof and checks intact. I will consume the canonical correction or disposition through the normal gates.

Reuse the canonical startup pending-read correction while preserving selected-unit reporting and cleanup scope.

(cherry picked from commit 9b90a98)
Compose the qualified catalog correction from #158113, including explicit static and advisory outcomes and exact auth-provenance expectations. Include its existing first-discovery retention prerequisite; preserve the independent Doctor reporting change.

Canonical commits: aef8743, 5d9c2d7, 36def8b.
@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. 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. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 25, 2026
Preserve the landed Doctor mock lifetime cleanup while composing the catalog loader type leaf and generated non-live catalog outcome correction. Reader and staging assertions, strict live discovery, and custom callbacks remain unchanged.

Canonical commits: cbff337, 9adf333, 4f1acb7.
Restore the task-created catalog changes to fixed canonical main168d454d while preserving scoped outcome handling from #158139 and the real HTTP fixture correction from #158115. Keep the service-reporting repair and canonical pending-read assertions unchanged.

The previous inference changes introduced a compatibility and native augmentation regression. Their failure history remains documented; the separate legacy-retention repair is not a dependency of this feature.
@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer disposition for current head 0b4a988df8240c533bb17d1e05023884004caa85:

The inferred-ready catalog design reviewed on the earlier head has been withdrawn. Provider configuration alone is no longer promoted to a live outcome, and the catalog paths match fixed canonical main 168d454d. The branch retains the already-landed #158139 scope handling and #158115 HTTP fixture correction. The separate legacy-retention repair is not a dependency here.

The earlier merge conflict is resolved with the exact landed #158074 mock-lifetime cleanup; every reader, staging, and settlement assertion remains. GitHub reports the current head mergeable.

The original systemd mutation/identity/update owners are unchanged. The earlier source-backed update/data-contract disposition still applies: this is scoped completion reporting after one confirmed removal, not a new stored-data format or broader cleanup operation. The regression proof uses synthetic unit files with mocked native transport/uninstall; no new installed-package or live-systemd proof is claimed.

After withdrawal, 100 direct catalog/auth/scope cases pass, including the unchanged native-worker assertion that failed on the detour. Selected checks and fresh managed P2 review pass. The local freshness runtime-build refusal remains explicitly unrun; its landed qualification and current-head hosted CI provide that coverage. CI 36153767777 must pass the normal landing gate. Earlier failed runs remain recorded and were not rerun unchanged.

@steipete
steipete enabled auto-merge (squash) September 25, 2026 15:36
@steipete
steipete merged commit 07c9eb1 into main Sep 25, 2026
211 of 226 checks passed
@steipete
steipete deleted the codex/doctor-alias-cleanup-20260925 branch September 25, 2026 15:42
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…58034)

* fix(doctor): report remaining systemd units after cleanup

The confirmed unit's disable result does not establish that no other
canonical or legacy user unit remains. Consult the existing scoped
installation discovery passively after cleanup and report remaining or
unverifiable state without deleting another unit.

Keep the successful removal distinct from a later inspection failure, and
limit clean wording to the supported matching installed-unit search.

Add causal Doctor-boundary regressions for a surviving alias and failed
post-cleanup inspection. Native transport and uninstall are mocked; the
selected synthetic file is actually removed and legacy bytes stay intact.

Follow-up to openclaw#119674.

* test(doctor): distinguish readers from staging workers

Reuse the canonical startup pending-read correction while preserving selected-unit reporting and cleanup scope.

(cherry picked from commit 9b90a98)

* fix(models): integrate canonical discovery provenance repair

Compose the qualified catalog correction from openclaw#158113, including explicit static and advisory outcomes and exact auth-provenance expectations. Include its existing first-discovery retention prerequisite; preserve the independent Doctor reporting change.

Canonical commits: aef8743, 5d9c2d7, 3cb4c86.

* fix(ci): finish canonical catalog and Doctor integration

Preserve the landed Doctor mock lifetime cleanup while composing the catalog loader type leaf and generated non-live catalog outcome correction. Reader and staging assertions, strict live discovery, and custom callbacks remain unchanged.

Canonical commits: a9db992, 9adf333, 4f1acb7.

* fix(ci): withdraw catalog inference detour

Restore the task-created catalog changes to fixed canonical main168d454d while preserving scoped outcome handling from openclaw#158139 and the real HTTP fixture correction from openclaw#158115. Keep the service-reporting repair and canonical pending-read assertions unchanged.

The previous inference changes introduced a compatibility and native augmentation regression. Their failure history remains documented; the separate legacy-retention repair is not a dependency of this feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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