[Fix] Treat a clarification question as a valid end of turn in Slack hooks - #3
Merged
Merged
Conversation
…hooks Asking the user a question was not an accepted terminal state: after a send_chat_reply with purpose "clarification", the stop hook blocked with current_turn_nonterminal_reply, the harness injected up to three closeout reminders, and the model dutifully posted redundant "Paused here — I'm waiting on your answer" echo messages right after the question. A clarification is a visible handoff exactly like a closeout — the turn ends waiting on the user's answer — so the anti-silence hooks now treat it as terminal, with the same staleness rule: non-Slack work after the question invalidates it and a fresh reply is required before stopping. - recordChatReplySatisfaction stamps terminal state for clarification replies, so staleness tracking applies to questions too. - The stop hook accepts clarification in its terminal-satisfaction checks (including legacy states written by pre-deploy workers); ack and progress still block. - The silence hook's terminal check mirrors the same policy so post-question work is stamped consistently. - OpenCode todo bookkeeping (todowrite/todoread) no longer stales a terminal reply: the exemption list only knew the legacy update_plan name, so a post-closeout todo update forced a redundant "closed this turn" follow-up message. - The send_chat_reply tool description now says a clarification ends the turn when the next step depends on the user's answer, and not to follow it with a separate "waiting on your answer" message. Verified end-to-end against the mock Slack harness with a live planner task: the question turn now ends cleanly (terminal state stamped, no echo for 3+ minutes where it previously arrived within one), and the answer round-trip completes with a single closeout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
2 issues outstanding (1 medium, 1 low). No new issues in the latest update (test-expectation sync only). See task
|
Contributor
|
All contributors have signed the CLA. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
Problem
When an agent asks the user a question via
send_chat_replypurposeclarificationand ends its turn, the stop hook blocks (current_turn_nonterminal_reply— onlycloseoutcounted as terminal). The harness then injects up to 3 closeout reminders, and the model posts redundant echo messages right after its own question: "Paused here for now — I'm waiting on your answer to the question above."Investigation notes (from the OpenRoomote debugging session; ported here per repo targeting):
request_user_inputbranches in both hooks are dead code (nothing writes that tool into the satisfaction state), and the structured question tool blocks the turn in-flight so the stop hook never runs while it waits.todowritebookkeeping call staled the terminal reply (the exemption list only knew the legacyupdate_planname), forcing a redundant "closed this turn" follow-up.Fix
Principle: the hooks exist to prevent turns from ending silently. A clarification question is a visible handoff exactly like a closeout — the turn ends waiting on the user's answer — so it now counts as terminal, with the same staleness rule as closeout (non-Slack work after the question invalidates it).
ackandprogressstill block; automation no-turn closeout enforcement is untouched.recordChatReplySatisfactionstamps terminal state forclarificationrepliestodowrite/todoreadcount as closeout bookkeeping and no longer stale a terminal replysend_chat_replydescription updated: a clarification ends the turn when the next step depends on the user's answer — don't follow it with a separate "waiting on your answer" messageVerification
terminal_reply_satisfied); non-Slack work after the question → block (current_turn_terminal_reply_stale); ack/progress still block; todowrite/todoread don't stale a closeoutapps/workerrun-task + satisfaction tests: 228 passed;tsc --noEmitand prettier clean🤖 Generated with Claude Code