Repository navigation
fix(mod): report blank worker turns only, not refusals - #69
Merged
Merged
Conversation
Measured on Claude Code 2.1.296, a real API refusal ends the turn through StopFailure (error invalid_request), then turn.complete with reason refusal, and fires no classic.Stop. The worker-answer mod only posts after reading the main-loop Stop, so its refusal branch never ran. API errors behave the same, and neither carries background_tasks, so the mod cannot tell a failed turn with nothing running from one whose background work resumes it later; posting would answer the errand twice. The tests that pinned "a refusal posts unanswered refusal" asserted a contract the provider never delivers: they fed a Stop before a refusal completion, which Claude Code 2.1.296 does not produce. They are replaced by a test that a refusal turn (turn.complete reason refusal, no Stop) posts nothing.
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.
Measured on Claude Code 2.1.296: a real API refusal ends the turn through
StopFailure(errorinvalid_request), thenturn.completewith reasonrefusal, and fires noclassic.Stop.hooks/worker-answer.jsposts only after reading the main-loop Stop, so its refusal branch never ran: zero POSTs to/mod/answer.API errors behave the same, and neither carries
background_tasks, so the mod cannot tell a failed turn with nothing running from one whose background work resumes it later. Posting would answer the errand twice.hooks/worker-answer.js: drop the refusal branch; only a blank Stop posts{unanswered: "blank"}. The comment states the measured behaviour for refusal and error.docs/mod-answer.mdandCHANGELOG.md[Unreleased]: the plugin reports blank turns only; refusal and API errors are not reported. Fixtures untouched; the lich contract still acceptsrefusal.Checked:
node --test tests/*.test.mjs(392 pass),claude plugin test .(33 pass),claude plugin validate .claude-plugin/plugin.json(passed).