chore(debug): add flag-gated event tracing to bridge + session panel#84
Open
chore(debug): add flag-gated event tracing to bridge + session panel#84
Conversation
Adds a tiny debug-flag module (web/lib/debug-flag.ts) and dlog tracepoints
inside the SSE→bridge→panel pipeline so the next time the intermittent
non-rendering bug recurs we can capture ground-truth data instead of
guessing.
Enable via:
- URL: http://localhost:3000/?debug=events
- Or: localStorage.setItem('AGENT_FLOW_DEBUG', 'events')
When the flag is off, dlog is a single-branch no-op — no behavioral
change to the bridge or panel.
Tracepoints:
- bridge.onEvent: per-event arrival with type, sessionId, drop-mode,
selected-match
- droppingRef early-return path
- per-session buffer push
- sessionsWithActivity DEDUP vs ADD branches
- flushSessionEvents entry
- dismissed-session re-add path
- rAF eventVersion bump
- SessionCanvasPanel render: logLen / newEvents / consumed
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tracing-only change. Adds a flag-gated `dlog` so we can capture exactly which leg of the SSE → bridge → panel pipeline drops events when the intermittent non-rendering bug recurs. Silent by default — no behavioral change unless the flag is enabled.
Enable
Tracepoints
`use-vscode-bridge.ts` (9 dlog calls):
`session-canvas-panel.tsx` (1 dlog call):
Test plan
🤖 Generated with Claude Code