Skip to content

fix: normalize whitespace in completion promise before comparison#52415

Open
sakal-s wants to merge 1 commit intoanthropics:mainfrom
sakal-s:fix/whitespace-normalization-stop-hook
Open

fix: normalize whitespace in completion promise before comparison#52415
sakal-s wants to merge 1 commit intoanthropics:mainfrom
sakal-s:fix/whitespace-normalization-stop-hook

Conversation

@sakal-s
Copy link
Copy Markdown

@sakal-s sakal-s commented Apr 23, 2026

Summary

  • Normalize whitespace in the stored COMPLETION_PROMISE before comparing it to the extracted promise text
  • The extracted text was already normalized via perl (s/\s+/ /g), but the stored value was not, causing comparison failures when the promise contained multiple consecutive spaces

Test plan

  • Set a completion promise with multiple spaces: --completion-promise "TASK DONE"
  • Verify the promise is detected when output contains <promise>TASK DONE</promise> (single space)
  • Verify normal single-space promises still work

Fixes #52405

🤖 Generated with Claude Code

The promise text extracted from output has whitespace normalized via
perl (s/\s+/ /g), but the stored COMPLETION_PROMISE was compared
as-is. If the user set a promise with multiple consecutive spaces
(e.g. 'TASK    DONE'), the comparison would always fail because the
extracted text would be 'TASK DONE' while the stored value remained
'TASK    DONE'.

Normalize whitespace in the stored promise before comparing.

Fixes anthropics#52405

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Bug: Whitespace normalization mismatch in Ralph Wiggum stop hook causes completion promise comparison to fail

2 participants