Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request optimizes the timeline renderer by increasing the render timeout, capping the total backing store pixel area, and returning early when there are no rendered timelines. It also improves resilience by reconnecting and probing the bridge state on transport errors instead of unconditionally reloading. A new end-to-end test suite has been added to verify these behaviors. The review feedback identifies a critical issue where the renderer can get stuck in a permanently broken state if the page reloads while the CDP connection remains open, and suggests probing the bridge even when r.pageReady is true to recover gracefully.
| if r.pageReady { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
If the frontend page navigates away or reloads (e.g., due to memory pressure or a frontend bug) while the CDP connection remains open, r.pageReady remains true. However, the bridge (window.__khiCDPBridge) will be undefined or uninitialized.
When RenderTimeline is called in this state:
ensurePageReadyLockedreturnsnilimmediately becauser.pageReadyistrue.executeRenderLockedfails with a non-transport JavaScript evaluation error (e.g.,TypeError: Cannot read properties of undefined).- Since it is a non-transport error,
closeLocked()is not called, andr.pageReadyremainstrue. - All subsequent render requests will fail with the same error indefinitely, leaving the renderer in a permanently broken state.
To prevent this, we should probe the bridge even when r.pageReady is true. If the probe fails, we reset the state and re-initialize the page.
if r.pageReady {
ready, err := r.probeBridgeReadyLocked(ctx)
if err == nil && ready {
return nil
}
_ = r.closeLocked()
}
Go Quality Report (
|
| Metric | Result |
|---|---|
| Changed Scope | 1 prod file(s), 2 test file(s), 20 unit(s) |
| Patch Coverage | 100.0% (34/34 lines) |
| Mutation Score | 100.0% (18/18 killed, 0 survived) |
| Function Similarity | OK (1 new unit(s), 0 matches across 3222 corpus units) |
Commit: b6e7d5fc1881 · Cloud Build Logs
4f370e8 to
db7e250
Compare
…er in E2E test setup
Summary
Part 3/5 of the
render_timelinesvisual clarity, evidence manifest, andkhi-investigationskill stack.defaultTimelineRenderTimeoutto 120s so cold large-inspection loads and annotated SwiftShader renders complete reliably.maxTimelinePhysicalPixels), cleanly falling back to 1x scale on oversized wide/tall scenes.measure.RenderedCount == 0./render/mcp-timelineCDP page across non-transport failures instead of tearing down and re-navigating unnecessarily.pkg/server/mcp/timeline_renderer_e2e_test.goand hardens deterministic mock CDP unit tests inpkg/server/mcp/timeline_renderer_test.go.Stack
fix(workbench): exempt KHI synthetic IDs, globs, and K8s refs in validate_report(main<-push-qylzxxkzxpry)feat(mcp): unify annotation string IDs, fix subtree highlights, and emit resolved evidence manifest(push-qylzxxkzxpry<-push-zxtpyqnnnxrr)fix(mcp): harden Chrome timeline renderer timeouts, pixel cap, and warm session reuse(push-zxtpyqnnnxrr<-push-yyqtuxrlvmvt)feat(web): improve static timeline export clarity, leader routing, and inspection caching(push-yyqtuxrlvmvt<-push-yowxrnppozmk)feat(skills): guide visual-first two-layer reporting in khi-investigation skill(push-yowxrnppozmk<-push-nywmlvytopkk)Verification
go test -race ./pkg/server/mcp/...— PASSmake qa-fast-must QA_LANG=go— PASS (0 mustfix, 0 advisory, 0 skipped)make lint-go— PASS (0 issues)