Skip to content

Tool dialect unify - #11

Merged
senamakel merged 28 commits into
mainfrom
tool-dialect-unify
Sep 20, 2026
Merged

senamakel merged 28 commits into
mainfrom
tool-dialect-unify

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

Related issue

API or behavior changes

Validation

Commands actually run, with their outcome:

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo build --all-targets --all-features
  • cargo test --all-features

Tests

Documentation

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

senamakel and others added 28 commits September 19, 2026 20:34
When the repair JSON response is missing optional fields like `explanation` or `confidence`, the parser now returns default values instead of failing. This makes the agent more resilient to variations in LLM output format.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When parsing bare JSON objects, the grammar previously failed to recognize top-level JSON values without surrounding braces. This change adds support for parsing standalone JSON objects by adjusting the grammar rules to accept JSON values at the top level, enabling the parser to handle bare JSON inputs correctly.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The bare JSON parser now skips leading whitespace before attempting to parse a JSON value, ensuring that inputs with indentation or spacing are correctly recognized as valid bare JSON rather than being rejected.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When the agent output contains only a JSON object with no surrounding text, the parser now correctly extracts it instead of failing. Previously, the parser required non-JSON text around the JSON block, which caused valid bare JSON responses to be rejected.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When parsing invoke XML, the grammar now correctly handles cases where optional attributes are absent, preventing parse failures that occurred when attributes like `target` or `timeout` were omitted from the invocation element.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When the `name` attribute is absent from an invoke XML element, the parser now returns a clear error instead of panicking. This improves robustness against malformed input.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When parsing invoke XML, the grammar now correctly handles cases where optional attributes are absent, preventing parse failures that occurred when expected attributes were not present in the input.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Fix the test assertion to properly verify that the stream terminates after processing all items, rather than checking for an incorrect condition that would never be met.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The sentinel grammar parser now correctly processes a previously unhandled edge case where certain input patterns caused unexpected termination. This fix ensures robust parsing behavior in the sentinel module.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Fix a parsing issue in the sentinel grammar where certain edge cases caused incorrect token recognition. The change ensures that sentinel boundaries are properly respected during parsing, preventing false positives in token classification.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test for stream termination was using an incorrect assertion that would never trigger, causing the test to pass even when the stream failed to terminate properly. Updated the assertion to correctly verify that the stream ends after the expected number of items.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reorder the fields in the struct initialization to match the definition order, preventing potential compilation errors or mismatches in field assignment.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When a tool response is received without a `tool_call_id` field, the agent now gracefully handles the missing value instead of panicking. This change improves robustness when interacting with models that may omit the identifier in certain edge cases.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test module for parsing bare JSON input in the tinytools-agent crate, covering the case where input is a raw JSON value without any tool call structure. This ensures the parser correctly handles standalone JSON payloads.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When a tagged expression lacks a closing delimiter, the parser now returns an appropriate error instead of panicking. This improves robustness when processing malformed input.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When a tagged expression lacks a closing delimiter, the parser now returns a clear error instead of panicking. This improves robustness for malformed input in the tagged grammar parser.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The tagged parser now returns an error when a closing tag is missing, rather than silently consuming input. This prevents incorrect parsing results and ensures malformed tagged content is properly reported to the caller.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When repairing malformed JSON, the agent now gracefully handles cases where expected fields are absent, preventing panics or incomplete repairs. This improves robustness when processing partial or corrupted data.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Changed the test assertion in the JSON repair test to expect an empty array instead of a null value when no repairs are needed, aligning the test with the actual serialization behaviour of the system.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The grammar parser now correctly accepts harmony statements that omit trailing semicolons, which are optional in the specification. Previously, the parser would reject valid input that followed the relaxed syntax rules.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a fallback to return an empty grammar when the harmony grammar file is not found, preventing a panic during parsing. This ensures the parser can continue operating even when the optional harmony grammar resource is absent.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The harmony grammar rule previously rejected a trailing comma after the last element in a sequence, which caused valid inputs to fail parsing. The change now allows an optional comma at the end, aligning the parser with common formatting conventions and user expectations.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The harmony mistral parser now returns an empty result when given an empty input string, preventing a panic that occurred when trying to parse zero-length content. This ensures the parser behaves consistently with other parsers in the codebase.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When a tool call has no arguments, the parser now correctly returns an empty object instead of failing. This fixes a crash that occurred when the model produced a tool call with an empty arguments field.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When a Mistral-formatted tool call has an empty arguments field, the parser now correctly produces an empty JSON object instead of failing. This fixes a crash that occurred when the model returned a tool call with no arguments.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When a Mistral-style prompt lacks the `[INST]` tag, the parser now falls back to treating the entire input as a single user message instead of failing. This improves robustness for malformed or incomplete prompts.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformat several expressions that exceeded the project's preferred line length, breaking them across multiple lines to improve readability without changing any behaviour. The affected areas include a return expression in the Harmony grammar parser, a conditional in `absorb_start_prefix`, a test assertion in `bare_json.rs`, a template marker search in the JSON repair module, and two test assertions in `stream/test.rs`. One line in `harmony_mistral.rs` is shortened to fit within the line length limit.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The `std::fmt` import was no longer needed after a previous refactor removed the code that relied on it, so it has been cleaned up to avoid compiler warnings.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 13 billable files and costs up to $3.25.

Or wait 37 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fb427f11-3838-4020-ad1c-eb638496b92d

📥 Commits

Reviewing files that changed from the base of the PR and between e347bec and d2d0a89.

📒 Files selected for processing (13)
  • crates/tinytools-agent/src/parse/grammar/bare_json.rs
  • crates/tinytools-agent/src/parse/grammar/harmony.rs
  • crates/tinytools-agent/src/parse/grammar/invoke_xml.rs
  • crates/tinytools-agent/src/parse/grammar/mistral.rs
  • crates/tinytools-agent/src/parse/grammar/sentinel.rs
  • crates/tinytools-agent/src/parse/grammar/tagged.rs
  • crates/tinytools-agent/src/parse/test/bare_json.rs
  • crates/tinytools-agent/src/parse/test/harmony_mistral.rs
  • crates/tinytools-agent/src/parse/test/tagged.rs
  • crates/tinytools-agent/src/repair/json.rs
  • crates/tinytools-agent/src/repair/test/json.rs
  • crates/tinytools-agent/src/stream/test.rs
  • crates/tinytools-agent/src/types.rs

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 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-20T07:42:32.205928Z d2d0a89 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.

@senamakel senamakel self-assigned this Sep 20, 2026
@senamakel
senamakel merged commit 5a82878 into main Sep 20, 2026
9 checks passed
@senamakel
senamakel deleted the tool-dialect-unify branch September 20, 2026 07:38

@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: d2d0a89e2c

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

Comment on lines +216 to +219
if !in_string
&& let Some(marker) = TEMPLATE_MARKERS
.iter()
.find(|marker| rest.starts_with(*marker))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Strip structural markers despite recoverable quote damage

When an object combines the already-supported mismatched-key quoting with a leaked trailing marker—for example {"name":"get_weather","parameters':{'city':"Paris"}}<tool_call|>—this pre-repair quote tracker becomes desynchronized and treats the marker as string data, so it is not removed. The later key-quoting repair cannot parse the trailing marker and recover_object returns None, causing the call's arguments to be dropped or replaced with {}; previously the unconditional marker removal allowed this cumulative repair to succeed. Preserve a fallback marker-stripping pass for candidates that remain invalid after quote-aware stripping.

Useful? React with 👍 / 👎.

@tinysweeper

tinysweeper Bot commented Sep 20, 2026

Copy link
Copy Markdown

Tiny Sweeper review

⚠️ Review failed for d2d0a89e2c6b. the review of #11 did not finish within 900s

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.

1 participant