Skip to content

fix(app): Finish on the live transcript no longer leaves a black screen after a swipe back - #20375

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
Itaxh1:fix/capture-finish-swipe-back-pop
Oct 3, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
Itaxh1:fix/capture-finish-swipe-back-pop

Conversation

@Itaxh1

@Itaxh1 Itaxh1 commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: Tapping Finish on the live transcript and swiping back at about the same moment left the whole app on a black screen until it was force-quit (#20369). The Finish handler's Navigator.pop() landed after the swipe had already popped the page, so it removed Home and emptied the root navigator. The page now pops only while its own route is still the current one. App only, one line of behaviour, with a regression test that reproduces the timing. No backend change.

What changed and why

Fixes #20369.

ConversationCapturingPage._stopConversation awaits finishCapture(), re-checks mounted, then pops. A swipe back during that await pops the route first, but the page stays mounted while it animates out (about half a second on the iOS page route), so mounted is still true and the pop removes whatever is on top now. That is Home, the only route of the root navigator, and an empty navigator paints black.

  • app/lib/pages/conversation_capturing/page.dart: pop only when ModalRoute.of(context)?.isCurrent. The switch to the conversations tab is kept either way, so Home still lands on the processing row.
  • app/test/widgets/capturing_finish_swipe_back_test.dart: the regression test.
  • .github/failure-classes/FC-late-pop-after-route-left.json: the class this is an instance of.
  • app/changelog/unreleased/20261002-capture-finish-swipe-back.json: changelog fragment.

No data was lost in the bug: the finish completed and the conversation was processed. It only looked like a crash.

Product invariants affected

none

How it was verified

  • Found on an iPhone 15 Pro Max (iOS 26.6.2, app 1.0.543): black screen after Finish then a swipe back. No crash report and no Jetsam event were written, and the process was still running, which is what an empty navigator looks like.
  • The new widget test reproduces it on the unfixed code: Expected: exactly one matching candidate / Actual: Found 0 widgets with text "home". With the fix both cases pass.
  • flutter test test/widgets/capturing_finish_swipe_back_test.dart test/widgets/capturing_empty_state_test.dart test/widgets/capturing_wal_backlog_test.dart test/widgets/process_now_conversations_tab_test.dart: 11 passed.
  • bash test.sh: 3,900 passed, 5 skipped, 0 failed.
  • bash scripts/analyze_ratchet.sh: passed.
  • dart format --line-length 120 on the two Dart files: no changes.
  • Not re-run on the phone yet: the window is a few hundred milliseconds, so the widget test is the reliable reproduction. A phone build can follow if wanted.

Tests

app/test/widgets/capturing_finish_swipe_back_test.dart pumps the production ConversationCapturingPage on the iOS page route over a Home stand-in, with a capture whose finish resolves when the test says so:

  • a finish that resolves while the page is swiped away leaves Home on screen: Finish is tapped, the route is popped as the swipe pops it, 100 ms of the exit transition runs with the page still mounted, then the finish resolves. Home must still be there, and on the conversations tab. This fails without the fix.
  • a finish with no swipe closes the page and shows the conversations tab: the ordinary path still pops the page.

Failure class (fixes)

Failure-Class: new

Failure-class transition narrative (only when needed)

New class FC-late-pop-after-route-left.

  • Violated contract: Navigator.pop() removes whatever route is on top, not the route whose page called it. A page that awaits and then pops assumes it is still on top. A back swipe during the await removes the route first, yet its State stays mounted through the exit transition, so the mounted re-check passes and the late pop removes the route beneath.
  • Canonical guard: after an await, pop only when the page's own route is still current (ModalRoute.of(context)?.isCurrent). The guard artifact is the regression test above.
  • Evidence: Black screen after tapping Finish on the live transcript and swiping back #20369 (this PR is the first fix). It is distinct from FC-continuation-resumed-after-unmount: there the owner is gone and re-checking mounted is the prevention; here mounted was re-checked and is true, and the route is what has left. The same await-then-pop shape exists on other pushed pages, which is why this is recorded as a class and not only as an instance.

Review in cubic

…wipe back

Finish awaits the capture's finish and then pops the page. A swipe back
during that await pops the route first, but the page stays mounted while it
animates out, so the mounted re-check passed and the late pop removed Home,
leaving an empty navigator: a black screen until the app was force-quit.

The page now pops only while its own route is still the current one. The
switch to the conversations tab is kept either way.

Adds a regression test that reproduces the timing on the iOS page route, and
the failure class FC-late-pop-after-route-left.

Fixes BasedHardware#20369

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed all four files at 011f1cc — this is a clean, well-scoped fix for #20369. Thanks for the excellent write-up and the deterministic regression test.

Per file:

  • app/lib/pages/conversation_capturing/page.dart — the guard is exactly right: ModalRoute.of(context)?.isCurrent is the correct "my route is still the top route" check after an await, since mounted stays true through the swipe-back exit transition and the old unconditional pop removed Home, emptying the root navigator. Keeping switchHomeToConversationsTab before the guard so the tab switch happens on both paths matches the described behavior (and the test asserts it).
  • app/test/widgets/capturing_finish_swipe_back_test.dart — nice construction: _ControlledCapture overriding finishCapture() with a Completer makes the race deterministic, pumping the production page over a Home stand-in on the real omiPageRoute with the iOS variant (the Cupertino transition the swipe produces). Both the race case and the no-swipe control case assert the tab switched, so the guard can't silently regress into skipping it. Hermetic, no leaks (addTearDown disposes all providers).
  • .github/failure-classes/FC-late-pop-after-route-left.json — schema-consistent with sibling classes and accurate against the code; validated with scripts/failure-class validate against the PR body (declaration new, ok).
  • app/changelog/unreleased/20261002-capture-finish-swipe-back.json — matches the existing unreleased-fragment format.

One note for the maintainer merging: the Dart test lanes are skipped on this fork PR, so capturing_finish_swipe_back_test.dart has only the PR body's local run as execution evidence. Worth a flutter test test/widgets/capturing_finish_swipe_back_test.dart (or bash test.sh) run on the merge side before merge — the test's construction looks sound on static review.

Leaving for human maintainer review (merge decision plus that pre-merge test run); no blocking concerns from my side.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added flutter flutter work positive-signal Automation verified a genuine fix/quality contribution labels Oct 2, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clear root cause, fixes #20369, scoped (220 lines), regression test reproduces exact timing bug, CI green. Merging (5/5).

@kodjima33
kodjima33 merged commit f0f2790 into BasedHardware:main Oct 3, 2026
46 of 47 checks passed
mdmohsin7 added a commit that referenced this pull request Oct 3, 2026
…0476)

## Summary

`main` fails **Dart Analyze & Tests** at 8fb7dc1, so every app PR is
red. The analyzer ratchet reports an error-severity diagnostic:

```
RETURN_OF_INVALID_TYPE_FROM_CLOSURE app/test/widgets/capturing_finish_swipe_back_test.dart:120
The returned type 'List<dynamic>' isn't returnable from a 'Future<PeopleListResponse?>' function
```

Two changes collided without a textual conflict:
- 677ee83 ("retain known People stats when scans are truncated")
changed `PeopleProvider.loadPeople` to return
`Future<PeopleListResponse?>`.
- f0f2790 (#20375) added this test, which passes `() async => []`.

Each was green on its own branch.

## Change

The test passes `const PeopleListResponse(people: [])`, the same shape
the other People tests use. This is a test-only change; no app code
changes.

## Product invariants affected

none

## Verification

- `flutter analyze` over the whole app: 0 errors.
- `flutter test test/widgets/capturing_finish_swipe_back_test.dart`: 2
tests pass.
- Seen failing on PR #20474's run 37137363033 (job 111244602814).

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/20476?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
aryanorastar pushed a commit to aryanorastar/omi that referenced this pull request Oct 3, 2026
677ee83 changed PeopleProvider.loadPeople to return
Future<PeopleListResponse?>, and f0f2790 (BasedHardware#20375) added this test
passing `() async => []`. Each was green on its own; together on main
(8fb7dc1) the analyzer ratchet fails with
RETURN_OF_INVALID_TYPE_FROM_CLOSURE, which fails Dart Analyze & Tests
on every app PR.

Verification:
- flutter analyze (whole app): 0 errors.
- flutter test test/widgets/capturing_finish_swipe_back_test.dart: 2 pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Black screen after tapping Finish on the live transcript and swiping back

3 participants