Skip to content

feat(render): parse the [Tool results] replay frame back into entries - #23

Merged
senamakel merged 1 commit into
mainfrom
tool-call-presentation
Sep 24, 2026
Merged

senamakel merged 1 commit into
mainfrom
tool-call-presentation

Conversation

@senamakel

@senamakel senamakel commented Sep 24, 2026

Copy link
Copy Markdown
Member

Summary

Adds parse_replayed_results, the strict inverse of the id-keyed [Tool results] replay frame that to_provider_messages writes for text dialects (xml / python). It sits beside the renderer so the two formats cannot drift, and returns None for anything that is not exactly a replay frame.

Why

Text-dialect turns persist the model-facing replay form: the calling assistant row holds only prose, and a round's results are folded into one user row ([Tool results]\n<tool_result id="…">…</tool_result>). OpenHuman's transcript projection had no way to split that row back into per-call results, so a settled tool call could never be paired with its result and rendered as unfinished ("cancelled") after every turn. OpenHuman now uses this parser to pair each result with its call by id.

Changes

  • crates/tinytools-agent/src/render/results.rs: parse_replayed_results, re-exported from render and dialect.
  • render/results_test.rs: round-trip against the renderer, escaped ids, empty bodies, and rejection of non-frame content.

Test plan

  • cargo test -p tinytools-agent: 313 passed; clippy clean.

Consumed by tinyhumansai/tinyagents (gitlink bump) and tinyhumansai/openhuman (transcript projection), PRs to follow.

Summary by CodeRabbit

  • New Features
    • Replayed tool results can now be parsed back into structured results, preserving their IDs and content.
    • The parser handles escaped characters in result IDs and rejects malformed or incomplete replay text.

…o entries

A text-dialect transcript persists the provider replay form, so a host
that needs to pair each result with its call (display projection, durable
row adapter) only has the rendered user turn. Add parse_replayed_results,
the inverse of the ToolResults arm of to_provider_messages, beside the
renderer so the two formats cannot drift. Strict: returns None for
anything that is not exactly a replay frame.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@tinysweeper

tinysweeper Bot commented Sep 24, 2026

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 6 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Incomplete
Priority: low
Reviewed head: db4dc5831421
Updated: 1790226035 (Unix time)

Review snapshot

Change surface Files Review signal Count
Production 3 Active findings 0
Tests 1 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 1

Completeness: Incomplete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

The review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

  • Unreviewed: tinysweeper/tests

Findings

No active actionable findings.

Could not review: tinysweeper/tests

Before merge

  • Complete the tests review for tinysweeper/tests.

How this fits together

flowchart LR
  n0["to_provider_messages<br/>changed"]:::changed
  n1["ToolDialect"]:::impacted
  n2["CodeDialect"]:::impacted
  n3["user"]:::impacted
  n4["NativeDialect"]:::impacted
  n0 -->|calls| n3
  n2 -->|implements| n1
  n4 -->|implements| n1
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The replay parser and its round-trip coverage look functionally sound. One repository-rule violation remains in the new test module and should be fixed before merging. _The code index is behind this pull request (indexed at `304b2d890ec7`), so retrieved context may be out of date._ _2 memory call(s) failed (model: cortex: v1/answer: timed out after 20s), so this review saw part of what the engine holds._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The replay parser and its tests appear functionally sound. One repository-rule violation remains: the new test file adds a blanket Clippy allowance that should be removed before merging. (1 finding added by a second pass) _The code index is behind this pull request (indexed at `304b2d890ec7`), so retrieved context may be out of date._ _2 memory call(s) failed (model: cortex: v1/answer: timed out after 20s), so this review saw part of what the engine holds._

tests

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: tinysweeper/tests
  • Lane summary: No reviewer could be consulted.

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: Adds `parse_replayed_results` as the strict inverse of the id-keyed `[Tool results]` replay frame, sitting beside the renderer so the two formats cannot drift. Returns `None` for anything that is not exactly a replay frame. The implementation is sound and well-tested; no issues introduced. _The code index is behind this pull request (indexed at `304b2d890ec7`), so retrieved context may be out of date._ _2 memory call(s) failed (model: cortex: v1/answer: timed out after 20s), so this review saw part of what the engine holds._

e2e

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: No end-to-end harness in this repository: no e2e test files and no e2e workflow.
Evidence and run details
  • Models: ladder/vectors, gpt-5.6-luna, deepseek/deepseek-v4-flash
  • Spend: $0.013892
  • Tokens: 207909 input · 15160 output · 27619 cached · 602 embedding
Head State Pass summary
db4dc5831421 incomplete 0 active finding(s), 0 resolved finding(s) (at 1790226035)

tinysweeper 0.1.0

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-24T04:52:03.041845Z db4dc58 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d3748ad4-0f42-49fe-95ab-155cd139a92a

📥 Commits

Reviewing files that changed from the base of the PR and between 8ed823b and db4dc58.

📒 Files selected for processing (4)
  • crates/tinytools-agent/src/dialect/mod.rs
  • crates/tinytools-agent/src/render/mod.rs
  • crates/tinytools-agent/src/render/results.rs
  • crates/tinytools-agent/src/render/results_test.rs
 _______________________________________________________________________________________________________________
< Walking on water and developing software from a specification are easy if both are frozen. - Edward V. Berard >
 ---------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@senamakel
senamakel merged commit 52e9ab1 into main Sep 24, 2026
9 of 10 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db4dc58314

ℹ️ 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".

pub use crate::render::{
CATALOGUE_HEADING, TOOL_RESULTS_PREFIX, render_code_catalogue, render_json_catalogue,
render_pformat_catalogue,
CATALOGUE_HEADING, TOOL_RESULTS_PREFIX, parse_replayed_results, render_code_catalogue,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Re-export the parser from the crate root

The new public parser is exposed only through the nested render and dialect modules, so downstream users cannot access it from the crate's centralized public surface. Re-export parse_replayed_results from src/lib.rs alongside the crate's other public entry points.

AGENTS.md reference: AGENTS.md:L87-L88

Useful? React with 👍 / 👎.

@@ -0,0 +1,65 @@
#![allow(clippy::expect_used, clippy::panic, clippy::unwrap_used)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add module-level documentation to the test module

This new test module starts with a lint attribute and has no //! description, contrary to the repository requirement for every test module. Add a concise module-level comment describing the replay-parser tests.

AGENTS.md reference: AGENTS.md:L193-L196

Useful? React with 👍 / 👎.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: tinysweeper/tests.

             $0.0139 · 207,909 in / 15,160 out · 27,619 cached (13%) · ladder/vectors, gpt-5.6-luna, deepseek/deepseek-v4-flash · 602 embedded
critique:    $0.0030 · 39,641 in  / 4,245 out  · 2,903 cached (7%)   · gpt-5.6-luna, deepseek/deepseek-v4-flash
security:    $0.0067 · 120,200 in / 4,684 out  · 7,564 cached (6%)   · gpt-5.6-luna
tests:       $0.0029 · 35,362 in  / 5,047 out  · 17,152 cached (49%) · deepseek/deepseek-v4-flash
description: $0.0008 · 8,825 in   / 80 out     · 0 cached (0%)       · deepseek/deepseek-v4-flash

@senamakel

Copy link
Copy Markdown
Member Author

Chain: this → tinyhumansai/tinyagents#210tinyhumansai/openhuman#6598.

@senamakel
senamakel deleted the tool-call-presentation branch September 24, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant