Skip to content

fix(worker): finish updates after device cleanup fails - #967

Merged
nixuuu merged 1 commit into
devfrom
fix/android-avd-cleanup-recovery
Nov 18, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/android-avd-cleanup-recovery

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 18, 2026

Copy link
Copy Markdown
Member

Change

An Android AVD whose reservation contains only the configuration name can leave a binary worker offline during a nightly update. The ownership check correctly refuses to stop the emulator, but the error used to interrupt shutdown after the executable was replaced and the reporting channel was canceled.

Updates and supervisor handover now share the graceful stop path with signal-driven shutdown. The worker logs the cleanup error, attempts to flush the journal, and exits with the requested supervisor code. The durable AVD reservation stays in place for recovery after startup. The update result still follows WorkerLink startup confirmation or the supervisor's rollback.

Fixes: #910

Verification

  • The new integration test runs a pair of compiled nightly worker binaries and a fake agent-device. It verifies that the worker comes back active after supervisor handover, reports success for the same attempt, retains the reservation, and sends no emulator shutdown command.
  • 48 tests passed through check:tmp across the new regression, worker shutdown, and the device backend and pool.
  • Five existing tests passed through check:tmp for rollback and retrying a lost failure report.
  • Worker and integration test typechecks, lint and formatting for the edited TypeScript files, and git diff --check passed. GitHub CI runs the full gate.

@nixuuu
nixuuu enabled auto-merge (squash) November 18, 2026 14:50
@nixuuu
nixuuu merged commit 8d6894a into dev Nov 18, 2026
15 checks passed
@nixuuu
nixuuu deleted the fix/android-avd-cleanup-recovery branch November 18, 2026 14:57
nixuuu added a commit that referenced this pull request Nov 18, 2026
## Change

After a worker falls back from an unavailable saved secure route,
SIGTERM can race the first configuration probe. A probe that returns
after shutdown has stopped the CLI check timer can start it again. The
process then stays alive even after the journal and connections have
closed.

Check shutdown state before and after probing. Configuration that loses
the race is reported as unapplied. The next worker process applies the
configuration on connection.

Fixes: #967
Related: #974

## Verification

- Reproduced exit code 137 using the worker route migration test on the
commit for #967. The same test passed on its parent.
- All 8 tests in the worker route migration, worker shutdown, and worker
update cleanup suites passed with this change through `check:tmp`.
- Worker typecheck, targeted lint and formatting, and `git diff --check`
passed. GitHub CI runs the full gate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant