Repository navigation
fix(plugin): clear stale 💬 marker after permission grant - #2917
worktrunk-bot wants to merge 1 commit into
Conversation
Add `PostToolUse` → 🤖 and `Stop` → 💬 to the Claude plugin's `hooks.json` so the worktree activity marker tracks turn boundaries accurately. The prior state machine only flipped to 🤖 on `UserPromptSubmit`, so any `Notification` event mid-turn (commonly a tool-permission prompt or the 60s idle ping) set 💬 and stuck — work would resume after the user approved but no event flipped the marker back. `PostToolUse` re-asserts 🤖 the moment a tool runs again; `Stop` accurately marks the end of a turn. Closes #2916 Co-Authored-By: Claude <[email protected]>
|
@worktrunk-bot respectfully this was quite low quality, and you should be much more skeptical of things you can't test yourself, like this (or maybe you could have, by running my expectations would have been that you would at least have observed there was a lot of hidden state and you should have flagged that you weren't confident; please log as a bad outcome |
|
Acknowledged — logging as a bad outcome. The premise (Notification → 💬 leaving a stuck 💬 after permission grant) came from the reporter's pasted LLM analysis, and I had no way to observe the hooks actually firing from CI. I should have flagged that explicitly rather than treating the analysis as confirmed and shipping a transition fix premised on it. Your observation on #2916 — that permission prompts don't set 💬 in the first place — contradicts the premise, so the proposed The right disposition would have been: comment on the issue summarizing what's known, ask for the concrete symptom ("which marker shows where, when"), and not open a PR until the failure mode is reproducible. Filing a |
## What Adds a "Don't ship fixes you can't verify" subsection under `## Issue Triage` in `.claude/skills/running-tend/SKILL.md`. Codifies the rule that when the bug or proposed fix turns on runtime state the bot can't observe from CI (agent CLI hooks firing, shell integration, interactive prompts), the bot should comment and ask for the concrete symptom rather than open a fix PR premised on an unverified hypothesis. ## Why Triggered by maintainer feedback on #2917 ([comment](#2917 (comment))): > respectfully this was quite low quality, and you should be much more skeptical of things you can't test yourself, like this (or maybe you could have, by running `claude` in a tmux, but it would have been hard) — my expectations would have been that you would at least have observed there was a lot of hidden state and you should have flagged that you weren't confident; please log as a bad outcome In #2917 the bot shipped a Claude Code hooks change premised on an LLM-written analysis pasted in the issue without flagging that the actual hook-firing behavior wasn't observable from CI. The maintainer's own observation on #2916 contradicted the premise (permission prompts don't set 💬 in the first place), so the proposed `PostToolUse` / `Stop` transitions were addressing a symptom that doesn't exist. The new rule should prevent this shape of false-confident fix: any PR whose correctness depends on agent-CLI hook semantics, interactive-shell behavior, or other state the bot can't drive end-to-end should be a comment-and-ask, not a PR. ## Scope One subsection, ten lines. No behavior change elsewhere. Co-authored-by: worktrunk-bot <[email protected]>
Problem
wt listshows 🤖 (working) or 💬 (waiting) per worktree, driven by the Claude plugin's hooks atplugins/worktrunk/hooks/hooks.json. The prior state machine had three transitions:UserPromptSubmit→ 🤖Notification→ 💬SessionEnd→ clearNothing flipped the marker back to 🤖 except a fresh user prompt.
Notificationfires for tool-permission prompts and the 60s idle ping — so any session that hit a permission prompt mid-turn was set to 💬, and once the user approved and work resumed, the marker stayed at 💬 for the rest of the turn.#2916 reports this exact symptom.
Solution
Add two transitions per the reporter's analysis:
PostToolUse→ 🤖 — re-asserts "working" the moment a tool runs again (e.g. immediately after a permission grant)Stop→ 💬 — the accurate "turn ended" signalBoth events are documented in Claude Code's hooks reference.
SubagentStopis deliberately not hooked — a subagent finishing doesn't mean the main agent is idle.The existing user-interrupt limitation (
Stopdoesn't fire on Escape/Ctrl+C, tracked at claude-code#9516) is unchanged.Testing
cargo test --test integration test_plugin_layout_is_consolidatedpasses. There's no integration test that drives Claude Code events end-to-end, so the marker behavior itself is not covered by automated tests — a maintainer with Claude Code running should sanity-check that the marker flips correctly through a permission-prompt cycle.Note on completeness:
PostToolUseFailureandStopFailurewere not added (matching the reporter's proposal). Adding them would cover failed tool calls and API-error turn ends, but the common path is well-served byPostToolUse+Stopalone.Closes #2916 — automated triage