Fix Grok and Pi terminal title normalization and status detection#7880
Conversation
…on boundary Desktop already collapses Grok Build's rotating working frames via the renderer's normalizeTerminalTitle, but the main process stored raw OSC titles, so mobile session tabs (fed from pty.lastOscTitle) still saw a distinct title every spinner frame and re-touched snapshots each time. Apply normalizeTerminalTitle once where main records an observed OSC title, before the prevTitle comparison that gates session-tab and mobile-snapshot touches, and normalize hydration-seeded titles the same way so the first live frame after a seed compares equal. Agent status stays detected from the raw title, mirroring the renderer tracker. Covers remoted/SSH PTYs too since they surface through the same main observation path. Co-authored-by: Orca <help@stably.ai>
- Require a strict "spinner - phrase - grok" pattern for Grok working titles to prevent false positives on other agent tasks ending in "- grok" (such as Claude or Codex). - Treat collapsed "Pi" and "OMP" synthetic titles as idle by default to prevent them from reverting to neutral status after normalization. - Prevent duplicate mobile session tab updates during Grok status frame rotations by ensuring they normalize to a stable title.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR modifies terminal title handling for agent status detection. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
36 commits from main incl. the v1.4.130 release. Two conflicts, both the branch-guide pattern (our restructured shape wins; main's new semantics graft in): - pty-dispatcher.ts (eager-buffer exitHandler): kept our releaseDeliveryInterest() (hidden-delivery-gate ref-count invariant) AND grafted main's identity guard (#7894 detach/attach remount race) around the handler deletions. - orca-runtime.ts: (1) kept our isCursorNativeAgentTitle import; (2) OSC-title path — kept our 4-arg trackHeadlessTerminalData(...forwardQueryReplies) and the shared per-PTY title tracker, dropped main's superseded inline OSC extraction. Grafting main's #7863 Grok/#7880 Pi title-normalization required a real fix, not just keeping our block: the runtime's normalizeTerminalTitle re-export chain (agent-detection → agent-title-status.ts) lacked the Grok-collapse branch main added to the sibling terminal-title-display.ts impl. Added isGrokRotatingWorkingTitle collapsing to agent-title-status.ts and made applyTrackedPtyTitle store the NORMALIZED title (matching main's inline block) — restores 4 Grok/Pi runtime tests. Gates: typecheck 0 errors; lint 0 errors; terminal-pane+ipc/pty+daemon+pane-manager 4574 passed; runtime+renderer-runtime+shared 4063 passed / 0 failed. Co-authored-by: Orca <help@stably.ai>
Summary
Collapses high-churn rotating terminal title frames (such as Grok spinner frames and Pi idle frames) at the observation boundary in the runtime. This prevents mobile session tabs and snapshots from thrashing and republishing on every single animation frame. It also ensures normalized titles (e.g., bare "Pi" or collapsed "⠋ Grok") are correctly seeded during hydration and still classify under their respective idle or working statuses.
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAI Review Report
The code review verified that collapsing rotating spinner/tool frames at the main observation boundary successfully stabilizes mobile session tabs without affecting state transitions. Cross-platform compatibility for macOS, Linux, and Windows was explicitly reviewed; terminal title sequence extraction and Unicode-based spinner regexes behave identically across all target platforms.
Security Audit
The security audit evaluated the new regular expressions for ReDoS risks. The updated
GROK_ROTATING_FRAME_REuses structured boundaries and does not suffer from catastrophic backtracking under expected terminal title lengths. No new IPC, command execution, or sensitive path manipulation hazards were introduced.Notes
No platform-specific regressions are expected as the title parsing and normalization logic relies on cross-platform core runtime services.