Skip to content

flake(studio): sidebar folder action intermittently misses desktop Move to folder menuitem #2603

Closed

Description

@jbeda

Failure

The Mecatl Studio (apps/) CI job intermittently fails in:

src/features/chat/session-sidebar.pinning.test.tsx > chat list row pins > files a row into a folder, out of it, and into a new folder

Failing job on PR #2600, run 40810310063, attempt 1, head 2db90ff580b7876827ffcfdede4ab7480e353b16.

TestingLibraryElementError: Unable to find role="menuitem" and name "Move to folder"
  rowAction src/features/chat/session-sidebar.pinning.test.tsx:118:29
  src/features/chat/session-sidebar.pinning.test.tsx:169:5
Test Files  1 failed | 200 passed (201)
Tests       1 failed | 1762 passed (1763)

The failure occurs on the first move-to-folder action, before any folder callback runs. The companion Mecatl Studio (gate) job fails only because this upstream unit-test job failed; it is not an independent failure. Both mobile and desktop browser-journey jobs passed, as did the Go race/lint/API gates.

Flake evidence

  • PR fix(learning): fit manual synchronous reflection to request budgets #2600 changes only internal/app/reflection_observer.go and its Go regression test. This sidebar test renders local fixtures with mocked callbacks; it does not invoke the modified reflection path.
  • Passing main job, SHA 22a8ce6e218782d463cd911d5be57221737e529d, ran the same sidebar file successfully: 6 tests passed.
  • Git blob identities were compared between that passing main tree and the failing PR tree. The test, sidebar component, mobile hook, shared setup, viewport-mutating tests listed below, Vitest config, and apps/pnpm-lock.yaml are byte-identical. This is stronger than relying only on the PR's unrelated file scope.
  • A later main CI run also has a passing Studio job: run 40881476164.

Classification: intermittent/order-dependent test-environment failure. The exact preceding worker-file sequence has not been replayed, so the root-cause explanation below remains a well-supported hypothesis, not a confirmed reproduction. No same-SHA CI rerun was requested. Local reproduction was not run: this checkout has no installed apps Vitest dependencies, and its ambient Node/pnpm versions differ from the pinned CI toolchain.

Suspected mechanism: shared viewport state changes the expected accessible role

  • rowAction clicks the row options button, then findByRole("menuitem", {name: "Move to folder"}) (session-sidebar.pinning.test.tsx:108-120). It already waits for menu appearance; adding a generic delay is not a root-cause fix.
  • SessionRow renders a desktop submenu trigger with that role at session-sidebar.tsx:402-407. In mobile mode it instead renders an inline group/label named "Move to folder", not a menuitem (:392-400). The existing test helper assumes the desktop submenu and sends ArrowRight.
  • useIsMobile reads shared window.matchMedia / innerWidth (apps/web/src/lib/use-mobile.ts:9-12).
  • Vitest uses isolate: false, sharing a happy-dom window across files in a worker (apps/web/vite.config.ts:41-49). Shared setup restores stubbed globals but does not restore direct property assignments.
  • chat-composer.configuration.test.tsx:153-157 directly sets innerWidth=320 and innerHeight=480 without restoring them.
  • option-field.test.tsx:45-65 directly assigns viewport width, window.matchMedia, and DOM prototype methods without restoring them. Its media implementation reports mobile from the current innerWidth.
  • Both of those files completed before the failing sidebar test in the CI log. That does not prove they ran in the same worker, but the ordering and role mismatch are consistent with shared mobile viewport state.
  • apps/web/src/test-setup.ts:10-55 explicitly documents the shared-window rules and central restoration requirement; direct window patches bypass unstubGlobals.

Suggested verification and fix scope

  1. Run the sidebar test alone as a desktop baseline with the pinned apps toolchain.
  2. Reproduce serially in one no-isolate worker after the viewport-mutating tests, with controlled order (do not assume CLI file order is honored). Record the width/media result at sidebar render without retaining unrelated user data.
  3. Confirm a mobile viewport explains the exact missing-role signature, and add a deterministic negative control.
  4. Restore viewport/media test-global state according to the existing central setup rules, or pin the intended desktop environment with correctly restored test stubs. Keep separate mobile coverage of the inline folder surface; do not change production accessible roles merely to satisfy this desktop test.
  5. Re-run the ordered reproducer and full no-isolate suite repeatedly. Avoid simply increasing the 1-second lookup timeout.

Prior-issue search

Searched open and closed issues for session-sidebar.pinning, Move to folder, matchMedia, sidebar flake, and Studio flake terms, and read the matching tracker entries. No matching existing issue found.

Related but distinct:

No code changes or reruns are included in this report.

Activity

  1. added
    flake
    on Oct 29, 2026
  2. added a commit that references this issue on Oct 29, 2026
    d63e94b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    flake

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions