Skip to content

v1.0.4

Choose a tag to compare

@abullard1 abullard1 released this 13 Aug 12:48
· 7 commits to main since this release
cb8509c

A correctness release for how the hook tracks code fences across streamed
flushes. Nothing here was visibly broken: the defects sit in a concurrency
window that is hard to hit on Linux and plausible on slower platforms.

Claude Code streams one assistant message to the MessageDisplay hook as a
series of flushes and allows up to three to be in flight at once. The file
that carries "inside a code fence" from one flush to the next was written as
if flushes were sequential. Found by checking the plugin against current
Claude Code (2.1.220 through 2.1.231), not by a user report.

Fixed

  • The hook reads the message identifier from message_id, the field Claude
    Code actually sends. It looked for messageId, never found it, and fell
    back to the session id, which keyed fence state per session rather than per
    message and could bleed the fence state of one message into the next.
  • Fence state is cleared when a message ends on a newline. That final flush
    carries an empty delta, and the hook returned before reaching its own
    cleanup, leaving a stale file behind.
  • The state file is written to a temporary name and moved into place instead
    of truncated and rewritten, so a concurrent flush can never read it
    half-written and treat a code block as prose.
  • The stale-state sweep collects temporary files orphaned by an interrupted
    flush, and spares the current message's in-flight temporary file.

Internal

  • Every wire-format claim was verified against the Claude Code binary rather
    than the published hook docs (which describe delta as an object; the
    binary sends a string): field names, the empty final delta, and the
    three-flush concurrency limit.
  • Every fix is mutation-tested: reverting it makes a named test fail.
    98 tests, 94% coverage.
  • Both README version badges are now asserted against plugin.json in the
    suite; the plugin README's badge had drifted at 1.0.1.

Upgrade Notes

No configuration changes are required. This is a patch release with no
breaking changes.

Known issue

The remaining stale-read half of the flush-concurrency race, where a
concurrent flush reads a valid but outdated state, needs a reproduction and
is tracked in #8.