Add structured daemon waiting input#848
Open
TZZheng wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a structured waiting-input path for daemon CLI backends so a daemon can explicitly request parent/human input instead of burying a clarification question in final prose.
What changed
daemon_common.ask_human(question, choices?, default?, reason?)for MCP-capable daemon backends.waiting_inputstate.done/failed/cancelled/timeout.failedso a daemon cannot remain stuck asrunningif it bypasses MCP validation.Why
Claude Code print mode (
claude --print) is not an interactive terminal: stdin is not a TTY, and clarification questions emitted as prose are only final/stdout text. A daemon needs a structured signal for "I need input" so the parent can receive a notification and decide whether to answer, ask the human, cancel, or rerun.Non-goals / deferred
claude --printcan block on stdin.Validation
git diff --check canonical/main...HEADPYTHONPATH=src python -m py_compile src/tools/daemon/__init__.py src/tools/daemon/run_dir.py src/lingtai/mcp_servers/daemon_common/server.pyPYTHONPATH=src python -m pytest -q tests/test_daemon_waiting_input.py tests/test_daemon_run_dir.py tests/test_daemon_terminal_state_gate.py tests/test_daemon_check.py— 111 passedPYTHONPATH=src python -m pytest -q tests/test_daemon*.py— 479 passedReview
run_id: Nonebehavior.