Skip to content

[bug] PersonalListViewModelGenerationTest fails intermittently in CI without a Main dispatcher #562

Closed

Description

@Quick104

What happened

PersonalListViewModelGenerationTest > aResetSupersededByARefreshDoesNotStrandIsLoading fails intermittently in CI's ci / Unit tests job. It fails before any assertion runs, because Dispatchers.Main isn't available. A rerun of the same commit passes, and the test passes locally (three --rerun-tasks runs in a row).

Recent failures:

  • main at 63a007a ("Android Builds", ci / Unit tests)
  • silo-android#559 at f999900. That PR doesn't touch personal lists.

Steps to reproduce

Not reproduced locally. It shows up only in CI's :shared:testDebugUnitTest.

Expected behavior

The test passes on every run.

Silo version / commit

silo-android main at 63a007a.

Deployment

CI (GitHub Actions, ci / Unit tests). No server involved.

Clients affected

None at runtime. This is a test flake that turns unrelated PRs red.

Relevant logs

1937 tests completed, 1 failed
> Task :shared:testDebugUnitTest FAILED
PersonalListViewModelGenerationTest > aResetSupersededByARefreshDoesNotStrandIsLoading FAILED
    java.lang.IllegalStateException at TestMainDispatcherJvm.kt:45
        Caused by: java.lang.IllegalStateException at MainDispatchers.kt:111
            Caused by: java.lang.RuntimeException at Looper.java:-1

Technical notes

The class sets Dispatchers.setMain(UnconfinedTestDispatcher()) in @BeforeTest and calls resetMain() in @AfterTest. The failure says the Main dispatcher was missing while this test ran. That points to state shared across tests in the JVM rather than to this test's logic. One candidate: the TestList view models are never cleared, so their viewModelScope (with an eagerly started stateIn) outlives resetMain(). Another test class that sets and resets Main could interfere the same way. Unconfirmed: I haven't traced which test leaves Main unset.

A likely fix is to clear the view models in @AfterTest (for example, hold them in a ViewModelStore and call clear() before resetMain()), then check that the flake stops.

AI disclosure

  • Harness: Claude Code
  • Tools: GitHub CLI, Gradle
  • Model: Claude Opus 5.5 (claude-opus-5-5)
  • Involvement: AI-drafted from CI logs and source reading; not independently reviewed

Confirmations

  • Reproduced on a real deployment (no: CI-only flake)

Source: found in review of silo-android#559

Activity

  1. added
    bug
    on Oct 13, 2026
  2. added
    priority: P2
    triaged
    on Oct 13, 2026
  3. self-assigned this
    on Oct 14, 2026
  4. Quick104 commented on Oct 14, 2026

    @Quick104
    ContributorAuthor

    🤖 AI agent claim. Claude Code (claude-opus-5-5) is working on a fix for this issue on behalf of @Quick104, who is assigned.

    A pull request will link here when the fix is ready. If the work stops without a fix, the assignment and this comment are removed.

    Planning to work on this, or have context to add? Reply here and mention @Quick104.

  5. added a commit that references this issue on Oct 14, 2026
    98c6fd8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpriority: P2triaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions