Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ All notable changes to SkillEvaluator are documented in this file.

### Fixed

- Agent JSONL log reconstruction preserves Unicode line separators inside command,
Comment thread
Afloat16 marked this conversation as resolved.
Resolved
observation and response strings instead of treating them as record boundaries.

- GitLab JUnit collection includes nested skill folders in catalog reports.
- API caller now percent-encodes scalar OpenAPI path values as individual segments and rejects `.` and `..` values with a JSON input error.
- Direct Tier 1 validates the target, selected checks and LLM configuration before
Expand Down
11 changes: 6 additions & 5 deletions src/skillevaluator/tier3/eval_core/log_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def _attach_tool_result(
def synthetic_trajectory_from_claude_stream_jsonl(text: str) -> dict[str, Any] | None:
"""Parse Claude Code ``--output-format stream-json`` lines (tee'd to claude-code.txt)."""
steps: list[dict[str, Any]] = []
for raw_line in text.splitlines():
# JSONL records end at LF; Unicode line separators can appear inside JSON strings.
for raw_line in text.split("\n"):
line = raw_line.strip()
if not line:
continue
Expand Down Expand Up @@ -281,7 +282,7 @@ def synthetic_trajectory_from_cline_cli(text: str) -> dict[str, Any] | None:
steps: list[dict[str, Any]] = []
n = 0

for raw_line in text.splitlines():
for raw_line in text.split("\n"):
line = raw_line.strip()
if not line:
continue
Expand Down Expand Up @@ -498,7 +499,7 @@ def synthetic_trajectory_from_opencode_json(text: str) -> dict[str, Any] | None:
steps: list[dict[str, Any]] = []
saw_content = False

for raw_line in text.splitlines():
for raw_line in text.split("\n"):
line = raw_line.strip()
if not line:
continue
Expand Down Expand Up @@ -585,7 +586,7 @@ def synthetic_trajectory_from_opencode_json(text: str) -> dict[str, Any] | None:
def _iter_jsonl_dicts(text: str) -> list[dict[str, Any]]:
"""Parse JSONL lines, skipping non-JSON noise (e.g. stderr mixed into tee logs)."""
events: list[dict[str, Any]] = []
for raw_line in text.splitlines():
for raw_line in text.split("\n"):
line = raw_line.strip()
if not line.startswith("{") or not line.endswith("}"):
continue
Expand Down Expand Up @@ -991,7 +992,7 @@ def synthetic_trajectory_from_codex_txt(text: str) -> dict[str, Any] | None:
if synth and synth.get("steps"):
return synth

lines = [line.strip() for line in text.splitlines() if line.strip()]
lines = [line.strip() for line in text.split("\n") if line.strip()]
if not lines:
return None
if all(line.startswith("{") and line.endswith("}") for line in lines):
Expand Down
89 changes: 89 additions & 0 deletions tests/tier3/test_jsonl_unicode_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""JSON string content is not a JSONL record separator."""

import json

import pytest

from skillevaluator.tier3.eval_core.log_converters import (
synthetic_trajectory_from_claude_stream_jsonl,
synthetic_trajectory_from_cline_cli,
synthetic_trajectory_from_codex_json,
synthetic_trajectory_from_codex_txt,
synthetic_trajectory_from_opencode_json,
)


def _events(format_name: str, content: str) -> list[dict]:
if format_name == "claude":
return [
{
"type": "assistant",
"message": {
"content": [{"type": "tool_use", "id": "t1", "name": "Bash", "input": {"command": content}}]
},
},
{
"type": "user",
"message": {"content": [{"type": "tool_result", "tool_use_id": "t1", "content": content}]},
},
{"type": "assistant", "message": {"content": "finished"}},
]
if format_name == "cline":
return [
{"say": "command", "text": content},
{"ask": "command_output", "text": content},
{"say": "completion_result", "text": "finished"},
]
if format_name == "codex":
return [
{
"type": "item.completed",
"item": {
"type": "command_execution",
"id": "t1",
"command": content,
"aggregated_output": content,
"exit_code": 0,
},
},
{"type": "item.completed", "item": {"type": "agent_message", "text": "finished"}},
]
return [
{
"type": "tool_use",
"part": {
"type": "tool",
"tool": "bash",
"callID": "t1",
"state": {"status": "completed", "input": {"command": content}, "output": content},
},
},
{"type": "text", "part": {"type": "text", "text": "finished"}},
]


@pytest.mark.parametrize("separator", ["\u0085", "\u2028", "\u2029"])
@pytest.mark.parametrize("line_ending", ["\n", "\r\n"])
@pytest.mark.parametrize(
("format_name", "parser"),
[
("claude", synthetic_trajectory_from_claude_stream_jsonl),
("cline", synthetic_trajectory_from_cline_cli),
("opencode", synthetic_trajectory_from_opencode_json),
("codex", synthetic_trajectory_from_codex_json),
("opencode", synthetic_trajectory_from_codex_txt),
],
)
def test_literal_unicode_separators_preserve_command_and_output(format_name, parser, line_ending, separator):
content = f"echo before{separator}after"
events = _events(format_name, content)
escaped_log = line_ending.join(json.dumps(event, ensure_ascii=True) for event in events) + line_ending
literal_log = line_ending.join(json.dumps(event, ensure_ascii=False) for event in events) + line_ending
expected = parser(escaped_log)
assert expected is not None
assert separator in expected["steps"][0]["tool_calls"][0]["arguments"]["command"]

assert parser(literal_log) == expected
Loading