Skip to content

Conversation

@LukasPaczos
Copy link
Contributor

@LukasPaczos LukasPaczos commented Sep 25, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/1208671518894266/task/1211468322303343?focus=true

Description

Fixes an issue with inaccessible Duck.ai fragment that could happen after failed fragment state transaction.

If the Duck.ai close transition finished after onSaveInstanceState, the fragment container would be hidden but the fragment itself wouldn't. This led to an invalid state where the app thought the fragment was visible, preventing it from ever re-launching, but its container was gone.

To resolve the issue, this PR:

  1. Allows for lossy fragment transaction when closing Duck.ai. This resolves any potential crashes that Fix IllegalStateException when closing Duck.ai #6839 attempted to fix.
  2. Checks for fragment and its container state consistency when trying to open Duck.ai. This prevents any state locks in rare cases where activity is restored from saved state after being in Duck.ai mode.

Steps to test this PR

The issue was mostly reproducible for me in release variant and with Input Screen enabled, because on New Tab Page the Input Screen reopens after closing Duck.ai fragment which has a higher likelihood of canceling the transitions.

  • Enable Input Screen.
  • Open New Tab Page.
  • Open Input Screen.
  • Send a prompt to Duck.ai.
  • Go back and reopen the Input Screen.
  • Send another prompt to Duck.ai and verify it correctly opens.

@LukasPaczos
Copy link
Contributor Author

Heads up that only the first two commits contain relevant logic changes while bae6cab is a format enforced by our ratchet-based migration to new code format.

Copy link
Contributor

@joshliebe joshliebe left a comment

Choose a reason for hiding this comment

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

LGTM!

@joshliebe joshliebe merged commit ddb18f9 into develop Sep 26, 2025
14 checks passed
@joshliebe joshliebe deleted the fix/lukasz-p/duck.ai-fragment-state branch September 26, 2025 07:47
karlenDimla pushed a commit that referenced this pull request Sep 26, 2025
Task/Issue URL:
https://app.asana.com/1/137249556945/project/1208671518894266/task/1211468322303343?focus=true

### Description

Fixes an issue with inaccessible Duck.ai fragment that could happen
after failed fragment state transaction.

If the Duck.ai close transition finished after `onSaveInstanceState`,
the fragment container would be hidden but the fragment itself wouldn't.
This led to an invalid state where the app thought the fragment was
visible, preventing it from ever re-launching, but its container was
`gone`.

To resolve the issue, this PR:
1. Allows for lossy fragment transaction when closing Duck.ai. This
resolves any potential crashes that
#6839 attempted to fix.
2. Checks for fragment and its container state consistency when trying
to open Duck.ai. This prevents any state locks in rare cases where
activity is restored from saved state after being in Duck.ai mode.

### Steps to test this PR

The issue was mostly reproducible for me in `release` variant and with
Input Screen enabled, because on New Tab Page the Input Screen reopens
after closing Duck.ai fragment which has a higher likelihood of
canceling the transitions.

- [x] Enable Input Screen.
- [x] Open New Tab Page.
- [x] Open Input Screen.
- [x] Send a prompt to Duck.ai.
- [x] Go back and reopen the Input Screen.
- [x] Send another prompt to Duck.ai and verify it correctly opens.
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.

2 participants