feat(dashboard): expose tool context and rendered tokens - #3377
Merged
Conversation
This reverts commit 03a6ed8.
rasdani
marked this pull request as ready for review
August 25, 2026 02:52
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f9df7ec. Configure here.
Contributor
Author
mikasenghaas
approved these changes
Aug 25, 2026
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
trace.toolsas a distinct, collapsible model-context block in the Messages view, with tool counts/names, full descriptions, formatted parameter schemas, and per-item/schema/all copy actionsRenderedview that decodes recorded post-renderertoken_idsfor the selected trace and branch as a full sequence, retaining special tokens and offering decoded-text and authoritative-ID copy actionsMessagesandRenderedwith theText,Advantage,Logprob,Mask, andContentsignal dropdown, with explicit unavailable states for missing IDs, missing model metadata, tokenizer load failures, and decode failuresDetails
The Messages view continues to render literal
message.content. Tool definitions are shown immediately after the first system message in a purple-accented context card, so they are not presented as system-message text; traces without a system message keep the card at the top. The collapsed row shows the count and normalized names; expanding it exposes each full description and scrollable JSON schema. Direct tool objects, OpenAI-stylefunctionwrappers, multiple definitions, missing fields, and malformed values degrade to readable fallback labels.Rendered does not rerun or infer a chat template. The server uses
client.renderer_model_namewith the existing run-model fallback, concatenates the recorded node spans in the selected root-to-leaf order, and calls the tokenizer once for the full sequence with special-token skipping disabled. The selected branch controls which decoded sequence is shown; the all-branches option uses recorded node write order. WithTextselected, Rendered shows that exact full-sequence decode. With another signal selected, it shows the same recorded sequence as token spans with the existing color scale and token hover metadata.Compatibility is intentionally additive: the default endpoint response and default Messages/Text display stay unchanged, token strings are still fetched lazily for overlays, and full rendered text is only added when
rendered=trueis requested. The mode buttons and signal dropdown are independent, and a one-time preference migration recovers sessions that briefly savedRenderedin the signal field.Episode navigation and token/render enrichment use separate request lifecycles. Opening or closing an episode invalidates prior enrichment, while changing controls during an in-flight open no longer discards the episode response; the newly opened episode then picks up any enrichment required by the latest controls. Decode failures remain branch-local in the viewer: valid text for the selected branch is shown even if another branch fails to decode.
Verification
uv run --no-sync ruff format --check src/prime_rl/dashboard/server.pyuv run --no-sync ruff check src/prime_rl/dashboard/server.pyuv run ruff check src/prime_rl/dashboardnode --check src/prime_rl/dashboard/static/app.jsgit diff origin/main...HEAD --check<|im_start|>/<|im_end|>markers, separate branch text, all-node ordering, and existing per-token piecesVisual description
A compact
Tool definitions · 3 tools · lookup, calculate, tool 3row appears directly after the system message. It expands into nested tool cards with full prose and scrollable monospace schemas.Messages/Renderedbuttons sit beside a signal dropdown containingText,Advantage,Logprob,Mask, andContent. Either mode can use any signal; Rendered/Text shows the exact decoded transcript, while Rendered with an overlay shows colored token spans. A hover tooltip describes the signal choices. A screenshot is not included because a browser runtime was unavailable in the checkout used for verification.Note
Low Risk
Additive dashboard and optional episode API fields; no changes to training, auth, or data persistence beyond larger lazy-loaded episode payloads.
Overview
The trace viewer adds Messages vs Rendered modes and surfaces
trace.toolsas model context separate from message text.In Messages, tool definitions appear in a collapsible context block (after the first system message when present), with descriptions, parameter schemas, and copy actions; message bodies still show literal
message.content. Rendered decodes recorded post-renderertoken_idsper branch (or all nodes) viarenderer_model_namewith run-model fallback—no chat-template reconstruction—and reports missing IDs, model, tokenizer, or decode failures.The episode API accepts optional
tokensandrenderedquery params;rendered_token_texton the server concatenates branch paths and decodes full sequences with special tokens retained. The UI lazily fetches enrichment, versions open/enrichment requests to avoid stale responses, and shares the Text / Advantage / Logprob / Mask / Content signal dropdown across both modes.Reviewed by Cursor Bugbot for commit 596f7d3. Bugbot is set up for automated code reviews on this repo. Configure here.