Repository navigation
fix: protect live Gateways sharing an update installation - #160663
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: needs real behavior proof before merge. Reviewed September 29, 2026, 3:38 AM ET / 07:38 UTC (Revision 10). ClawSweeper reviewWhat this changesThe branch checks for live managed Gateways sharing an installation before updates publish files, extends macOS service observation, and coordinates update recovery with service restoration. Merge readiness⛔ Blocked before merge - 6 items remain Keep open. Current main does not protect package and source publication from a live Gateway sharing the installation, and this focused branch has meaningful work. The remaining blocker is native proof of the service authority boundary. Priority: P1 Review scores
Verification
How this fits togetherThe update CLI stages a package or Git candidate and checks which managed Gateway services use the target installation before replacing files. Finalization then uses Doctor stop records to decide whether to restore the selected Gateway. flowchart LR
A[Update request] --> B[Target installation]
B --> C[Managed service inventory]
C --> D{Live sibling shares files?}
D -->|Yes| E[Refuse before stop]
D -->|No| F[Publish update]
F --> G[Doctor and service recovery]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The diff adds no dependency or workflow execution change, but native service restart authority still needs final-effect proof. PR surfaceSource +686, Tests +1716, Docs +18, Other -3. Total +2417 across 39 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the stop-first publication fence and unified Doctor-stop recovery, then qualify the native final effects for a live System-domain sibling and for current versus stale selected-service authority. Do we have a high-confidence way to reproduce the issue? Yes. Two managed Gateways sharing one physical installation provide a concrete path, and current-main source lacks the branch's shared-consumer publication check; this read-only review did not execute the failure. Is this the best way to solve the issue? Yes in principle. The update and service owners are the appropriate boundaries for the guard and restoration, with native final-effect proof still needed before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b4ae783fbfd2. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
Use the retained publication owner to disarm and retire a known pre-effect refusal, allowing the next update to enter. Preserve recovery evidence on unknown cleanup or a foreign replacement, including both failure causes. Receive the real fence dependency into declaration fixtures without invalidating relocation cache identities, and keep legacy refusal assertions aligned with the all-artifact diagnostic.
Check known shared consumers before stopping the selected Gateway and retain the publication recheck. Adopt delegated Doctor stops in common finalization, preserve partial-stop failures, and keep uncertain recovery fenced. Update the native-reader fixture and document maintenance restoration.
Keep the native loaded command and PID available for shared-install publication refusal when the discovered plist differs. Selected-service correspondence still requires the exact current definition and grants no control over the other job. Four causal regressions, 252 sibling cases, receiving 24 cases, scoped types/lint and independent review passed. Native synthetic GUI jobs preserved loaded identity across mismatched queries, refused selected correspondence, and retired cleanly.
Related: #150153
What Problem This Solves
Fixes package and source updates replacing a shared installation while another managed Gateway is still serving it.
User Impact
An observed live sibling blocks the update before the selected Gateway is stopped. The updater rechecks at artifact publication. Operators stop siblings through their own service managers or exact Startup entries; this updater does not control them.
Package
--no-restartpermits publication while the selected service runs. The Gateway's installation-change watcher can independently restart it. If delegated Doctor maintenance stops it, common finalization adopts that recorded stop, verifies the service identity, and restores it with an advisory. Unknown current identity keeps recovery pending; cleanup uncertainty and lost authority cannot grant a restart.Discovery covers installed managed-service definitions and the invoking selector. It does not establish absence of every foreground process or undiscovered systemd template instance. Already-running published updaters retain their shipped behavior.
Why This Change Was Made
The existing build fence protected
distwrites, but artifact publication also replaces dependencies and other installation files. The common publication boundary checks positively identified live consumers of those physical roots while retaining selected-service authority. On macOS it reads the loaded definition in the appropriate GUI or System domain. A running job remains visible when its loaded plist differs from the discovered file; the separate selected-service exception still requires an exact corresponding definition.The maintainer decision is to retain manual sibling control: its operator stops the service before publication and restarts it after success through that service’s own manager. This implements the authorized stop-first scope of #150153.
Native proof exposed three related lifecycle defects. Staged settlement replayed an already-delivered refusal; an untouched activation journal blocked a later update; and runtime retention hardlinked that private journal. The existing owners now preserve the original refusal, retire only known pre-effect preparation, and exclude activation control state from runtime dependencies. Retirement applies to the same invocation's retained prepared operation, before transaction handoff or live mutation. Journal schemas and existing pending-journal admission are unchanged; foreign replacements, unknown cleanup, and separate database recovery evidence remain protected.
An earlier run published successfully but left the selected Gateway stopped: delegated Doctor wrote a stop receipt that only migrated finalization consumed. Ordinary and migrated finalization now share that existing adoption owner. Observed partial stops survive later joined errors, and recovery uses the established failure/result path. A predecessor stop is considered recorded only when the existing writer returns the same running run with its completed receipt. Receipt failures and uncertain process cleanup propagate before Doctor; ordinary joined later failures retain their existing warning behavior.
Evidence
The composed recovery source passed 211 tests across seven files in 156.81 seconds, including pre-stop refusal, the final publication race check, selected identity, ordinary/migrated stop adoption, partial-stop failures, unknown inspection, authority loss, and terminal settlement. Causal failures preceded their repairs. Production and 26 test type graphs, export scans, lints, structural guards, and independent P2 review passed.
The final macOS correction removes a three-line false-absence branch. Four causal mismatch cases failed before the correction; 252 sibling cases passed with one existing skip, and the exact receiving table passed 24/24 in 36.56 seconds. Scoped types/lint/format and fresh independent P2 review passed. Final source:
1cf29ef534a10873dc44d357e7db5b519bce0815, incorporating fixed canonical mainbb869836e98ba61610cc2033e60f9685832f49dbafter an actual retained-runtime test conflict. Both regressions are preserved.Fixed-main receiving passed 244 tests across nine files in 361.91 seconds. Review then identified two predecessor-stop settlement defects; the real producer/ledger and actual Doctor-entry regressions failed before repair. The repaired boundary suites passed 104 cases, followed by seven final affected controls, scoped lint/format and fresh P2 review. Type qualification combines 20 unchanged graphs with final production, affected CLI and six remaining graphs; the initial fixture type error remains recorded. The full fixed-base changed checks and final correctly scoped line-cap ratchet passed. Isolated migrated/rollback process suites: passed 78/78 on the signed
4cb4a243production checkpoint in isolated run36533171811, with runtime preparation and natural settlement (225.91 seconds for the test wrapper).Native macOS GUI component proof verified that querying another plist retains the actual loaded job's PID/start identity/path/arguments while selected correspondence refuses. Edited-definition and generated-wrapper checks also passed. Eight native commands joined; both synthetic jobs and processes retired, and the scratch directory was removed. This is component evidence. A prior System-domain observation had no running PID, and isolated guest execution was unavailable; positive-live System-domain proof remains unqualified.
Linux proof used the independently verified
307a594a281735de81ec00d170c67d0f4ba3fefdtree and its authenticated packed candidate. The earlier macOS-only successor left Linux owners unchanged. The final composition additionally incorporates canonical recovery owners and the scoped predecessor error-path repair, with receiving proof above. The native observations apply to their inspected paths; they are not a claim that the final merged binary or package archive is identical.[email protected]to candidate: the maintained base survivor scenario passed in manual-restart mode in 330.284 seconds, including updater installation, package identity, migration/preservation, post-update Doctor, Gateway start, health, readiness, and status. The bounded report lacks a complete internal post-core exit snapshot; it does not qualify that internal delegation or the native managed-parent restart path.The Linux source-bound run is 36523514530. The failed maintenance attempt and two independent continuations have separate authenticated archives:
a5689ca7afc5b05bc483c5e0b60218fdd4caadc485f2e95c366c09ec3673ca0e,eea4f587740084092153f4a83372766fdeadb7c1b881719113deac0da945090c(disjoint), and320be7de014a12eeb4433d0dac56452218155715890c121d5cb73657047b2bef(published manual upgrade). Every command joined; the guest is completed. Earlier journal, hardlink, unhealthy-Gateway, and observer-bootstrap failures remain preserved.A later CI run on
4cb4exposed one introduced fixture-intake omission: the explicit VM module graph did not load the adoption owner now called by common finalization. The two-line correction loads both actual production owners, preserving all 19 backup-retirement/verification assertions and deadlines. The original 9 failures became 19/19 passes; the exact Vitest wrapper, scoped lint/format and fresh P2 review also passed. Production bytes are identical to the fully qualified4cb4checkpoint.CI on
307afailed on an unchanged canonical Cron fixture'sno-map-spreaddiagnostic; 112 cancelled jobs remain unrun coverage. The canonical fix is743c2ceb72e7d1372845ea6f834bb82993fc9e0e, independently verified with typed lint and ten owning tests. No introduced failure is waived. Successor CI is pending.This PR does not claim automatic Windows 9.3/9.4 completion, unchanged-generation
--no-restartcontinuity, positive-live macOS System-domain proof, or completion of the umbrella's separate reference-script and foreground-process obligations. Published 9.6's same-schema managed parent has a distinct post-core authority limitation; changing candidate common finalization does not patch that in-memory parent.