Skip to content

hotfix(v1.25.1): wire multi-turn hook + accept new telemetry kind#47

Merged
masonwyatt23 merged 3 commits intomainfrom
hotfix/v1.25.1-multi-turn-wiring
Apr 29, 2026
Merged

hotfix(v1.25.1): wire multi-turn hook + accept new telemetry kind#47
masonwyatt23 merged 3 commits intomainfrom
hotfix/v1.25.1-multi-turn-wiring

Conversation

@masonwyatt23
Copy link
Copy Markdown
Collaborator

Summary

v1.25 shipped the multi-turn-stale tracker as dead code — two wiring gaps stopped the feature from doing anything in production:

  1. hooks/posttooluse-stale-result.ts was never registered in hooks/hooks.json. The hook code was correct and tested, but Claude Code never invoked it, so:

    • ~/.ashlr/session-history/<sessionId>.jsonl was never written
    • The 50 KB stale-byte nudge never fired
    • /ashlr-compact had nothing to read
    • multi_turn_stale_estimate telemetry was never emitted
  2. The server's /v1/events route silently rejected the new kind. server/src/routes/telemetry.ts uses z.enum(KIND_VALUES) and KIND_VALUES did not include "multi_turn_stale_estimate", so even when (after fix Add SafeSkill security badge (55/100 — Use with Caution) #1) the client tries to emit the event, Zod returns 400 and the data never reaches telemetry_events.

What changed

File Change
hooks/hooks.json New PostToolUse entry matching Read|Grep|mcp__plugin_ashlr_ashlr__ashlr__read|mcp__plugin_ashlr_ashlr__ashlr__grephooks/posttooluse-stale-result.ts
server/src/routes/telemetry.ts Add "multi_turn_stale_estimate" to KIND_VALUES
__tests__/hooks-json-registration.test.ts (new) Guardrail asserting every critical hook script is wired up in hooks.json under the right event + matcher. Catches the exact class of bug that hid the original miss.
server/tests/telemetry.test.ts New case asserting the server accepts + persists the new kind with full payload shape.

Stats

  • 2690 plugin pass / 0 fail / 3 skip (one new regression test)
  • 308 server pass / 0 fail (one new ingest test)

Test plan

  • CI green on macOS / Linux / Windows
  • Post-deploy: fly deploy server → curl /v1/events with multi_turn_stale_estimate event → 200 + row in telemetry_events
  • Local: bun test __tests__/hooks-json-registration.test.ts → 4 pass
  • Local: in a real session, do 6+ Read/Grep calls → confirm ~/.ashlr/session-history/<sessionId>.jsonl populates and the 50KB nudge fires once

🤖 Generated with Claude Code

masonwyatt23 and others added 2 commits April 29, 2026 13:41
The v1.25 multi-turn-stale tracker shipped non-functional:

1. `hooks/posttooluse-stale-result.ts` was added but never registered
   in `hooks/hooks.json`, so the hook never fired and stale-byte tracking
   accumulated nothing. Adds a PostToolUse entry matching Read/Grep tools
   (matches the TRACKED_TOOLS set inside the hook).

2. `server/src/routes/telemetry.ts` validates `kind` against a closed
   `KIND_VALUES` enum, so client-emitted

Assisted-By: ashlr-plugin <https://plugin.ashlr.ai>"multi_turn_stale_estimate"
   events were silently rejected (Zod `z.enum`) before reaching the DB.
   Adds the new kind to the allowlist.

Regression coverage:
- `__tests__/hooks-json-registration.test.ts` — guardrail asserting that
  every critical hook script is referenced from hooks.json under the
  correct event + matcher. Catches the exact class of bug that hid this.
- `server/tests/telemetry.test.ts` — new case asserting the server
  accepts and persists multi_turn_stale_estimate with the documented
  payload shape (sessionTurnCount, staleBytes, staleResults).

2690 plugin pass / 308 server pass / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Hosted Windows runners briefly hold file handles after a sqlite-spawning
subprocess exits. The afterEach `rm(force:true)` was racing the OS handle
release and yielding EBUSY, surfacing as 2 flaky failures in
__tests__/sql-server.test.ts:170 and ~419 with no actual test problem.

Wrap rm in a small Windows-only retry (8 attempts, ~50–400 ms backoff;
caps total wait at ~750 ms before giving up). POSIX hosts still get a
single attempt — no behavior change there.

Local: 15 pass / 1 skip / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
site Ready Ready Preview, Comment Apr 29, 2026 5:56pm

Request Review

…lakes

bun:test's default 5000ms timeout is too tight on hosted Windows runners
for tests that spawn child bun processes plus shell scripts (git init,
500/300-file creation). When the test exceeds 5s, afterEach also fails
with EBUSY because the still-running subprocess holds tempdir handles.

Bumps to 30s for:
- ashlr-bash: recognized-command git status NOT re-summarized (sh + bun + 500 files)
- ashlr-tree: large dir 300+ files (writeFile×300 + bun)
- grep confidence: multiple genome sections (buildProject + bun)

POSIX hosts well under 1s — no behavior change there.

Local: 33 pass / 0 fail across the three files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@masonwyatt23 masonwyatt23 merged commit 5d6df57 into main Apr 29, 2026
15 checks passed
@masonwyatt23 masonwyatt23 deleted the hotfix/v1.25.1-multi-turn-wiring branch April 29, 2026 18:00
masonwyatt23 added a commit that referenced this pull request Apr 29, 2026
…48)

Bumps plugin version to 1.25.1 and documents the hotfix already merged
to main in PR #47:

- Multi-turn-stale hook now actually fires (was unregistered in 1.25.0)
- Server /v1/events accepts multi_turn_stale_estimate (was rejected)
- New regression test guards hooks.json registration going forward
- Three Windows test flakes hardened (rm retry + per-test timeouts)
- Phase 1 smoke realtime: 500 ms → 2000 ms visibility deadline on Windows

Also gitignores server/*.db{,-wal,-shm} so local sqlite dev runs no
longer leak into git status.

Co-authored-by: Mason Wyatt <masonwyatt23@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (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.

1 participant