Repository navigation
fix(doctor): explain surviving service processes during maintenance - #146865
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 13, 2026, 10:09 AM ET / 14:09 UTC (Revision 5). ClawSweeper reviewWhat this changesClarifies Doctor and update maintenance errors when a stopped Linux Gateway leaves child processes behind, with recovery documentation and regression coverage. Merge readiness⛔ Blocked before merge - 1 item remains Keep open as a useful, focused diagnostic fix. No actionable correctness or security findings remain. The earlier migration-proof blocker is unsupported: this patch changes no stored data model or upgrade behavior. Priority: P3 Review scores
Verification
How this fits togetherDoctor and update inspect the managed Gateway before maintenance. The shared service-maintenance layer turns systemd runtime observations into admission decisions and operator-facing recovery messages. flowchart TD
A[Doctor or update] --> B[Inspect Gateway service]
B --> C[Systemd runtime facts]
C --> D{Main process stopped with remaining tasks?}
D -->|Yes| E[Explain remaining processes]
D -->|Other unavailable state| F[Existing inspection guidance]
E --> G[Maintenance remains blocked]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +37, Docs +6. Total +55 across 3 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the existing shared admission owner and surface the observed residual tasks without changing shutdown, recovery, or database protections. Do we have a high-confidence way to reproduce the issue? Yes, from source: an inactive or failed systemd unit with no main PID and positive TasksCurrent reaches the generic unavailable diagnostic on current main. The supplied native observation corroborates that input; this review did not execute it. Is this the best way to solve the issue? Yes. Selecting clearer text in the existing presentation owner is the narrow repair, and the boundary tests preserve the unavailable/no-stop contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 697bce4c40a5. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
@clawsweeper re-review Added explicit data-model and upgrade compatibility evidence to the PR body for head |
|
🦞👀 Re-review progress:
|
3d05621 to
ae06e21
Compare
|
Rebased onto current main to resolve the existing sidebar deferred-helper failure (#146862) and the upstream test-shard capacity failure. New head: The Doctor patch is unchanged ( |
|
@clawsweeper re-review Please review current head ae06e212904d0f2acd045f51e4e9cc83cb563668. The previous review was superseded during the CI repair rebase. The PR body contains the data-model compatibility evidence, and the latest validation comment records 133 passing focused tests. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper explain The current-head review for Please reconcile this contradiction against the already-reviewed diagnostic-only diff and compatibility evidence. If a deterministic gate cannot consume the review's explicit no-persistence-change conclusion, identify that gate and the supported way to clear this false positive; do not change or bypass merge governance. No merge requested. |
|
🦞👀
|
|
@clawsweeper can you reconcile the current review's compatibility conclusion with its generated blocker? This is a read-only review request for head No migration is required. Existing state compatibility is verified by the unchanged admission and lifecycle code, the diagnostic-only production diff, and passing existing maintenance-entry tests for shipped handoff records, manager identity, and recovery behavior. The 133-test focused run on this exact head passed. The isolated systemd observation proves the residual-task input is reachable; we do not claim a full live update or database migration run. Your current review explicitly agrees that the earlier compatibility blocker is cleared, but its generated checklist still says it is missing. Please evaluate the supported no-migration-required case and record the evidence consistently. If the report generator prevents that despite the evidence, report that limitation explicitly rather than inventing a code change or bypassing any gate. |
|
🦞👀 I queued a lightweight read-only assist pass. It will post a separate answer comment and will not edit the durable ClawSweeper review comment or trigger close, merge, repair, label, or branch changes. Request: can you reconcile the current review's compatibility conclusion with its generated blocker? This is a read-only review request for head |
|
ClawSweeper assist: The supplied diff supports no migration required: the only production change adds diagnostic text using existing runtime facts. It changes neither persisted state nor admission or lifecycle behavior. A migration-run requirement is therefore unsupported by this diff. The remaining compatibility blocker conflicts with that evidence and the review conclusion you describe. However, the supplied review projection omits the narrative conclusion, so I can confirm the retained blocker—not independently verify the narrative or identify the generator gate responsible. Evidence:
Suggested next action: Use Source: #146865 (comment) |
|
@clawsweeper review Please reconcile the compatibility assessment and generated checklist for head The assist independently confirms that a migration-run requirement is unsupported by this diagnostic-only diff. No migration is required. Existing state compatibility is verified by unchanged persistence, admission, and lifecycle code, plus the existing maintenance-entry compatibility regressions in the 133 passing focused tests. Explicitly record the supported no-migration-required disposition in the review evidence, or explain the precise report-generator limitation if that disposition cannot be represented. Preserve the stated proof limits: native systemd input observation and maintenance-entry tests, with no claimed full live update or database migration run. For the contradiction itself, the durable review says “the earlier migration/upgrade compatibility blocker is cleared” while its Before merge checklist still requires that proof: #146865 (comment). No merge or governance bypass requested. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
ae06e21 to
faac670
Compare
|
Rebased to include upstream #147029 after its settings-storage child-process deadline failure reproduced in both CI attempts. Current head: @clawsweeper re-review Please refresh the review for this new head. Prior reviews and assist confirmed no correctness/security findings and no migration required; only the generated compatibility checklist contradicted that conclusion. The PR body retains the compatibility evidence and proof limits. No merge requested. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Validation complete for
Remaining bot limitation: that same review's generated checklist still marks migration proof as missing, contradicting its assessment. ClawSweeper's assist independently confirmed that the migration-run requirement is unsupported by this diagnostic-only diff: #146865 (comment). Fresh reviews preserve the contradiction. The report generator's |
…penclaw#146865) Co-authored-by: VACInc <[email protected]>
Summary
High Level TLDR
Doctor and update maintenance report that service inspection is unavailable when a stopped Linux Gateway still has child processes in its systemd cgroup. Name those remaining tasks and the recovery action instead. Maintenance stays blocked.
What Problem This Solves
Fixes misleading service-ownership guidance after a Gateway main process exits but its child processes survive shutdown, for example when a user service cannot terminate a child owned by another account.
User Impact
Operators can identify and settle the remaining children instead of troubleshooting working service-manager access. This is a diagnostic-only change: it does not kill processes, relax offline admission, restart services, change configuration, or permit SQLite maintenance with surviving children.
Why This Change Was Made
Root Cause
Introduced with the loaded-runtime admission path in #140339, commit
000af986dc991e9cef3d10663c121503606f25cc. Its parent classified inactive/failed systemd units as stopped. The new authenticated runtime reader correctly returnsunknownwhen the main PID is zero but cgroup tasks remain. The shared Doctor/update policy then selects the generic service-inspection-unavailable message, even though inspection succeeded and returned the blocking facts.On the original tested base
65c8b06f2e42f4788d45da3b5573a761ddaf58fd, reproduce with an isolated user service containing a surviving sleep child: systemd reportsActiveState=inactive,MainPID=0,TasksCurrent=1; the real loaded-runtime reader reportsstatus=unknownwith the observed manager UID and task count. This is reachable in stock upstream and does not require a PR overlay.The presentation owner now recognizes the terminal native state, missing main PID, and positive task count. Existing native inspection reasons retain precedence; transition states and unavailable task counts retain the generic diagnostic.
Evidence
Real behavior proof
An isolated transient systemd user unit used
Type=oneshot,RemainAfterExit=yes, andKillMode=process, with a backgroundsleepchild. After stopping that test unit,readLoadedSystemdServiceRuntimereturned:{"status":"unknown","state":"inactive","subState":"dead","systemd":{"tasksCurrent":1}}The test child was then terminated and the unit's tasks disappeared. The production Gateway was not stopped or modified for this proof.
Two new maintenance-entry regressions failed on the original code because they received the generic inspection error. With the patch, failed/inactive units with remaining tasks receive the specific child-process message, while admission remains unavailable and no service stop occurs. Negative cases preserve the generic message for transitional state and missing task accounting.
Verification
TS2305errors inui/src/components/app-sidebar.background-scope.test.ts:13andapp-sidebar.catalog-scope.test.ts:11. Both importdeferredfromui/src/test-helpers/app-sidebar.ts, whose export was removed by base commitb778633e58f(refactor: reuse shared deferred promises in UI tests #146670). All three files are identical to the base in this candidate. Checks scheduled after that aggregate failure were not all run; focused lint was run separately and passed.Data-model and upgrade compatibility
This patch changes no stored data model. The production diff only adds a diagnostic branch inside
serviceInspectionBlockMessage; it returns text from already-observed service runtime facts. No schema, SQL, migration, backfill, serialized state, config shape, service definition, or persistence writer changes. No data conversion or new migration is required.Compatibility is preserved for existing installations and installed update drivers: the same maintenance entry point and unavailable verdict remain in place. Existing tests cover shipped managed-service stop records, manager identity changes, and Windows recovery. All 120 current-head focused tests passed. The new regressions explicitly retain the unavailable verdict and assert that service stop is not invoked; absent task accounting and transitional states retain their old diagnostic. Native process-drain and database-integrity gates are untouched.
The detector's
migration/backfill/repairclassification is based on the maintenance file's role; it does not describe a persistence change in this diff. Full live update execution remains unclaimed.What was not tested
No production Doctor mutation, Gateway restart, or full update was run to validate this diagnostic-only patch. A full published-driver update matrix and cross-platform live runs were not performed. The Linux fixture plus maintenance-entry regressions cover the changed reporting boundary; existing shutdown and integrity requirements are unchanged. No startup or update latency improvement is claimed.
CI repair update
Rebased without changing the diagnostic patch onto
1311b4242dae9f4995bbe0881ed4278ad61c5c2d. This includes the merged sidebar helper repair (#146862), upstream test-shard capacity, and settings-lock test startup repair (#147029). The prior head failed the unrelated settings-storage contention tests twice in CI despite passing locally; #147029 repairs their child-process deadline ownership. No test weakening or retry loop was added by this PR.git range-diffconfirms the diagnostic patch is unchanged.Current head:
faac6708b10c584bcdba9186ccaf22736d7638a7. All 120 focused tests pass. Current-head CI passed. The live PR rollup has 173 successful checks, no pending checks, and no failures.