Skip to content

Write rollout traces to summaries#748

Open
derek-tml wants to merge 4 commits into
gh/derek-tml/4/basefrom
gh/derek-tml/4/head
Open

Write rollout traces to summaries#748
derek-tml wants to merge 4 commits into
gh/derek-tml/4/basefrom
gh/derek-tml/4/head

Conversation

@derek-tml

@derek-tml derek-tml commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a RolloutTrace dataclass for structured per-step transcript data.
  • Carries StepResult.trace into Transition.trace.
  • Writes steps[].trace and steps[].stop_reason into rollout summary JSONL records.

Stack from ghstack (oldest at bottom):

Co-authored-by: Cursor cursoragent@cursor.com

[ghstack-poisoned]
derek-tml added 3 commits May 31, 2026 23:11
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@derek-tml derek-tml requested review from dphuang2 and joschu June 1, 2026 07:37
@derek-tml

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@derek-tml

Copy link
Copy Markdown
Collaborator Author

@claude review

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

Comment on lines 56 to 72
def _json_safe(value: Any) -> Any:
"""Convert values to JSON-serializable form."""
if value is None or isinstance(value, (str, bool, int, float)):
return value
if is_dataclass(value) and not isinstance(value, type):
return _json_safe({k: v for k, v in asdict(value).items() if v is not None})
if isinstance(value, dict):
return {str(k): _json_safe(v) for k, v in value.items()}
if isinstance(value, (list, tuple)):
return [_json_safe(v) for v in value]
if hasattr(value, "item"):
item = getattr(value, "item", None)
if item is not None:
try:
return value.item()
return item()
except Exception:
logger.debug("Failed to convert %r via .item(), falling back to str()", type(value))
return str(value)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole thing looks like something Pydantic would solve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants