ToolCallingRuntime omits context inputs in tool call history #9083

Open
opened 2026-04-14 07:20:52 +00:00 by HAL9000 · 2 comments
Owner

Metadata

  • Commit Message: fix(actor): persist enriched_inputs in ToolCallRecord to include injected context
  • Branch: fix/actor-tool-call-record-enriched-inputs

Background and Context

ToolCallingRuntime enriches tool inputs with sandbox_root and resource_bindings before execution but records only the original LLM-provided arguments in ToolCallRecord.inputs. This means audit consumers see incomplete tool_call_history entries that omit the execution context actually used during the tool run.

This divergence between what was recorded and what was executed breaks post-run auditing, diagnostics, and any downstream automation that relies on tool_call_history to reconstruct execution context.

Expected Behavior

ToolCallRecord.inputs should match the actual arguments sent to the tool runner — including injected defaults such as sandbox_root and resource_bindings — so that the recorded history faithfully reflects the executed payload.

Acceptance Criteria

  • ToolCallRecord.inputs contains the full enriched argument dict (including sandbox_root and resource_bindings) when those values are injected by ToolCallingRuntime.
  • ToolCallRecord.inputs is identical to the dict passed to the tool runner for every tool call.
  • Existing audit consumers that read tool_call_history can reconstruct the sandbox path and resource bindings from the record without additional lookups.
  • No regression in tool execution behaviour — enrichment logic is unchanged; only the recording step is updated.
  • All tests pass and coverage remains ≥ 97%.

Subtasks

  • Locate the ToolCallRecord construction site(s) inside ToolCallingRuntime.run_tool_loop.
  • Replace the use of the original LLM-provided arguments with enriched_inputs when constructing ToolCallRecord.
  • Add/update BDD scenarios (Behave) covering the case where injected context keys appear in tool_call_history.
  • Add/update integration tests verifying end-to-end fidelity of tool_call_history entries.
  • Update docs/reference/actor_runtime.md "Tool Call Metadata" table to clarify that inputs reflects the enriched payload.
  • Run nox (all default sessions) and fix any errors.
  • Verify coverage ≥ 97% via nox -s coverage_report.

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Summary

  • ToolCallingRuntime enriches tool inputs with sandbox_root and resource_bindings before execution but records only the original arguments.
  • Audit consumers therefore see incomplete tool_call_history entries that omit the execution context.

Impact

  • Breaks post-run auditing and diagnostics that rely on tool_call_history to reconstruct execution context.
  • Downstream automation can no longer verify sandbox path or resource bindings used during execution.

Steps to Reproduce

  1. Instantiate a ToolActorContext with sandbox_root="/tmp/sandbox" and resource_bindings populated.
  2. Run ToolCallingRuntime.run_tool_loop with an LLM response that requests any tool call (no explicit arguments required).
  3. Observe that the injected sandbox_root/resource_bindings reach the tool runner, but the resulting ToolCallRecord.inputs lacks those keys.

Actual Behavior

  • ToolCallRecord.inputs contains only the original LLM-provided arguments and omits injected defaults, diverging from what the tool actually received.

Specification Reference

  • docs/reference/actor_runtime.md — "Tool Call Metadata" table states that inputs must contain the arguments sent to the tool.

Environment

  • cleveragents/cleveragents-core (current main), actor module

Suggested Fix (Directional)

  • Persist the enriched_inputs dict when constructing ToolCallRecord so recorded inputs reflect the executed payload.

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit Message**: `fix(actor): persist enriched_inputs in ToolCallRecord to include injected context` - **Branch**: `fix/actor-tool-call-record-enriched-inputs` ## Background and Context `ToolCallingRuntime` enriches tool inputs with `sandbox_root` and `resource_bindings` before execution but records only the original LLM-provided arguments in `ToolCallRecord.inputs`. This means audit consumers see incomplete `tool_call_history` entries that omit the execution context actually used during the tool run. This divergence between what was recorded and what was executed breaks post-run auditing, diagnostics, and any downstream automation that relies on `tool_call_history` to reconstruct execution context. ## Expected Behavior `ToolCallRecord.inputs` should match the actual arguments sent to the tool runner — including injected defaults such as `sandbox_root` and `resource_bindings` — so that the recorded history faithfully reflects the executed payload. ## Acceptance Criteria - [ ] `ToolCallRecord.inputs` contains the full enriched argument dict (including `sandbox_root` and `resource_bindings`) when those values are injected by `ToolCallingRuntime`. - [ ] `ToolCallRecord.inputs` is identical to the dict passed to the tool runner for every tool call. - [ ] Existing audit consumers that read `tool_call_history` can reconstruct the sandbox path and resource bindings from the record without additional lookups. - [ ] No regression in tool execution behaviour — enrichment logic is unchanged; only the recording step is updated. - [ ] All tests pass and coverage remains ≥ 97%. ## Subtasks - [ ] Locate the `ToolCallRecord` construction site(s) inside `ToolCallingRuntime.run_tool_loop`. - [ ] Replace the use of the original LLM-provided arguments with `enriched_inputs` when constructing `ToolCallRecord`. - [ ] Add/update BDD scenarios (Behave) covering the case where injected context keys appear in `tool_call_history`. - [ ] Add/update integration tests verifying end-to-end fidelity of `tool_call_history` entries. - [ ] Update `docs/reference/actor_runtime.md` "Tool Call Metadata" table to clarify that `inputs` reflects the enriched payload. - [ ] Run `nox` (all default sessions) and fix any errors. - [ ] Verify coverage ≥ 97% via `nox -s coverage_report`. ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- ## Summary - `ToolCallingRuntime` enriches tool inputs with `sandbox_root` and `resource_bindings` before execution but records only the original arguments. - Audit consumers therefore see incomplete `tool_call_history` entries that omit the execution context. ## Impact - Breaks post-run auditing and diagnostics that rely on `tool_call_history` to reconstruct execution context. - Downstream automation can no longer verify sandbox path or resource bindings used during execution. ## Steps to Reproduce 1. Instantiate a `ToolActorContext` with `sandbox_root="/tmp/sandbox"` and `resource_bindings` populated. 2. Run `ToolCallingRuntime.run_tool_loop` with an LLM response that requests any tool call (no explicit arguments required). 3. Observe that the injected `sandbox_root`/`resource_bindings` reach the tool runner, but the resulting `ToolCallRecord.inputs` lacks those keys. ## Actual Behavior - `ToolCallRecord.inputs` contains only the original LLM-provided arguments and omits injected defaults, diverging from what the tool actually received. ## Specification Reference - `docs/reference/actor_runtime.md` — "Tool Call Metadata" table states that `inputs` must contain the arguments sent to the tool. ## Environment - cleveragents/cleveragents-core (current main), actor module ## Suggested Fix (Directional) - Persist the `enriched_inputs` dict when constructing `ToolCallRecord` so recorded inputs reflect the executed payload. --- **Automated by CleverAgents Bot** Agent: new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-14 07:37:28 +00:00
Author
Owner

🔍 Triage Decision — [AUTO-OWNR-2]

Status: VERIFIED

MoSCoW: Should have
Priority: Medium
Milestone: v3.5.0

Reasoning: ToolCallingRuntime omitting context inputs from tool call history causes incomplete audit trails and makes debugging tool call sequences difficult. Should be fixed for proper observability.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

## 🔍 Triage Decision — [AUTO-OWNR-2] **Status:** ✅ VERIFIED **MoSCoW:** Should have **Priority:** Medium **Milestone:** v3.5.0 **Reasoning:** `ToolCallingRuntime` omitting context inputs from tool call history causes incomplete audit trails and makes debugging tool call sequences difficult. Should be fixed for proper observability. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Author
Owner

Triage: Verified [AUTO-OWNR-1]

Valid bug: ToolCallingRuntime omits context inputs in tool call history. This makes debugging and auditing tool calls difficult.

Assigning to v3.5.0 (Autonomy Hardening) as tool call history is important for autonomous operation auditing. Priority Medium — missing context in history.

MoSCoW: Should Have — complete tool call history is important for debugging and auditing autonomous operations.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Triage: Verified** [AUTO-OWNR-1] Valid bug: `ToolCallingRuntime` omits context inputs in tool call history. This makes debugging and auditing tool calls difficult. Assigning to **v3.5.0** (Autonomy Hardening) as tool call history is important for autonomous operation auditing. Priority **Medium** — missing context in history. MoSCoW: **Should Have** — complete tool call history is important for debugging and auditing autonomous operations. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#9083
No description provided.