Repository navigation
fix(update): release the Bun updater lease around service-manager starts (#5760) - #6407
Conversation
…rts (#5760) withUpdateOwnershipLease held the mutation lease across 'ocx service repair' in both the stopped-runtime recovery branch and the post-install refresh. The manager's 'ocx start' child is not a process descendant and carries no delegated token, so it died at the acquire deadline; recovery then fell through to an unmanaged direct start beside a dead supervisor — the same defect bin/ocx.mjs fixed in 4449334, left unfixed here. The transaction now exposes release()/reacquire(): the lease is released immediately before each service-manager-mediated start and re-acquired before each fallback's ownership re-read, so a claim landing in the unleased window is vetoed rather than killed unleased (bounded acquire fails closed). Direct recovery keeps the lease as before. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/0 boxes ticked. Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked. |
…90863745-bun-update-lease-release
…90863745-bun-update-lease-release
…f re-running recovery
|
Maintainer integration record (MAINTAINERS.md, dev-only)
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc10a2690b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // cannot join this lease, and holding it through the repair's health wait | ||
| // keeps that proxy from starting (#5760). Release it, then decide again — | ||
| // a claim could have landed while the repair ran unleased. | ||
| mutation.release(); |
There was a problem hiding this comment.
Keep ownership fenced until service repair rechecks it
When a desktop takeover races with either newly unleased service-refresh path, it can commit immediately after repairService reads the CLI owner but before that function stops, rewrites, or restarts the manager, because service repair does not itself hold the ownership-mutation lease. The manager child’s later ownership gate can prevent a second listener, but it cannot undo the service-registration mutations performed after the takeover; the fallback-only reacquisition is also too late. Keep the lease through the repair’s final ownership validation and registration work, releasing it only at the manager-start boundary that needs an independently acquiring child.
Useful? React with 👍 / 👎.
| direct start stay serialized with a claim that landed in the unleased window. The dashboard | ||
| restart worker in `src/update/job.ts` releases the lease immediately before `ocx service | ||
| repair`, re-acquires it at the direct-start fallthrough — a still-claimed lease fails closed — | ||
| and re-runs the recorded-owner veto under it before mutating the port. |
There was a problem hiding this comment.
Remove the unsupported dashboard lease claim
At this commit, runUpdateRestartWithOwnershipLease still acquires the lease, installs its token in process.env, awaits the entire dashboard restart callback, and releases only in finally; src/update/job.ts invokes service repair inside that callback and has no release/reacquire handle. Therefore the new statement that the dashboard worker releases before repair and reacquires before fallback is false, and it hides that the dashboard path can still block the manager child and fall back to a directly started proxy. Update the implementation or limit this contract to behavior that actually exists.
AGENTS.md reference: structure/AGENTS.md:L9-L10
Useful? React with 👍 / 👎.
Summary
Verification
Refreshed from
devat06cc3815c06a10120d89ef986c46be95be37f28awithout rewriting branch history, including the accepted upstream role-route and owner-registry ACL fixture corrections. Targeted verification: role routes 7 passed; owner-registry ACL 6 passed. Required CI passed at70a8b6caff76c840ad37df4bc0e97e53b44f7ecd: zero failed and zero pending checks (platform/path-inapplicable checks remain skipped).bun x tsc --noEmit,bun run privacy:scan,bun run structure:check: passed.bun test tests/update/update-bun-ownership-lease.test.ts: 3 passed, 11 POSIX-only cases skipped on Windows. New subprocess checks verify release, reacquisition, and stale-token fallback; source-order checks cover both service refresh call sites.bun test tests/update/update-desktop-owner.test.ts: passed.POSIX integration assertions were updated for the intentionally released service-refresh boundary but were not executed locally; the latest POSIX CI passed.
A broad local
test:changedrun on the sibling branch reported 2274 passes and 428 failures, including EBUSY cleanup failures and worker panics. Without a base comparison these are not classified as unrelated. Focused checks and the latest required CI passed; the broad local Windows result remains inconclusive.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Link to Devin session: https://app.devin.ai/sessions/a8795b27d4114aa6be37a88565e404b2
Open in Devin Desktop: https://app.devin.ai/desktop/session/a8795b27d4114aa6be37a88565e404b2?variant=devin
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.