Skip to content

feat: waiting-for-input detection and resolved state for tmux sessions#175

Draft
snibbor2 wants to merge 2 commits intoYeachan-Heo:devfrom
snibbor2:feat/waiting-for-input
Draft

feat: waiting-for-input detection and resolved state for tmux sessions#175
snibbor2 wants to merge 2 commits intoYeachan-Heo:devfrom
snibbor2:feat/waiting-for-input

Conversation

@snibbor2
Copy link
Copy Markdown

@snibbor2 snibbor2 commented Apr 8, 2026

Summary

Adds automatic detection when a monitored tmux session is blocked waiting for user input — prompts, password fields, `[y/n]` confirmations, Claude Code tool-approval dialogs, etc. — and delivers an alert to the configured Discord channel. When input is provided and the session resumes, a resolved notification is sent.

  • Detects 30+ interactive prompt patterns across the last 3 non-empty pane lines
  • Fires `tmux.waiting_for_input` event on transition from active → blocked
  • Fires resolved notification on transition from blocked → active
  • Integrates with dashboard pinning (`pin_alerts = true`) to edit the alert in-place rather than flooding the channel

Config example

[[monitors.tmux.sessions]]
session = "my-agent"
detect_waiting = true
channel = "1234567890"

Detected patterns include

  • `[y/n]`, `(y/n)`, `[yes/no]` confirmation prompts
  • `password:`, `passphrase:`, `enter password`
  • `press enter`, `press any key`
  • Claude Code / OMC tool-approval: `allow, deny`, `allow this action`, `always allow`, `approve or deny`
  • Interactive menu selectors (`❯` prefix or `? ` suffix)
  • SSH/sudo credential prompts

Three regression tests added for this case.

Test plan

  • `cargo test` — 340 tests passing (branch total)
  • Live integration tested: `read -p "Confirm? [y/n]: "` triggered alert within one poll cycle; typing `y` produced `✅ session — Input received, continuing...` edited into the alert slot within 10 seconds
  • `sudo` password prompt detected and resolved correctly
  • No false-positives during rapid continuous output

snibbor added 2 commits April 7, 2026 16:50
Add detect_waiting config option that monitors tmux panes for interactive
prompts (Y/n, tool approval, password, etc.) and emits waiting_for_input /
waiting_resolved events to Discord. Includes mention_on filtering for
selective @mention routing.
After a user answers a [y/n] or read prompt, the answered line remains
visible in the tmux capture-pane scrollback. The previous detection logic
checked the last 3 non-empty lines for waiting patterns, which caused the
session to stay locked in waiting state even after input was provided.

Fix: skip multiline pattern matches when the matched line is not the last
non-empty line and the last line looks like a completed shell prompt
(e.g. "user@host:~/dir$ "). This covers the common case where the answered
prompt line sits one or two lines above the new shell prompt.

Adds three regression tests covering:
- [y/n] prompt answered, shell prompt on last line → not waiting
- unanswered [y/n] prompt on last line → still detected
- read -p prompt answered, shell prompt on last line → not waiting
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