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

Open 💬 3 comments Opened Jul 16, 2026 by Soontosh
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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 ↗

3 Comments

github-actions[bot] contributor · 1 month ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #32738

Powered by Codex Action

Soontosh · 1 month ago

A tested implementation is available in the draft PR at https://github.com/Soontosh/codex/pull/1.

khughitt · 24 days ago

Independent controlled reproduction on codex-cli 0.146.0, Arch Linux, Kitty, using a custom terminal pet.

I started a turn lasting longer than three minutes while recording metadata-only lifecycle hooks and external session state. The terminal pet switched from running to idle exactly 180 seconds after UserPromptSubmit. The external state remained working through 228 seconds, with no Stop, compaction, or other state-changing hook before the visual transition.

We repeated the experiment and observed the same 180-second boundary. This isolates the transition to Codex’s native RUNNING_LIFETIME, rather than the custom pet manifest, animation playback, or external lifecycle state.