Skip to content

fix(wrapper): poll-based TUI readiness replaces fixed sleep#46

Merged
SamPlvs merged 1 commit into
mainfrom
claude/lucid-swirles
Apr 15, 2026
Merged

fix(wrapper): poll-based TUI readiness replaces fixed sleep#46
SamPlvs merged 1 commit into
mainfrom
claude/lucid-swirles

Conversation

@SamPlvs
Copy link
Copy Markdown
Owner

@SamPlvs SamPlvs commented Apr 15, 2026

Summary

  • Replaced fragile time.sleep(8) in tmux launch with poll-based TUI readiness detection
  • _wait_for_tui_ready() polls tmux capture-pane every 1s for up to 30s, requiring 2 consecutive stable readings
  • _verify_prompt_submitted() retries paste once if TUI didn't receive it, logs prompt file path for manual recovery
  • Adapts to any machine speed automatically — no more per-machine timing calibration
  • Self-evolution: PR-031 (never use fixed sleeps for external process readiness)

Root cause

time.sleep(8) was calibrated on Mac Mini. GPU server (different hardware, extensions, cold-start latency) wasn't ready after 8s. tmux paste-buffer is fire-and-forget — silently drops the prompt with no error. User saw a blank Claude Code session.

What changed

  • src/zo/wrapper.py: _wait_for_tui_ready(), _verify_prompt_submitted(), _capture_pane() methods
  • memory/zo-platform/PRIORS.md: PR-031 added

Test plan

  • 524 tests passing, 7 skipped
  • ruff check clean
  • validate-docs.sh 10/0 (Check 8 confidentiality clean)
  • Live test on GPU server (blocked on merge)

🤖 Generated with Claude Code

Replaced time.sleep(8) in _launch_tmux() with _wait_for_tui_ready()
which polls tmux capture-pane every 1s for up to 30s, requiring 2
consecutive stable readings with >100 chars. Added
_verify_prompt_submitted() which retries paste once if the TUI didn't
receive it, with fallback to logged prompt file for manual recovery.

Fixes blank Claude Code session on GPU server where 8s was insufficient
for cold start. Adapts to any machine speed automatically.

PR-031 added to PRIORS — rule: never use fixed sleeps for external
process readiness, always poll for a readiness signal.

524 tests, ruff clean, validate-docs 10/0/1.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying zero-operators with  Cloudflare Pages  Cloudflare Pages

Latest commit: 614693f
Status: ✅  Deploy successful!
Preview URL: https://788dee30.zero-operators.pages.dev
Branch Preview URL: https://claude-lucid-swirles.zero-operators.pages.dev

View logs

@SamPlvs SamPlvs merged commit c47ac10 into main Apr 15, 2026
1 check passed
@SamPlvs SamPlvs deleted the claude/lucid-swirles branch April 15, 2026 12:38
SamPlvs added a commit that referenced this pull request Apr 30, 2026
fix(wrapper): poll-based TUI readiness replaces fixed sleep
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.

1 participant