feat(render): parse the [Tool results] replay frame back into entries - #23
Conversation
…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>
Tiny Sweeper reviewTiny 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 Review snapshot
Completeness: Incomplete What changedThe review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below. FeaturesNone identified with supported citations. TestsNo supported feature-to-test mapping was produced. Test execution is not inferred.
FindingsNo active actionable findings. Could not review: tinysweeper/tests Before merge
How this fits togetherflowchart 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
Agent review detailscritique
security
tests
commits
description
e2e
Evidence and run details
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
💡 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, |
There was a problem hiding this comment.
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)] | |||
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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
|
Chain: this → tinyhumansai/tinyagents#210 → tinyhumansai/openhuman#6598. |
Summary
Adds
parse_replayed_results, the strict inverse of the id-keyed[Tool results]replay frame thatto_provider_messageswrites for text dialects (xml / python). It sits beside the renderer so the two formats cannot drift, and returnsNonefor 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 fromrenderanddialect.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