Repository navigation
task-bridge: de-spam note-view detection log - #254
Conversation
PR #246's keep-pending-on-disconnect path retries an unhandled note-view event every 2s until the client reconnects. Each retry also logged "[TaskBridge] Note view detected: <slug>", producing ~30 identical log lines per minute whenever a user opened a note while voice was disconnected. Noticed this afternoon filling voice-agent.log with `uiuc-trip-conflicts` spam when the user's voice session was idle. Track the last *logged* ts separately from the last *handled* ts. The detection log line now fires once per unique event.ts; resetNoteView- ingDebounce() (called on reconnect) clears both so a reconnect event is visible in the log again. The underlying retry behavior from PR #246 is unchanged — we still try to deliver every 2s, which is correct. Only the log side is quieter. Test plan: - ✓ tsc clean (`npx tsc --noEmit`) - ✓ npm test: 48/48 pass (was 27/28, cartesia-tts now passes after today's bodhi bump pulled the optional dep) - ✓ Restarted voice-agent against a still-viewed note with client disconnected → exactly 1 "Note view detected" line in 20s of log tail (was 30+ previously) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
LGTM. Clean follow-up to my #246 — I introduced the keep-pending-on-disconnect retry path, and the log spam is a direct consequence I missed. Tracking The diff is 6 lines of logic + 6 of comment, which is the right ratio for this kind of invariant: the comment explains why the two tsses exist, so the next reader doesn't wonder if one is redundant. Test plan is solid — noted your drive-by observation about the cartesia optional dep no longer failing in tests after today's bodhi#1 merge. Nice incidental fix. Mergeable as-is. |
PR sonichi#246's keep-pending-on-disconnect path retries an unhandled note-view event every 2s until the client reconnects. Each retry also logged "[TaskBridge] Note view detected: <slug>", producing ~30 identical log lines per minute whenever a user opened a note while voice was disconnected. Noticed this afternoon filling voice-agent.log with `uiuc-trip-conflicts` spam when the user's voice session was idle. Track the last *logged* ts separately from the last *handled* ts. The detection log line now fires once per unique event.ts; resetNoteView- ingDebounce() (called on reconnect) clears both so a reconnect event is visible in the log again. The underlying retry behavior from PR sonichi#246 is unchanged — we still try to deliver every 2s, which is correct. Only the log side is quieter. Test plan: - ✓ tsc clean (`npx tsc --noEmit`) - ✓ npm test: 48/48 pass (was 27/28, cartesia-tts now passes after today's bodhi bump pulled the optional dep) - ✓ Restarted voice-agent against a still-viewed note with client disconnected → exactly 1 "Note view detected" line in 20s of log tail (was 30+ previously) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
PR #246 changed
startNoteViewingWatcherso an unhandled event (client disconnected) stays pending and gets retried every 2s until it's delivered. That's the right behavior, but the detection log line was firing every retry, producing ~30 identical lines per minute in `voice-agent.log` whenever the user opened a note while voice was disconnected.Noticed this afternoon — the log was eating itself with:
```
21:46:28 [TaskBridge] Note view detected: uiuc-trip-conflicts
21:46:30 [TaskBridge] Note view detected: uiuc-trip-conflicts
21:46:32 [TaskBridge] Note view detected: uiuc-trip-conflicts
... (continues at 2s intervals forever)
```
Fix
Track `lastNoteViewingLoggedTs` separately from `lastNoteViewingTs` (which tracks handled, not logged). The detection log line now fires once per unique `event.ts`. `resetNoteViewingDebounce()` (called on client reconnect) resets both, so a reconnect is still a visible event in the log.
The underlying retry behavior is unchanged — still polling every 2s, still calling `onNoteView` on each retry, still picking up the event on reconnect. Only the log-write side is quieter.
Test plan
Related
🤖 Generated with Claude Code