Skip to content

Fix updater restart inside Windows launcher jobs#5778

Open
linmumua wants to merge 1 commit into
wailsapp:masterfrom
linmumua:upstream-updater-windows-job-handshake
Open

Fix updater restart inside Windows launcher jobs#5778
linmumua wants to merge 1 commit into
wailsapp:masterfrom
linmumua:upstream-updater-windows-job-handshake

Conversation

@linmumua

@linmumua linmumua commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • launch the Windows updater helper with CREATE_BREAKAWAY_FROM_JOB so kill-on-close launcher Jobs do not terminate it with the host app
  • require an explicit helper readiness signal before calling Host.Quit, keeping the current process alive when helper startup fails
  • clear the readiness sentinel before launching the replacement process and cover success/failure paths with updater tests

Test plan

  • go test ./pkg/updater on Windows
  • verify Restart does not call Host.Quit before helper readiness
  • verify helper readiness errors preserve the running host process

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved updater restart reliability by confirming the helper is ready before continuing.
    • Prevented the application from quitting when the helper fails to start or reports an error.
    • Added clearer error reporting for helper startup timeouts and access-denied failures.
    • Ensured helper-only environment settings are not passed to the relaunched application.
  • Platform Improvements

    • Improved Windows helper behavior so it can continue running independently when the parent application exits.

Create the updater helper with CREATE_BREAKAWAY_FROM_JOB and wait for an explicit helper readiness signal before quitting the host application. This keeps the current process alive when breakaway or helper startup fails.
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a7eafb98-aa68-4221-99df-ababc98757b1

📥 Commits

Reviewing files that changed from the base of the PR and between 3440ae5 and fce55e2.

📒 Files selected for processing (8)
  • v3/pkg/updater/export_test.go
  • v3/pkg/updater/helper.go
  • v3/pkg/updater/helper_test.go
  • v3/pkg/updater/spawn.go
  • v3/pkg/updater/spawn_unix.go
  • v3/pkg/updater/spawn_windows.go
  • v3/pkg/updater/updater.go
  • v3/pkg/updater/updater_test.go

Walkthrough

The updater now uses a readiness file to coordinate helper startup, reports helper initialization failures, delays application exit until readiness succeeds, and adds platform-specific spawn error handling including Windows Job breakaway support.

Changes

Helper readiness and restart coordination

Layer / File(s) Summary
Readiness status protocol
v3/pkg/updater/helper.go, v3/pkg/updater/spawn.go, v3/pkg/updater/helper_test.go
Helper mode writes ready or error status to the configured file; the updater polls the file and returns ErrHelperNotReady for failures or timeouts.
Restart readiness gate
v3/pkg/updater/updater.go, v3/pkg/updater/export_test.go, v3/pkg/updater/updater_test.go
Restart passes a per-process readiness path to the helper, waits before calling Host.Quit, and cleans up failed helper processes. Tests provide readiness stubs for success and failure cases.
Platform helper spawning
v3/pkg/updater/spawn_unix.go, v3/pkg/updater/spawn_windows.go
Spawn errors are wrapped consistently; Windows helper processes request Job breakaway and expose ErrJobBreakawayDenied for access-denied failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Updater.Restart
  participant HelperProcess
  participant ReadyFile
  participant Host.Quit
  Updater.Restart->>HelperProcess: spawn with readiness path
  HelperProcess->>ReadyFile: write ready or error
  Updater.Restart->>ReadyFile: wait for readiness
  ReadyFile-->>Updater.Restart: status
  Updater.Restart->>Host.Quit: quit after ready
Loading

Poem

I’m a rabbit with a ready-file tune,
I signal at dawn beneath the moon.
The helper says “ready,” the updater waits,
Then hops past all the closing gates.
No quit before the signal’s bright—
A tidy launch, a tidy night!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description has a summary and test plan, but it omits required issue linkage, type of change, checklist, and test configuration. Add Fixes #issue, select the change type, complete the checklist, and include wails doctor/test configuration details.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: updater restart behavior for Windows launcher jobs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies"


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant