feat(viewer): render run traces from a payload with a JS renderer - #987
Open
Polarisyjr wants to merge 1 commit into
Open
feat(viewer): render run traces from a payload with a JS renderer#987Polarisyjr wants to merge 1 commit into
Polarisyjr wants to merge 1 commit into
Conversation
Replaces the server-rendered HTML in trajectories/viewer.py with a payload -> render.js pipeline: Python emits data only, JS emits HTML, so `bench eval view` and the future static site share one renderer instead of drifting into two. Vendors PostTrainBench's stylesheet byte-for-byte with our additions kept in a separate bf-prefixed layer. Adds payload tests and node-driven renderer tests; updates the viewer compatibility tests to assert on the payload's turn structure.
|
Cool cool! |
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
This is Step 1 of the BenchFlow trace viewer work. More features will be added in follow-up PRs; at this stage, the main goal is to establish the rendering architecture and bring the viewer's overall style and trace presentation closer to PostTrainBench.
Refactors
bench eval viewaround a shared payload-based renderer:rollout artifacts → viewer.py → versioned payload → render.js → HTMLInstead of generating trace HTML directly in Python, Python now handles artifact normalization while JavaScript handles presentation. This also creates a shared renderer that can later be reused by a hosted/static viewer.
What changed
trajectory/acp_trajectory.jsonlas the canonical trace source, with legacyturn*.txtas a fallback.render.js.boot.js, keeping the renderer independently testable.benchflow.css.Compatibility
This does not introduce a new on-disk trace format.
The viewer payload is derived at render time and is not persisted. Existing ACP trajectory artifacts remain unchanged, and legacy Claude Code
turn*.txttraces continue to work as a fallback.When both formats exist, ACP is used as the source of truth rather than merging or rendering both.
Tests
Added two layers of viewer tests:
tests/test_trajectory_viewer.pytests/test_trajectory_viewer_render.pyrender.jsthrough Node0vs. unscoredAlso updates the trajectory integration tests for the new payload-based rendering path.
Validation
Manual E2E:
Next steps
This PR intentionally focuses on the basic single-run viewer and visual alignment with PostTrainBench.
Follow-up work will add more viewer features such as job-level navigation, verifier details, review/audit results, cost and per-call metrics, system metrics, and additional trace metadata.