Skip to content

fix(android): start the emulator with -crash-report-mode never - #1186

Merged
V3RON merged 5 commits into
mainfrom
bug/1183
Nov 1, 2026
Merged

V3RON merged 5 commits into
mainfrom
bug/1183

Conversation

@V3RON

@V3RON V3RON commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1183

Status

Implement: done (1/1 green) Review: round 2 + 2 fix-checks, 0 open Hardware: pass (line 8) Gate: running
Next: gate

  • The emulator is started with -crash-report-mode never and ANDROID_EMU_CRASH_REPORTING_DATABASE under the Simlock root, so a stale crash dump opens no consent dialog and the user's shared /tmp/android-<user> crash database is never read (hunks: #startEmulator, #emulatorEnv in src/drivers/android/index.ts; test: "starts the cold boot and the restart from the baseline with -crash-report-mode never and a crash database under the Simlock root...")
  • Hardware: with a .dmp in the user's shared emu-crash-<version>.db/completed/ folder, a lease boots with no dialog and that .dmp is still there afterwards — slow lane e2e/slow-android-smoke.test.ts passed at 3301085 (it plants a crashpad-recognised report; with the env var removed it fails)

Assumptions

  • Assumption: flag position — placed after -grpc-use-token, before the configured emulator flags; the smallest change, and existing argv tests only gain two entries.

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 2 blocking, 2 fixed, 1 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 49.1M.
Runs: 18. Cost USD: 4.0903. Agent seconds: 2323.

Assessment: complete

Written by an agent.

@V3RON

V3RON commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Decision taken

Question: -crash-report-mode never alone makes the emulator delete every pending dump in the user's shared crash database (/tmp/android-<user>/emu-crash-<version>.db). Android Studio and the user's own emulators write there too. Review finding R1 says this touches files Simlock did not write.

Options:

  1. never alone. No dialog. The emulator deletes the user's dumps from Android Studio and other emulators too, without asking.
  2. never plus ANDROID_EMU_CRASH_REPORTING_DATABASE set to a folder in Simlock's root. No dialog. Simlock's emulators record and drop crash dumps only in Simlock's folder. The user's shared folder is not read or touched.
  3. disabled. No dialog, but crashes are not recorded at all.

Taken: option 2. It keeps Simlock inside its own root (ADR 0001) and still fixes the boot hang. The triage rejected the variable only on its own, without never.

Reverting: drop the env var from the emulator spawn (one line) to get option 1.

The fast tests can't prove the emulator honours the variable. A hardware check will: a .dmp in the shared completed/ folder, a lease boots with no dialog, and the .dmp is still there.

Written by an agent.

@V3RON

V3RON commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 0cbba44
Round 2: b189e5a
Round fix-check: eb2de31
Round fix-check: 3301085

Runs: 18. Cost USD: 4.0903. Agent seconds: 2323.
Tokens input 396, output 97296, cache read 5903671, cache write 635613.
- build implementer: claude-sonnet-5-5 105 s $0.2032
- audit implementer: claude-sonnet-5-5 44 s $0.1266
- review 1 reviewer: claude-sonnet-5-5 229 s $0.2504
- review 1 spec: claude-sonnet-5-5 16 s $0.1241
- review 1 code both: claude-opus-5-5 138 s $0.5832
- review 1 claims: claude-sonnet-5-5 19 s $0.0791
- fix 1 implementer: claude-sonnet-5-5 80 s $0.2149
- review 2 reviewer: claude-sonnet-5-5 46 s $0.1318
- fix 2 implementer: claude-sonnet-5-5 60 s $0.1513
- review fix-check reviewer: claude-sonnet-5-5 346 s $0.1814
- hardware hardware-verifier: claude-sonnet-5-5 260 s $0.0779
- review fix-check code-reviewer both: claude-opus-5-5 274 s $0.8687
- review fix-check claims-reviewer claims: claude-sonnet-5-5 21 s $0.0856
- hardware-fix implementer: claude-sonnet-5-5 303 s $0.2567
- hardware hardware-verifier: claude-sonnet-5-5 77 s $0.0684
- review fix-check reviewer: claude-sonnet-5-5 184 s $0.2035
- review fix-check reviewer tests: claude-opus-5-5 111 s $0.4226
- review fix-check reviewer claims: claude-sonnet-5-5 10 s $0.0609
Finding outcomes: {"fixed":2,"nonblocking":1}. Classes: {"doc clarity":1,"safety: user files deleted by launch flag":1,"test cannot fail for its title's reason":1}.
{"findings":[{"id":"R1","role":"code","class":"safety: user files deleted by launch flag","outcome":"fixed","path":"src/drivers/android/index.ts","round":"1","fix":"b189e5ad3"},{"id":"R2","role":"code","class":"doc clarity","outcome":"nonblocking","path":"src/drivers/android/index.ts","round":"1","fix":"b189e5ad3"},{"id":"R3","role":"code","class":"test cannot fail for its title's reason","outcome":"fixed","path":"e2e/slow-android-smoke.test.ts","round":"fix-check","fix":"3301085f17092c2e361a777c3d698fe6334932b5"}]}

Written by an agent.

@V3RON

V3RON commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

Not blocking, not verified. Each is one reviewer's claim.

  • code: src/drivers/android/index.ts:2238 an older emulator may refuse the unknown -crash-report-mode flag; no minimum emulator version is set (-grpc-use-token has the same exposure).

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 1, 2026 21:04
@V3RON
V3RON merged commit 20c3640 into main Nov 1, 2026
67 checks passed
@V3RON
V3RON deleted the bug/1183 branch November 1, 2026 21:08
V3RON added a commit that referenced this pull request Nov 29, 2026
… ones, and driver tests replay recorded tool output (#1947)

## Why

In 6 weeks, people found 58 product bugs by using the product. 26 were a
real tool behaving unlike its hand-written fake. Nothing held the two
fake drivers to the real ones, and 172 test files rest on them.

## What

- `driverContract(name, options)` (`src/core/test-driver-contract.ts`):
24 cases covering resolve, catalog, components, the lifecycle through a
baseline save, physical refusals, the lease environment and passthrough.
It runs on `FakeDriver` and the out-of-process fake for both platforms
in the unit lane. `src/drivers/driver-contract-real.test.ts` runs it on
the real drivers, tagged `slow` and gated on `SIMLOCK_DRIVER_CONTRACT`.
- `FakeDriver` fixed where the real drivers agree: a device no boot has
started is `stopped`, running devices are listed as processes, and a
phone's lease environment names the phone.
- `RecordingProcessRunner` writes argv, exit code, stdout, stderr and
the AVD `config.ini` files, one file per tool version. Seeded with
deviceless output: Xcode 27.2, adb 37.0.0, emulator 36.5.11 and 36.1.9,
cmdline-tools 20.0.
- `recording-diff.config.ts` holds every scripted answer in
`src/drivers/**` to the recordings. The Android launch tests replay the
recorded `emulator -help`.

## Proof

```
contract on the 4 fakes: 24 cases, 92 runs (passthrough on the e2e fake only)
  FakeDriver: 4 divergences, fixed; e2e fake: 4, fixed (no past bug matches one)
  each of the 35 new tests fails with the one line it guards removed or changed
recording diff, src/drivers/** at head: 1,570 tests, 0 findings
replay at past commits (diff run or parser on today's recording):
  #1199 parent of #1232: 71 tests red (emulator 36.1.9 lacks -crash-report-mode)
  #1199 at #1186, which added the flag: 71 red
  #1297 parent of #1304: 71 red
  #1048 parent of #1147: config hash changes after avdmanager rewrites
        another AVD's config.ini (red); at #1147 unchanged (green)
  #1296: the recording holds `Invalid device` exit 148, but nothing says the
        driver must drop the row: not counted
of the 26: replayed red 3; estimated 5 with the real-driver contract nightly
  (+#1369, #1714 baseline saves; not run)
unit lane added: 0.03-0.04 s of test bodies, ~1.3 s import for the 5 files
```

Not verified: the real-driver contract (no device run). Whether a booted
emulator writes `key = value` (#1369): neither `avdmanager` 19.0 nor
20.0 does.

## Review

Spec review: skipped. Code review: 9 blocking, 9 fixed, 0 notes. Claims
review: 1 blocking, 1 fixed, 0 notes.
Rounds: 3. Tokens: 7.8M.
Assessment: complete

*Written by an agent.*
V3RON added a commit that referenced this pull request Nov 29, 2026
…the whole lane runs nightly on main (#1951)

## Not verified

- Not run: any device, the slow lane, a real nightly `start`, `gh issue
create` (fake `gh` only).

## Why

13 of 27 hardware-fix runs chased failures that were not the PR's. Of 37
failed lane runs, 7 were the PR's own defect and 8 were rot already on
`main`. The whole lane never ran whole.

## What

- `scripts/slow-e2e.sh triage <log>` classes each failure (test, suite,
file, run): `flaky` (an open `flaky-test` issue), `base` (the nightly
list, or fails at the merge base), `load` (host over its limit), `reach`
(the PR changed the test file, or it passes at the merge base). Only
`reach` gets a fix run.
- The lane log records its arguments, platforms and load; `status`
prints `failed:` and `not run:` lines.
- `.agents/scripts/slow-lane-nightly.mjs`: every non-phone slow file on
`main`, one lane run each, then the driver contract under the lane lock.
It files one issue per failing test and writes the known list
(`--apply`; else it prints).
- The verifier triages before it reports. `deliver-step.mjs` starts a
hardware-fix only on a `reach` or `unsorted` line and sends only those;
other failures park only when a Done when line failed (rule 16).

## Proof

```
1. Triage replay, 37 failed verifier runs (tx.json), 2 unknown left out: 35.
   Per-run hand labels rebuilt from the fix runs' outcomes (the report kept counts only).
   Base reruns as recorded:      6 need a rerun; class equal 19 of 29.
   Unrecorded reruns as labelled: class equal 25 of 35.
   PR's own defect sent to a fix run: 16 of 17 (#1828 is flaky: #1762, open then, names it;
   the report counts #1828 a time-bound flake). Other failures kept from one: 9 of 18.
   The other differences: the PR's own new test hit a flake or a time bound with no load
   recorded (#1536 x2, #1893, #1830 x2); a machine fault (#1186) and a helper broken
   on main (#1660) in the PR's own new test; #1458's repro of a known bug; #1573 16:22
   passed at the base (a full-lane flake).
   The report's own lists: its 7 PR-defect runs -> reach 7 of 7.
   Duo failures of 2026-11-27 (5 in the lane logs, PR #1916):
     as on 11-27: load 3 (load 122-162 in SLOW BUDGET lines), reach 2 (no load sample
     in their window; the lane now writes one each minute). With #1941 open: flaky 5 of 5.
   A printed rerun, run through sh on a vitest fixture, selects exactly the failed test
   (not a longer title that starts with it, not the same title in another suite).
2. Nightly dry run (plan) on origin/main 3e2b72a: 26 files, name order,
   slow-agent-device-gateway ... slow-warm-pool; then "not run: driver contract:
   src/drivers/driver-contract-real.test.ts is not on main yet".
   Report dry run on a fabricated night: the issue text for a failed withinBudget bound,
   "not run: android missing (...): 2 tests", "not run: the lane was busy", nothing written.
3. Fake xcrun (lists no iOS runtime / no simctl / fails): status prints
   "not run: ios missing (...)" for the first two, and the third is not missing.
   With the probe forced to "present", the test fails.
Unit tests: src/slow-e2e.test.ts, src/slow-lane-triage.test.ts, src/slow-lane-nightly.test.ts,
src/deliver-step.test.ts: 110 pass. deliver-step replay (R/builders/deliver-step, real
and sandbox): no transition changed (recorded Evidence lines carry no class).
```

## Review

Spec review: skipped. Code review: 9 blocking, 9 fixed, 0 notes. Claims
review: 3 blocking, 3 fixed, 0 notes.
Rounds: 6. Tokens: 8.9M.
Assessment: complete

*Written by an agent.*
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.

Android: a stale emulator crash dump makes every boot wait on a crash-report dialog until the lease times out

1 participant