Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/prime/src/prime_lab_app/eval_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import re
from collections.abc import Callable, Sequence
from pathlib import Path
from typing import Any, Literal
from typing import Any, Literal, cast

from rich.markup import escape
from rich.text import Text
from textual import events, on, work
from textual.app import ComposeResult
Expand Down Expand Up @@ -1291,7 +1290,8 @@ def _make_section(self, section: HistorySectionData) -> Collapsible:
)
return Collapsible(
*children,
title=escape(section.title),
# Textual accepts Rich Text titles, but annotates this parameter as str.
title=cast(str, Text(section.title)),
collapsed=collapsed,
classes=section.classes,
)
Expand Down
13 changes: 12 additions & 1 deletion packages/prime/tests/test_lab_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
WorkspaceScreen,
)
from prime_lab_app.eval_markdown import MathMarkdown, make_math_parser
from prime_lab_app.eval_records import LazyRunResults, LocalEvalRun
from prime_lab_app.eval_records import HistorySectionData, LazyRunResults, LocalEvalRun
from prime_lab_app.eval_render import compute_run_overview_stats, history_groups
from prime_lab_app.eval_screen import (
HostedEvalSamplesScreen,
Expand Down Expand Up @@ -1610,6 +1610,17 @@ def test_rollout_viewer_escapes_xml_in_markdown_body() -> None:
]


def test_rollout_viewer_treats_section_titles_as_literal_text() -> None:
title = "tool 2 bash ... [SUPABASE_URL=http://kong:8000 SUPABASE_ANO..."
viewer = RolloutViewer([])

section = viewer._make_section(
HistorySectionData(title=title, body="output", column="completion")
)

assert str(section.title) == title


def test_rollout_tool_calls_use_non_error_palette() -> None:
assert TOOL_CALL in RolloutViewer.DEFAULT_CSS
tool_call_block = RolloutViewer.DEFAULT_CSS.split(".tool-call-section", 1)[1].split("}", 1)[0]
Expand Down