Skip to content

task-bridge: de-spam note-view detection log - #254

Merged
sonichi merged 1 commit into
mainfrom
fix/note-view-watcher-log-spam
Apr 10, 2026
Merged

sonichi merged 1 commit into
mainfrom
fix/note-view-watcher-log-spam

Conversation

@sonichi

@sonichi sonichi commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Summary

PR #246 changed startNoteViewingWatcher so 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

  • `npx tsc --noEmit` clean
  • `npm test` — 48/48 passing (note: bodhi bump from today's Add demo video to README #1 fork merge pulled the cartesia optional dep, so that previously-failing test now passes; unrelated to this PR but a nice baseline)
  • Restarted voice-agent against a live `/tmp/sutando-note-viewing.json` with client disconnected → exactly 1 detection log line in a 20s tail. Before this fix: 10+ lines in the same window.

Related

🤖 Generated with Claude Code

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)
@sonichi

sonichi commented Apr 9, 2026

Copy link
Copy Markdown
Owner Author

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 lastNoteViewingLoggedTs separately from lastNoteViewingTs is exactly right: one tracks handled, one tracks logged, they decouple cleanly. Resetting both in resetNoteViewingDebounce() preserves reconnect as a visible event in the log.

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.

@sonichi
sonichi merged commit f85871f into main Apr 10, 2026
1 check passed
@sonichi
sonichi deleted the fix/note-view-watcher-log-spam branch April 10, 2026 00:15
liususan091219 pushed a commit to liususan091219/sutando-fork that referenced this pull request May 28, 2026
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)
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