Skip to content

fix: classify invalid function inputs as user errors instead of runtime crashes#1804

Merged
mjnovice merged 5 commits into
mainfrom
fix/graceful-input-validation-errors
Jul 10, 2026
Merged

fix: classify invalid function inputs as user errors instead of runtime crashes#1804
mjnovice merged 5 commits into
mainfrom
fix/graceful-input-validation-errors

Conversation

@mjnovice

@mjnovice mjnovice commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the root cause behind SRE-618832: eval runs feeding invalid inputs to typed agent functions (e.g. the SDK's own crash-string-input-a/b CI evals) surfaced as unhandled runtime crashes with IsRuntimeException=True and a full Python traceback in ErrorMessage, repeatedly firing the agents-evalrun-failed-urt App Insights alert. A schema-mismatched input is a user/test-data problem, not an eval infrastructure failure, and should be reported as such.

Changes

Functions runtime (functions/runtime.py)

  • Catch ValidationError/TypeError/ValueError at the convert_to_class input-conversion boundary and raise a UiPathRuntimeError with UiPathErrorCategory.USER, title Invalid input, a concise per-field message (e.g. a: Input should be a valid integer), and include_traceback=False — no more CI workspace paths or tracebacks in telemetry.
  • Uses UiPathErrorCode.INPUT_INVALID_JSON as the closest existing code; uipath-runtime 0.12.x has no dedicated input-validation code yet (follow-up: add INPUT_VALIDATION_ERROR there).

Eval runtime (eval/runtime/runtime.py)

  • runtime_exception is now only set to True when the root error is not a user-category UiPathBaseRuntimeError. User-category errors are correctly-reported workload failures of the agent under evaluation.

Eval telemetry (_cli/_evals/_telemetry.py)

  • EvalRun.Failed events now include ErrorCode and ErrorCategory properties from the error contract, giving SRE a first-class KQL dimension (ErrorCategory == "User") to filter alert noise instead of substring-matching messages or hardcoding CI org IDs.

Behavior notes

  • The crash-test evals still fail as designed — only the error classification and message quality change.
  • Console reporter behavior improves for user errors: it prints the clean error message directly instead of the raw-logs panel.

Test plan

  • New tests/functions/test_input_validation.py: string/None/list/dict inputs to a Pydantic-typed function yield USER-category Invalid input errors with per-field details and no traceback; valid input still executes.
  • New tests/cli/eval/test_runtime_error_classification.py: user vs system/unknown/plain-exception classification.
  • tests/cli/eval/test_eval_telemetry.py: user-category errors emit ErrorCode/ErrorCategory and IsRuntimeException=False.
  • Full tests/functions/ + tests/cli/eval/ suites pass (492 tests); ruff check/format and mypy clean.

🤖 Generated with Claude Code

…me crashes

Input that fails Pydantic/dataclass conversion in the functions runtime
previously surfaced as a generic FUNCTION_EXECUTION_ERROR with a full
Python traceback embedded in the error detail, and the eval runtime
unconditionally flagged it as a runtime exception. This made test-data
problems indistinguishable from eval infrastructure crashes in App
Insights and triggered SRE alerting on EvalRun.Failed events (SRE-618832).

- functions runtime: catch input conversion failures at convert_to_class
  and raise a USER-category "Invalid input" error with a concise
  per-field message and no traceback
- eval runtime: only set runtime_exception=True when the root error is
  not a user-category UiPathBaseRuntimeError
- eval telemetry: emit ErrorCode and ErrorCategory properties so alerts
  can filter user-caused failures without org-ID allowlists

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 8, 2026 22:32
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves error classification and telemetry for typed agent/function input validation so schema-mismatched inputs are reported as USER-category failures (without tracebacks), reducing false-positive “runtime crash” alerts during eval runs.

Changes:

  • Functions runtime: convert typed-input validation failures into UiPathRuntimeError with UiPathErrorCategory.USER, Invalid input title, concise per-field detail, and no traceback.
  • Eval runtime: introduce _is_user_facing_error() and set runtime_exception based on whether the root exception is a USER-category UiPathBaseRuntimeError.
  • Eval telemetry: include ErrorCode and ErrorCategory properties for UiPathBaseRuntimeError in EvalRun.Failed events; add targeted tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/uipath/src/uipath/functions/runtime.py Converts input-conversion failures into USER-category runtime errors without tracebacks, with concise validation details.
packages/uipath/src/uipath/eval/runtime/runtime.py Adds user-facing error classifier and adjusts runtime_exception marking for eval runs.
packages/uipath/src/uipath/_cli/_evals/_telemetry.py Enriches eval failure telemetry with ErrorCode/ErrorCategory when available.
packages/uipath/tests/functions/test_input_validation.py Adds tests ensuring invalid typed inputs become USER-category errors and avoid tracebacks.
packages/uipath/tests/cli/eval/test_runtime_error_classification.py Adds unit tests for user-facing error classification helper.
packages/uipath/tests/cli/eval/test_eval_telemetry.py Adds telemetry test ensuring user-category errors include classification fields and are not runtime exceptions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/uipath/src/uipath/eval/runtime/runtime.py Outdated

@Chibionos Chibionos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

approving, fix the copilot comment and run linting, the spacing seems off to me.

UiPathRuntimeError,
)


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: spacing is wrong here lint should fail for this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The spacing here is the standard two blank lines between the import block and the first top-level def (PEP 8 E303/E302 rules) — ruff check and ruff format --check both pass on this file, so lint is green. Happy to adjust if you meant something else!

mjnovice and others added 2 commits July 9, 2026 14:30
2.13.8 is reserved for #1801, which merges first per its companion-PR
sequence.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lidation-errors

# Conflicts:
#	packages/uipath/pyproject.toml
#	packages/uipath/uv.lock
mjnovice and others added 2 commits July 9, 2026 15:06
Non-EvaluationRuntimeException errors previously fell through with the
model default runtime_exception=False, hiding genuine infrastructure
failures in telemetry. Unwrap the root exception once and classify
every failure uniformly: runtime exception unless user-category.

Addresses PR review feedback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rrors

SonarCloud new-code coverage was 85.7% (<90% gate): the except-path
classification in the eval runtime and the TypeError branch of the
input validation message formatter were untested. Add an end-to-end
failing-execution eval test asserting runtime_exception classification
for user vs unexpected errors, and a dataclass missing-field test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🚨 Heads up: uipath-integrations cross-tests are FAILING 🚨

Your changes may break one or more integrations in uipath-integrations-python:

  • uipath-openai-agents
  • uipath-google-adk
  • uipath-agent-framework
  • uipath-llamaindex
  • uipath-pydantic-ai

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🚨 Heads up: uipath-langchain cross-tests are FAILING 🚨

Your changes may break the uipath-langchain-python integration.

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

@mjnovice mjnovice merged commit 22f5687 into main Jul 10, 2026
166 of 170 checks passed
@mjnovice mjnovice deleted the fix/graceful-input-validation-errors branch July 10, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants