Skip to content

Conversation

@msmps
Copy link
Owner

@msmps msmps commented Jan 29, 2026

No description provided.

msmps added 2 commits January 29, 2026 16:43
… change detection

Adds --await-change and --settle flags to the snapshot command, eliminating
the need for manual sleep() calls in TUI automation scripts.

Features:
- --await-change <HASH>: Block until content_hash differs from baseline
- --settle <MS>: Wait for screen to be stable for N ms (handles progressive renders)
- --timeout <MS>: Maximum wait time (default: 30s) prevents infinite loops

Implementation:
- Two-phase polling in handle_snapshot: await change, then settle
- Hash tracking across phases (settle starts from await_change exit point)
- 50ms poll interval (SNAPSHOT_POLL_INTERVAL_MS constant)
- Timeout errors use configured timeout_ms value (not elapsed time)
- Timeout errors include helpful suggestions and context for debugging
- Client-side hash tracking keeps server stateless

Usage:
  HASH=$(pilotty snapshot | jq '.content_hash')
  pilotty key Enter
  pilotty snapshot --await-change $HASH --settle 50

Addresses Pain Point #4: Manual sleep required between actions.

Includes:
- Protocol changes with serde(default) for backward compatibility
- CLI args with comprehensive help text and examples
- Test: test_snapshot_await_change_detects_update
- Documentation updates to README, SKILL.md, and npm README

Reviewed by Oracle: Fixed hash tracking across phases, improved error messages.
@msmps msmps force-pushed the feat/wait-for-change branch from a7660ae to 2fdf7a3 Compare January 29, 2026 16:45
@msmps msmps marked this pull request as ready for review January 29, 2026 16:56
@msmps msmps merged commit 6c48123 into main Jan 29, 2026
5 of 6 checks passed
@msmps msmps deleted the feat/wait-for-change branch January 29, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants