Skip to content

Comments

fix: use resource.name for mockable in process_tool#614

Merged
mjnovice merged 2 commits intomainfrom
fix/simulation-tool-name-matching
Feb 21, 2026
Merged

fix: use resource.name for mockable in process_tool#614
mjnovice merged 2 commits intomainfrom
fix/simulation-tool-name-matching

Conversation

@mjnovice
Copy link
Contributor

@mjnovice mjnovice commented Feb 20, 2026

Summary

Fixes tool simulation (uipath debug) failing in two ways:

Bug 1: @mockable name mismatch

process_tool.py and escalation_tool.py used name=tool_name.lower() (e.g. api_workflow) instead of name=resource.name (e.g. API Workflow). This caused LLMMocker to raise UiPathNoMockFoundError because the name didn't match simulation.json's toolsToSimulate[].name.

Fallback behavior: When UiPathNoMockFoundError is raised, the @mockable decorator silently falls through to the real tool function (mockable.py:mocked_response_decorator). This means tools configured for simulation would execute against the actual UiPath platform instead, failing with HTTP 400 errors in
debug/eval contexts.

Bug 2: Empty kwargs in @mockable-decorated nested functions

Several tools define a nested function decorated with @mockable that takes no arguments (e.g. async def invoke_process():), even though the outer function receives **kwargs. The @mockable decorator captures function arguments to build the currentToolInput field in the mock LLM prompt. With no arguments,
the mock LLM sees {"args": [], "kwargs": {}} and returns null results, causing the agent to loop until max iterations.

Files changed

File Name fix Kwargs fix
process_tool.py resource.name invoke_process(**_tool_kwargs)
escalation_tool.py resource.name escalate(**_tool_kwargs)
deeprag_tool.py already correct invoke_deeprag(**_tool_kwargs)
batch_transform_tool.py already correct invoke_batch_transform(**_tool_kwargs)

No changes needed: integration_tool.py, context_tool.py, analyze_files_tool.py, mcp_tool.py, ixp_escalation_tool.py — these either decorate the top-level function directly (kwargs flow through naturally) or have no user-provided inputs.

Test plan

  • Run uipath debug on an agent with a process tool configured for simulation — verify mock interception works and returns non-null results
  • Run uipath debug on an agent with an escalation tool configured for simulation
  • Verify non-simulated tools still execute normally (no regression)
  • Run uipath eval to confirm evaluation pipeline works end-to-end

RCA

PR #546 introduced Bug 1 (name mismatch) for process_tool.py only.

The diff shows it moved the @mockable decorator from the outer process_tool_fn level to a new nested invoke_process() function, and in doing so made two changes:

  1. Changed name=resource.name → name=tool_name.lower() (Bug 1)
  2. The new nested invoke_process() was defined with no arguments and called with no arguments (Bug 2)

🤖 Generated with Claude Code

PR #546 changed the @mockable name from resource.name to
tool_name.lower(), which breaks tool simulation. The sanitized and
lowercased name (e.g. "api_workflow") no longer matches the original
name in simulation.json (e.g. "API Workflow"), causing the LLM mocker
to skip simulation for process tools.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mjnovice mjnovice requested a review from Chibionos February 20, 2026 22:45
@mjnovice mjnovice merged commit 4d78177 into main Feb 21, 2026
39 checks passed
@mjnovice mjnovice deleted the fix/simulation-tool-name-matching branch February 21, 2026 00:20
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.

2 participants