Repository navigation
fix(update): verify launchd job identity during handoff - #188226
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 maintainer review before merge. What this changesThis PR shares the selected launchd job parser with the update helper and preserves complete, bounded inspection output. Example: The selected job has root PID 4243, but its nested coalition reports the expected parent PID 4242.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a current-main identity-checking defect, and no actionable introduced defect remains. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe detached update helper consumes launchctl inspection output and the current update lease to decide whether it may park or restore the selected Gateway service. flowchart TD
A[Managed update request] --> B[Detached helper]
B --> C[Current lease owner]
B --> D[Bounded launchctl inspection]
D --> E[Shared selected job parser]
E --> F[Identity and authority checks]
C --> F
F --> G[Park or restore service]
Technical reviewBest possible solution: Land the shared-parser repair through the existing update owner once the normal exact-head gates pass. Do we have a high-confidence way to reproduce the issue? Current main's flat expression can select a nested PID before the root PID; supplied generated-helper cases exercise that input, although no target code was executed during this review. Is this the best way to solve the issue? The smallest complete fix is to reuse the existing selected-job parser, preserve its complete bounded input, and terminate invalid-identity recovery without retrying through the outer failure handler. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 90b573403ad2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +25, Tests +318. Total +343 across 16 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 30, 2026, 1:13 PM ET / 17:13 UTC (Revision 3). |
4b7c311 to
59003b5
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
) * fix(update): verify launchd job identity during handoff * fix(update): retain complete launchd inspection identity * test(update): reject stale launchd lease after inspection Co-authored-by: Vincent Koc <[email protected]>
What problem does this PR solve?
The update helper extracted launchd state and PIDs with flat regular expressions. Nested coalition data or a foreign job could be mistaken for the selected service generation and authorize recovery.
User impact
Managed updates inspect the selected launchd job consistently with daemon commands. Ambiguous or oversized inspections refuse recovery with a visible diagnostic.
Why this change?
Move the existing pure job parser to one shared owner; use it in daemon callers and the captured helper. Remove the helper's duplicate flat parser. Invalid recovery identity remains a terminal refusal.
Retain complete
launchctl printstdout up to 1,048,576 characters; refuse overflow without discarding native stderr. Other command tails remain unchanged. The helper captures the parser before package replacement and requires no new export from an older installed runtime. The recovery-source split is byte-identical.Production +25 lines; tests +318 lines, 16 files. Growth supplies complete bounded inspection and the shared ownership contract. No config, schema, protocol or public SDK change.
Validation
6f68371b376e0d2cc8127a4148288ee4605279fd. The final commit adds only generated-helper proof and extracts existing test preload setup to respect the fixture line cap. Production bytes are unchanged from59003b5c3dacb5b3da00a2e401d183d780a2e3c3.print → disable → bootout → enable → bootstrap/kickstart → printand restored readiness. Four wrong-parent/nested-parent/foreign-job/duplicate-PID cases record only the selected-target inspection, with no mutation. Six malformed-restoration cases refuse before readiness; both 9,000-character framing cases recover successfully.store.bind, verifies the captured generation is stale and the replacement is owned, then forwards the original native close arguments. Assertions require onlyprint, a live parent, empty manager state, no updater, and preservation of the replacement until canonical cleanup after helper close. No mocked authority, fabricated lease rows, cancellation override or process-signal override is used.launchctl, not macOS launchd; macOS execution is not claimed. The unchanged universal pre-spawn lease guard remains atsrc/infra/update-managed-service-handoff-command-source.ts:6. Earlier lease-loss coverage used a mocked-authority Scheduled Task VM case and a real repair claim; the new generated launchd generation-invalidation case passed current CI. This PR does not change lease ownership or dispatch authorization.[email protected]authenticated restart. The targeted job passed its lane in 1,489 seconds. Frozen admission binds SHA59003b5cto package SHA-256e6fbd7669650df5a9e209de3e070fd1b7a15a50927afda56549b6976d54dff8c.No local dependency-backed execution or live operator service mutation is claimed.