fix: detect permission prompts as NeedsInput when tool_use is stale (>10s)

When Claude requests a tool permission approval, the last JSONL entry is
type=assistant with stop_reason=tool_use. Previously this was always
classified as Working. Now, if the tool_use entry is older than 10s with
no new activity, it's classified as NeedsInput.

Also fix vmux label to accept fuzzy match queries (not just session UUIDs).
This commit is contained in:
Pierre Martin
2026-03-23 18:29:32 +01:00
parent 170790fcda
commit 8594c48f84
5 changed files with 162 additions and 5 deletions

View File

@@ -333,13 +333,19 @@ func (d *Daemon) handleConnection(conn net.Conn) {
writeResponse(conn, Response{Error: "invalid label args: " + err.Error()})
return
}
if err := d.labels.Set(args.SessionID, args.Label); err != nil {
// Resolve SessionID via fuzzy match if it's not a UUID
sessionID := args.SessionID
sessions := d.registry.List()
match := FuzzyMatch(sessionID, sessions)
if match != nil {
sessionID = match.SessionID
}
if err := d.labels.Set(sessionID, args.Label); err != nil {
writeResponse(conn, Response{Error: "set label: " + err.Error()})
return
}
// Update registry with new label
d.registry.mu.Lock()
if ts, ok := d.registry.sessions[args.SessionID]; ok {
if ts, ok := d.registry.sessions[sessionID]; ok {
ts.Info.Label = args.Label
}
d.registry.mu.Unlock()