Skip to content

fix(hook): resolve the async gate when an absorbed notification leaves the queue - #99

Closed
charan-rathore wants to merge 3 commits into
langfuse:mainfrom
charan-rathore:fix-96-absorbed-notification-gate
Closed

charan-rathore wants to merge 3 commits into
langfuse:mainfrom
charan-rathore:fix-96-absorbed-notification-gate

Conversation

@charan-rathore

Copy link
Copy Markdown

Summary

Fixes #96. Claude Code 2.1.281 can absorb a background Bash completion into a running turn, then write a queue-operation remove row with the notification content. The hook treated that row as another enqueue, so the async gate stayed closed at Stop. The final turn could be left untraced if no later prompt arrived.

Treat a content-bearing remove as resolution of that notification. A remove without content still cannot be matched and keeps the existing conservative behavior.

Tests

Added offline Python hook regressions for a mid-turn absorbed notification and a contentless remove. An integration fixture uses the issue's Claude Code row shapes and checks that the final turn exports at its own Stop without a later prompt or SessionEnd, and does not duplicate on another idle invocation.

uv run --offline --group dev -m pytest -q: 282 passed. The two touched test files also passed (11 tests). python3 -m compileall and git diff --check passed. Dependencies were installed from the package index once to set up the test environment; test runs were offline. No live Langfuse or Claude CLI was used.

Instinct assisted with the change and tests.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Turns with a background command never export at Stop: absorbed_mid_turn notification keeps the async gate closed

2 participants