Skip to content

Stop tutorial replay Play events from feeding a layout crash loop #3704

Closed

Description

@janicduplessis

Problem

Clicking Play on a device replay during the tutorial crashed the maintainer's signed Stim Desktop 0.1.27 (2358) on macOS 27.0 (26A428). AppKit raised from _postWindowNeedsUpdateConstraints while tutorial progress published another update during window layout.

Evidence

  • User supplied crash screenshot and Play/replay trigger.
  • Local report: ~/Library/Logs/DiagnosticReports/StimDesktop-2026-10-13-132059.ips, timestamp 2026-10-13 13:20:59 -0400; EXC_BREAKPOINT/SIGTRAP, faulting main thread.
  • Application exception frames 22-24: TutorialModel.update -> RootView.updateTutorial -> RootView's tutorial viewer-event subscription, inside NSHostingView.layout.
  • At origin/main 4895e71, DeviceViewer.swift's ReplayingContent creates replay.$replay.map { ($0?.rate ?? 0) > 0 }.removeDuplicates() inside its body and reports onPlay whenever the subscription receives true.
  • onPlay appends TutorialViewerEvents.replayPlayed; RootView subscribes and updates published tutorial state. Rebuilding the view creates a new mapped publisher with fresh duplicate state; the current true playback value can report Play again.
  • Earlier tutorial Lottie fix fix(desktop): give the tutorial illustration a fixed size so Lottie stops a constraints loop #3418 is already present. Latest Lottie release remains 4.6.1; upstream perf: list simulators once between device setup and the boot check #2678 was closed unmerged. Broad AppKit/SwiftUI constraint-loop reports exist, but no released fix resolves this local replay event cycle.

Cause

Unknown. The crash stack confirms tutorial viewer-event delivery during NSHostingView.layout. The recreated-current-value-subscription loop is an unconfirmed hypothesis: two isolated hosting probes using the exact source stayed stable through parent/content redraws and pause/resume, emitting one then two Play events. Full tutorial/viewer reproduction is still required before applying a production fix.

Fix idea

First reproduce the full tutorial/viewer interaction and inspect the event sequence during window layout. Any fix must preserve one Play event per actual paused-to-playing transition and normal replay behavior. Verify redraws and pause/resume with an owned Desktop copy; use behavioral coverage rather than source-text assertions.

Activity

  1. janicduplessis commented on Oct 13, 2026

    @janicduplessis
    CollaboratorAuthor

    Claimed: fix/3704-tutorial-replay-loop

  2. janicduplessis commented on Oct 13, 2026

    @janicduplessis
    CollaboratorAuthor

    The crash report confirms tutorial viewer-event delivery during NSHostingView.layout. Two isolated native NSHosting probes using the exact ReplayingContent source remained stable through parent/content redraws and pause/resume (1 then 2 Play events). The repeated-subscription explanation is therefore a hypothesis, not a confirmed cause; no production patch has been applied. Continuing with the full tutorial/viewer interaction in a separate locally owned Desktop copy.

  3. added
    type: bugBreaks documented or expected behavior
    priority: P1Next up: user-facing defect or unblocks other work
    on Oct 20, 2026
  4. janicduplessis commented on Oct 26, 2026

    @janicduplessis
    CollaboratorAuthor

    Released: stale claim. It was claimed 12.5 days ago, with no open pull request and no later release. Under the issue workflow a claim older than one day doesn't hold, so this issue is free to pick up. The branch fix/3704-tutorial-replay-loop is still on origin and is kept, since it may hold unfinished work.

  5. janicduplessis commented on Oct 27, 2026

    @janicduplessis
    CollaboratorAuthor

    Claimed: fix/3704-tutorial-replay-loop-v2

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

    area: desktopapps/desktoppriority: P1Next up: user-facing defect or unblocks other worktype: bugBreaks documented or expected behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions