Skip to content

harness: emit DeferredToolCall only for catalogued targets - #169

Merged
senamakel merged 2 commits into
mainfrom
deferred-call-event
Sep 19, 2026
Merged

senamakel merged 2 commits into
mainfrom
deferred-call-event

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

Follow-up to #163. unwrap_tool_call only validates the tool_call wrapper's shape, so a model can wrap a direct, hidden, or fabricated name just as validly. The loop emitted AgentEvent::DeferredToolCall unconditionally on unwrap, telling an audit consumer "a deferred call happened" for a call that admission then ran as a direct tool or rejected as unknown. Now the event is emitted only when the unwrapped target is in the run's deferred catalogue; the rewrite to the real name still happens in every case so admission decides the outcome as before.

Regression test: tool_call wrapping a direct, a hidden, and a deferred name — the direct runs, the hidden is rejected, the deferred runs, and exactly one DeferredToolCall (for the deferred one) is recorded.

This was the last unpushed commit from the #163 babysitting run.

Verification

  • cargo fmt --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace — all green

Co-authored-by: Medulla medulla@tinyhumans.ai

senamakel and others added 2 commits September 19, 2026 20:57
The agent loop was unconditionally emitting a DeferredToolCall event for every tool call that passed unwrap_tool_call, even when the tool name was not actually in the deferred catalogue. This misrepresented the outcome to audit consumers, since admission would either execute the call as a direct tool or reject it as unknown or hidden. The event is now only emitted when the tool name is found in the catalogue that the bridge searched.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…emit deferred events

Add an integration test that verifies only tools registered with `ToolExposure::Deferred` produce a `DeferredToolCall` event when invoked through the wrapping middleware, while direct and hidden tools do not. This ensures the deferral logic correctly filters by exposure level rather than by tool name alone.

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

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Warning

Review paused — included plan limit reached

Keep your review moving with free on-demand reviews.

  • Run this review for free

On-demand reviews are free for one more day.

Promotion and pricing details

On-demand reviews are free for one more day. After that, they cost $0.25 per reviewed file.

Review limit details

Or wait 7 minutes for your next included review.

Check out review usage here.

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: c575f2c6-8dcc-4624-aacc-cc3144a52b91

📥 Commits

Reviewing files that changed from the base of the PR and between d239947 and 1bebc8e.

📒 Files selected for processing (2)
  • crates/tinyagents-harness/src/agent_loop/tools.rs
  • crates/tinyagents-integration-tests/tests/tool_deferral.rs

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 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-19T18:01:24.326354Z 1bebc8e 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

Copy link
Copy Markdown
Member Author

PR babysitter status

  • Head: 1bebc8e7ad91809dd1f1e65a9d43db8673bfeca2 (stable, no code changes needed this cycle)
  • CI: all checks green — Rust SDK (both the pull_request- and push-triggered runs) and CodeRabbit, all SUCCESS. Merge state: CLEAN, MERGEABLE.
    • One duplicate run (35459754153) initially failed on tinyagents-harness::runtime::test::middleware_rebinding_applies_the_host_resolution_deadline, a pre-existing test unrelated to this PR's diff, asserting a 5ms wall-clock timeout budget — inherently flaky under runner load. The identical head SHA passed the same suite on the sibling pull_request run, proving transiency, so I reran the failed job once (gh run rerun 35459754153 --failed); it passed clean on rerun. No code change was needed.
  • Review feedback: 0 unresolved threads, 0 changes-requested reviews. CodeRabbit's review was rate-limited (no findings delivered) and Codex posted only a status summary with nothing actionable.
  • No merge conflicts, no new review-bot comments since last check.

Ready for pr-approval-reviewer.

@senamakel
senamakel merged commit 24483d6 into main Sep 19, 2026
3 of 4 checks passed
senamakel added a commit that referenced this pull request Sep 19, 2026
Brings in PR #169 (emit DeferredToolCall only for catalogue targets) on
top of the previous merge. No conflicts; the change is confined to the
discovery-bridge admission path and its integration test, which is
independent of the tinytools-agent dialect recovery this branch adds.

Verified: cargo fmt --check, clippy -D warnings, build --all-targets,
test --workspace, and the basic_graph example all pass.

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

tinysweeper Bot commented Sep 19, 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: Ready for maintainer review
Priority: none
Reviewed head: 1bebc8e7ad91
Updated: 1789842898 (Unix time)

Review snapshot

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

Completeness: Complete
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.

Findings

No active actionable findings.

Before merge

None.

How this fits together

flowchart LR
  n0["execute_tools_concurrently"]:::impacted
  n1["finish_tool_call"]:::impacted
  n2["admit_tool_call"]:::impacted
  n3["execute_tools_serially"]:::impacted
  n4["fail_tool_call"]:::impacted
  n5["RunContext"]:::impacted
  n0 -->|calls| n1
  n0 -->|calls| n2
  n0 -->|calls| n4
  n0 -->|uses| n5
  n1 -->|calls| n4
  n1 -->|uses| n5
  n2 -->|uses| n5
  n3 -->|calls| n1
  n3 -->|calls| n2
  n3 -->|calls| n4
  n3 -->|uses| n5
  n4 -->|uses| n5
  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: Reviewed 2 files; 0 findings. _The code index is behind this pull request (indexed at `1e5b8323b7ac`), so retrieved context may be out of date._ _3 memory call(s) failed (model: cortex: v1/answer answered 502 Bad Gateway), so this review saw part of what the engine holds._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: Reviewed 2 files; 0 findings. _The code index is behind this pull request (indexed at `1e5b8323b7ac`), so retrieved context may be out of date._ _3 memory call(s) failed (model: cortex: v1/answer answered 502 Bad Gateway), so this review saw part of what the engine holds._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change correctly gates the `DeferredToolCall` event emission on the unwrapped name being present in the deferred catalogue, avoiding misleading audit events for direct or hidden tools. The new test covers three cases (direct, hidden, deferred) and asserts the event is only emitted for the deferred case. The change is safe and the test validates the new behavior. _The code index is behind this pull request (indexed at `1e5b8323b7ac`), so retrieved context may be out of date._ _3 memory call(s) failed (model: cortex: v1/answer answered 502 Bad Gateway), so this review saw part of what the engine holds._

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: The change correctly gates `DeferredToolCall` emission on the unwrapped name being in the deferred catalogue, preventing spurious audit events for direct or hidden tools wrapped in a `tool_call` shape. The code and new regression test are sound; this is safe to merge. _The code index is behind this pull request (indexed at `1e5b8323b7ac`), so retrieved context may be out of date._ _3 memory call(s) failed (model: cortex: v1/answer answered 502 Bad Gateway), 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-v4-flash
  • Spend: $0.008827
  • Tokens: 180606 input · 6525 output · 12476 cached · 386 embedding
Head State Pass summary
1bebc8e7ad91 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 1789842898)

tinysweeper 0.1.0

@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. Approving.

             $0.0088 · 180,606 in / 6,525 out · 12,476 cached (7%) · ladder/vectors, gpt-5.6-luna, deepseek-v4-flash · 386 embedded
critique:    $0.0041 · 77,715 in  / 1,931 out · 8,128 cached (10%) · gpt-5.6-luna
security:    $0.0042 · 77,591 in  / 1,348 out · 1,788 cached (2%)  · gpt-5.6-luna
tests:       $0.0003 · 15,505 in  / 825 out   · 1,536 cached (10%) · deepseek-v4-flash
description: $0.0001 · 6,986 in   / 658 out   · 1,024 cached (15%) · deepseek-v4-flash

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Sep 19, 2026
@senamakel
senamakel deleted the deferred-call-event branch September 19, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant