TUI: terminal pet active animations fall back to idle before task state changes

Open 💬 2 comments Opened Jul 16, 2026 by Soontosh

Summary

Terminal pets are selected by a semantic app state (running, waiting, review, or failed), but their playback is currently governed by an animation timer rather than the lifetime of that state. As a result, the active animation can stop even though the task is still active.

!Before and after terminal pet lifecycle

Reproduction

  1. Enable a built-in terminal pet.
  2. Start a task that runs longer than one working-animation sequence.
  3. Watch the pet while the task is still running.

Current behavior

  • Built-in app-state animations repeat their active frames three times, then enter an appended idle tail indefinitely.
  • A running pet notification expires after a fixed three minutes even if the turn is still active.
  • Interrupting a turn does not explicitly clear the active pet notification.
  • A completion animation uses a fixed stale-notification lifetime rather than reflecting the duration of the task that just completed.

The behavior comes from app_state_animation appending idle frames and setting loop_start to that idle tail, combined with a fixed RUNNING_LIFETIME in the ambient pet state.

Expected behavior

  • The working animation loops for as long as the turn is active, with no arbitrary timeout.
  • Waiting, blocked, and ready/review animations keep playing while their corresponding visible state remains active.
  • Completion or failure replaces the working state immediately.
  • Interruption clears the working state immediately.
  • The post-task review animation lasts for the completed task's duration, capped at three minutes.
  • Transient pointer animations such as hover and drag retain their existing one-shot behavior.

This should apply uniformly to built-in and custom terminal pets.

Environment

  • Platform: Linux terminal
  • Reproduced on current main at 78d4a563f9ecaf5c331bfa4ae7332885a1d9e2f6

Related

  • #23272 tracks the analogous one-shot-to-idle behavior in the desktop pet.
  • #28995 tracks desktop overlay state animations falling back to idle.
  • #30268 requests configurable pet animation duration.
  • #20863 requests richer custom pet animation/activity configuration.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗