DashboardspotlightNever use sleep+pty_read polling loops …

Never use sleep+pty_read polling loops to check command completion

Category: preference
Confidence: 0.80
ID: 019f84a6-5db2-7172-8d81-3d3500251359
Project ID: ec1699be-a430-4fc6-879b-c437a47171b4
Cross-project: No
Recalled in other projects: 2
Source session: 0XWWVPAj2NHWgHD7s
Created: 2026-07-21 12:28:43
Updated: 2026-07-21 12:28:43

Cross-Project Recalls

ProjectHitsLast recalled
opencode 2 10d ago
opencode-lore 2 2026-07-28

Content

When running long-running shell commands via pty tools (e.g., pnpm install, builds, CI checks), do not poll for completion using sleep combined with repeated pty_read calls. Rely on the <pty_exited> signal as the sole completion indicator. Only call pty_read proactively if: (1) the user explicitly asks to see live output/logs, (2) live output is genuinely needed to make an in-progress decision, or (3) the command exits with a non-zero status requiring investigation of the output/logs. This applies broadly across sessions involving CI verification, dependency upgrades, and build/test execution — the user consistently enforces this to avoid wasteful polling behavior.

Move to: