Skip to content

fix(mobile-release): held-mode train supersedes a stale pending staged release with the newer pinned build - #23918

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/supersede
Oct 28, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/supersede

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Problem

Play held-changes mode (CHANGES_NOT_SENT_FOR_REVIEW = True in app/scripts/mobile_store_promote.py, back on since 2026-10-28) parks the Android exposure ladder whenever a production staged release exists — run_android() returns before any pin or receipt logic, forever. On 2026-10-28 the pending staged release was 1.0.578 (1522), built before the Play currency-policy fix; the fixed build 1.0.579 (1527) sat on internal, and the train could never move production to it. The operator had to rebuild the release by hand in Play Console — and discarding the pending change reverts the track, so the train parks again.

The root confusion: the Play API cannot distinguish a held, pending commit from a live staged rollout — both read inProgress at the same userFraction — so the train treated a never-live held commit as untouchable live exposure.

Fix

In held mode, when all of these hold, run_android() supersedes instead of parking (plan_held_supersede):

  • the staged release is train-written: its name carries a gate receipt ((gate YYYY-MM-DD-HHMM)); a receipt-free name may be human-edited and is never superseded;
  • the gate-pinned candidate (TRAIN_PIN_ANDROID via store_pin / pick_play_candidate) matches the store exactly — a set-but-mismatched pin refuses exactly like every other pin check, and an unset pin parks (unaudited);
  • the candidate is strictly newer: higher version AND higher version code.

The supersede writes one held commit whose PUT carries every other production release unchanged — above all the completed base release (Google's tracks.update replaces the whole releases list, so the base must ride along explicitly or the users outside the staged fraction lose their release) — plus exactly one inProgress release for the candidate at the SAME userFraction (submit_android(..., status="inProgress", user_fraction=<same>, release_name=<fresh gate receipt>, retained_releases=<base>); retained_releases is a new, tested parameter that passes server-returned completed/draft releases through unchanged and rejects a second staged release or overlapping version codes). Exposure never changes. The written release carries the candidate's own collected What's-New text (no base_release: the stale release's notes belong to the old version). The run logs the decision and returns android=staged-superseded <old> -> <new> @<fraction> (held; send for review in Console); the operator still presses Send for review in Play Console → Publishing overview.

Everything else keeps today's park behaviour: no candidate, pin unset, candidate not strictly newer, a halted rollout, staged rollouts disabled, or an advance-only watch run.

Documented limitation: because the API cannot tell held-pending from live, a supersede may swap a cohort whose held fraction already went live — at an unchanged fraction. The gate receipt is the only liveness proxy this repo controls; that trade is accepted and written down in .github/agent-docs/mobile-release-process.md.

Docs: the held-mode section of .github/agent-docs/mobile-release-process.md gains the supersede contract and is brought back in sync with reality (held mode is on since 2026-10-28; the old paragraph still said the parameter is not sent anywhere; also noted ANDROID_HELD_CHANGES_MODE in .github/scripts/mobile_distribution.py was not flipped with the 2026-10-28 commit and remains False). Cross-reference added to the brake runbook (BRAKE_ACTION=stage stays the operator path for halted releases; the train never touches those).

Product invariants affected

  • none — release-process tooling and docs only; no app, backend, or workflow behavior changes.

Failure-Class: FC-play-held-edit-mistaken-for-live-track

Rollback

Revert the commit: held mode returns to unconditional park and the ladder behaves exactly as today. Store-side state (a superseded held release, the completed base release) is unaffected by a revert, and the store brakes (halt in Play Console) work either way. Exposure never increased in the first place, so there is no exposure to unwind.

Test plan

  • python3 -m unittest app.scripts.mobile_daily_train_test app.scripts.mobile_store_promote_test — 137 tests, 12 new: supersede when newer and pinned (PUT asserts BOTH releases: the completed base unchanged with its codes/notes, and the candidate inProgress at the same fraction with the candidate's own notes, fresh gate-receipt name, exactly one inProgress, changesNotSentForReview=True commit); multi-code completed base retained release-by-release; fraction unchanged at a mid-ladder 10%; no supersede when the candidate code is not higher; pin mismatch refuses with TrainError and no writes; halted stays parked even with a pinned newer build; a receipt-free (possibly human-edited) release is never superseded; unpinned parks; dry-run writes nothing; advance-only never supersedes even with a pin; non-held mode still hops the staged rollout instead of superseding; promote-side retained_releases pass-through plus the one-staged-release and code-overlap rejections.
  • bash scripts/run-release-process-guards.sh and bash scripts/run-release-process-guard-tests.sh — passed (98 guard self-tests). codemagic.yaml is untouched, so no workflow-contract fixture digest regeneration was needed.
  • No Play or Google API call, no Codemagic trigger, and no store state read or written in preparing this PR.

…d release with the newer pinned build

In Play held-changes mode run_android() parked forever on an existing production
staged release. When the staged release is a train-written held commit (gate
receipt in its name) and the gate-pinned candidate is strictly newer (version AND
code), plan_held_supersede now replaces it with one held commit at the SAME
userFraction: exposure never rises, the completed base release stays, the
candidate ships its own notes, and the operator still presses Send for review.
Everything else keeps parking; a mismatched pin refuses like every other pin
check. 2026-10-28 evidence: held 1.0.578/1522 wedged production off the
currency-policy fix in 1.0.579/1527.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T20:29:26.664083Z 2bf81fd New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e083ae6e08

ℹ️ 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".

Comment on lines +1212 to +1215
status="inProgress",
user_fraction=current,
release_name=_staged_name_with_receipt(candidate.version),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve country targeting when superseding a staged release

If a receipt-bearing staged release has countryTargeting, this call silently drops it because submit_android() builds a new release without base_release. For example, a US-only rollout at 10% becomes an unrestricted rollout at 10% when the held replacement is published, expanding exposure despite retaining the numeric fraction. The existing ladder preserves this metadata, and mobile_rollout_brake.md explicitly rejects country-targeted mutations rather than stripping their scope. Preserve the staged release's targeting separately from its old notes, or park targeted releases for operator handling.

Useful? React with 👍 / 👎.

…ugh the held supersede PUT

Luna review of the supersede: tracks.update replaces the whole releases
list, so the single-release PUT dropped the completed base — the users
outside the staged fraction would lose their release. submit_android gains
retained_releases (server-returned completed/draft releases passed through
unchanged; one staged release per PUT; no code overlap), and the train
supersede now sends the base unchanged beside the one inProgress candidate
at the same fraction. Exposure never changes either way now.
@Git-on-my-level
Git-on-my-level merged commit 7285282 into main Oct 28, 2026
44 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/supersede branch October 28, 2026 20:59
Git-on-my-level added a commit that referenced this pull request Oct 28, 2026
…& Tests overruns its 30m budget) (#23922)

## Summary

The **Dart Analyze & Tests** job (mobile-app-checks.yml, 30-minute
timeout) now overruns on app-touching PRs with zero test failures:
#23918 was cancelled twice (30m16s / 30m18s, the second
mid-`conversation_playback_sync_test.dart`), #23900 passed only on
rerun, and main's nightly run is already **27m47s** — one app PR away
from the cap, which is why Mobile Release Eligibility fails with it.

Per-file timing parsed from the nightly (green main) and cancelled PR
run logs shows the flutter-test span (22m15s on main) is dominated by
**real event-loop waits, not CPU and not failing tests**. This PR
removes those waits — every assertion and every count is unchanged — and
lets `app/test.sh` overlap the remaining waits across suites. No
`.github/` changes (the timeout/sharding stay David's call).

## What was slow (exclusive per-suite time, CI logs)

| Suite | Cause | Fix | Local wall before → after |
| --- | --- | --- | --- |
| `test/visual_audit/visual_audit_smoke_test.dart` (137s) | `settle()` =
6×80 ms real turns, ~500 calls | 6×20 ms (same 6 event-loop turns) |
196s → 75s |
| `test/perf/production_shell_gate_test.dart` (45–78s) | 2×250 ms window
guards ×27 tests; `drainFixtureIo` 5×20 ms inside every scroll fling |
80 ms guards; 5×8 ms drains | 74s → 60s leaf |
| `test/widgets/conversation_playback_sync_test.dart` (16–31s) |
`_flushPlatform` 6×30 ms × 70 calls | 6×10 ms | 46s → 41s |
| `test/unit/plans_sheet_l10n_test.dart` (13–16s) | O(n²) nested-`where`
duplicate-key scan, one test = 15.5s | map count, same duplicates found
| 19s → 3s |
| `test/unit/limitless_golden_test.dart` (13s) | 4 tests each ~4s inside
the real 1s+1s connect settle windows | injected 10 ms settle windows |
20s → 4s |
| `test/unit/omi_ring_custody_test.dart` (12–13s) | one test sleeps 6 s
to outlast the 5 s enable-ack give-up; `_settle()` 50 ms × ~50 |
injected 200 ms ack window (waits 400 ms); settle 12 ms | 15s → 4s |
| `test/services/capture/capture_transcript_coverage_test.dart` (23s) |
50 ms poll granularity on real file I/O that lands in ms | 15 ms polls |
20s → 7s |

## Production seams (defaults identical)

Two injectable durations with values bit-identical to the constants they
replace; only tests inject shorter ones:

- `LimitlessDeviceConnection`: `setupSettleDelay` (1s) /
`reconnectSettleDelay` (400ms) — firmware settle windows.
- `OmiDeviceConnection`: `enableAckTimeout` (5s) — custody opt-in
give-up window.

## What is left (out of scope here, needs David)

After these cuts the job's remaining time is structural: ~800 suites'
compile/load at `flutter test`'s default concurrency (CPU count = 4 on
the CI runner), while suite wall time is mostly real waiting — 586 s of
the nightly's span sits in 1–5 s silent gaps a higher concurrency would
absorb. The levers are outside app code: the spine runner contract pins
`app/test.sh`'s `flutter test` invocations verbatim
(`contracts/spine/runners.json`, enforced by
`check_spine_contracts.py`), and `flutter test` ignores
`dart_test.yaml`, so a concurrency floor needs a runners.json policy
change or a workflow edit (`-j` on the job's test.sh call, sharding, or
a timeout bump). Suite growth is also real: 777 → 800 suites in one day
on main.

## Verification

- Every changed suite green locally (m5, `nice -n 19`, flutter 3.44.5 =
CI pin); numbers above.
- Full `bash test.sh --reporter expanded` green locally (exact CI
harness, upstream test.sh): **11m59s wall, 8019 passed, 9 skipped** on
an 18-core m5.
- CI measurement on this PR (Mobile App Checks run 40769345287, rerun
job 123118093458): **Dart Analyze & Tests 26m37s, green** — 34s
checkout, ~4m setup, **22m40s test step, +8024 passed**. (A first
attempt was cancelled at 30m15s by a 16.5-minute stalled checkout — git
HTTP transfer flake, not test time.) Baselines: main nightly 27m47s job
/ 22m15s test span; #23918 cancelled twice >30m.
- Honest ceiling: the 4-vCPU runner sustains ~350 tests/min and is
**compile-bound**, so the wait cuts above (real: −137s/−78s/−31s of
exclusive time in the top suites, local suite time ~halved) do not
proportionally shrink the saturated CI wall clock. Getting the job under
22 minutes needs the concurrency/sharding/timeout levers named in "What
is left" below.
- Deterministic perf-gate work-count budgets unchanged (gate violations
empty).
- The visual-audit gallery generator (visual_audit.sh) inherits the
shorter settle turns; loopback fixture I/O lands in ~1–5 ms, six turns
still precede every shot.

## Product invariants affected

INV-CAP-1 —
`app/test/services/capture/capture_transcript_coverage_test.dart` and
`app/lib/services/devices/connectors/omi_connection.dart` fall under the
pendant-audio-retention glob. No retention behavior changes: the
coverage suite's assertions and its condition-based polls are untouched
(only the 50ms→15ms poll granularity shrinks), and the custody
enable-ack timeout stays 5s in production — only tests inject the
shorter window.

Failure-Class: none

UI-Evidence: none -- app/lib changes are two injectable Duration
constructor params with defaults identical to the replaced constants; no
widget, page, or behavior changes.

Line-Count-Exception:
app/lib/services/devices/connectors/limitless_connection.dart | 2225 ->
2237 | adds the two injectable test settle-window Duration params
(defaults identical to the replaced constants) that let the golden tests
stop sleeping through the real 1s firmware windows
tivince82 pushed a commit to tivince82/omi that referenced this pull request Oct 28, 2026
"Dart Analyze & Tests" (mobile-app-checks.yml) overruns its 30-minute
timeout on app-touching PRs with zero test failures: BasedHardware#23918 cancelled at
30m16s/30m18s, BasedHardware#23900 passed only on rerun, and main's nightly run is
already 27m47s. Per-file timing from the nightly and cancelled-run logs
shows the flutter-test span (22m15s on main) is dominated by real
event-loop waits, not CPU or test failures.

Remove the waits without touching any assertion:

- visual_audit harness settle(): 6x80ms real turns -> 6x20ms. The number
  of event-loop turns is what flushes loopback I/O; the per-turn length
  was 20-80x the actual loopback RTT. Suite wall (local): 196s -> 75s.
- perf gate (production_shell_gate_test): the two outside-the-window
  settle waits 250ms -> 80ms (27 tests x 3 trials), and drainFixtureIo
  turns 5x20ms -> 5x8ms (it runs inside every scroll fling iteration of
  the measured scenarios). Deterministic work-count budgets unchanged.
- conversation_playback_sync_test _flushPlatform: 6x30ms -> 6x10ms per
  flush (70 flushes per run); mock channel replies complete on the
  microtask queue.
- plans_sheet_l10n_test: replace the O(n^2) nested-where duplicate-key
  scan with a map count. Same duplicates found; 15.5s -> ~50ms.
- omi_ring_custody_test: _settle 50ms -> 12ms (probe/opt-in chains
  settle on microtasks), and the lost-ENABLE-ack test now injects a
  200ms enable-ack window and waits 400ms instead of sleeping 6s for
  the production 5s give-up window.
- limitless_golden_test: inject 10ms setup/reconnect settle windows via
  new LimitlessDeviceConnection params (defaults identical to the old
  constants); four tests each spent ~4s in the real 1s+1s connect
  settle windows.
- capture_transcript_coverage_test: poll granularity 50ms -> 15ms
  (settleFiles/walsReach/telemetryReaches wait for real file I/O that
  completes in ms).

Two production seams are added, both default-identical to the constants
they replace (LimitlessDeviceConnection setup/reconnect settle,
OmiDeviceConnection enable-ack timeout); only tests pass shorter values.

The remaining job time is structural: ~800 suites' load/compile on a
4-vCPU runner at flutter test's default concurrency. Raising it needs
either the spine-pinned test.sh invocation (contracts/spine/runners.json,
immutable by check_spine_contracts.py) or the workflow file — both
outside this PR's scope. No .github/ changes.

Local verification (m5, nice -19): visual_audit 196s -> 75s, perf gate
74s -> 60s leaf time, playback sync 46s -> 41s, coverage 20s -> 7s,
limitless 20s -> 4s, ring custody 15s -> 4s, l10n 19s -> 3s; full
`bash test.sh` green.

Failure-Class: none
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