Skip to content

feat: categorize a few common errors#895

Open
andreiancuta-uipath wants to merge 9 commits into
mainfrom
feat/categorize-errors
Open

feat: categorize a few common errors#895
andreiancuta-uipath wants to merge 9 commits into
mainfrom
feat/categorize-errors

Conversation

@andreiancuta-uipath

@andreiancuta-uipath andreiancuta-uipath commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Moves several high-volume causes out of the AGENT_RUNTIME.UNEXPECTED_ERROR catch-all bucket by catching them at the right layer and raising structured, correctly-categorized AgentRuntimeErrors.

Errors categorized

  • Context grounding index not found — resource lookup failures in the context tool are now surfaced as a typed error instead of leaking from the SDK retriever.
  • Context grounding ingestion in progress (CONTEXT_GROUNDING_INGESTION_IN_PROGRESS, USER) — querying an index before ingestion finishes.
  • Invalid attachment id (INVALID_ATTACHMENT_ID, SYSTEM) — the Analyze Files tool now validates the attachment id is a UUID instead of raising a bare ValueError.
  • Missing Orchestrator attachment (HTTP_ERROR via raise_for_enriched) — a deleted/not-found job attachment is surfaced as a clear error.
  • Agent output schema mismatch (OUTPUT_VALIDATION_ERROR, USER) — model output that fails the configured output schema at termination.
  • Invalid static argument (INVALID_STATIC_ARGUMENT, USER) — a non-dict value for an object-typed static-arg field is now a fatal, categorized error. Also renames SchemaModificationErrorSchemaNavigationError to distinguish skippable navigation failures from this fatal misconfiguration.

Last commit bumps the package version to 0.11.14.

andreiancuta-uipath and others added 6 commits June 8, 2026 14:15
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ument

Rename SchemaModificationError to SchemaNavigationError (navigation
failures are skipped by the caller). A non-dict value for an
object-typed schema field is a distinct, fatal misconfiguration: raise
the new InvalidStaticArgError instead of a bare AssertionError, and catch
it in StaticArgsHandler to surface a categorized AgentRuntimeError
(INVALID_STATIC_ARGUMENT, USER) instead of leaking to UNEXPECTED_ERROR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the bespoke _Attachment stub and the duplicate top-level attachment
tests; consolidate the invalid-UUID and missing-attachment (404) cases
into TestResolveJobAttachmentArguments using the existing MockAttachment
model and the mock_uipath_client fixture.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@andreiancuta-uipath andreiancuta-uipath marked this pull request as ready for review June 8, 2026 13:48
Copilot AI review requested due to automatic review settings June 8, 2026 13:48

Copilot AI 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.

Pull request overview

This PR improves runtime error observability by introducing new AgentRuntimeErrorCodes and mapping several previously “unexpected” exceptions into structured, correctly categorized AgentRuntimeErrors at the appropriate layers.

Changes:

  • Add new runtime error codes and raise typed AgentRuntimeErrors for common high-volume failure modes (context grounding, invalid attachments/static args, output validation).
  • Split schema-related failures into “navigation” (skippable) vs “invalid static arg value” (fatal) errors and update static-args handling accordingly.
  • Bump package version to 0.11.14 and update lockfile.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uv.lock Updates lock metadata and bumps package version entry.
pyproject.toml Bumps package version to 0.11.14.
src/uipath_langchain/agent/exceptions/exceptions.py Adds new AgentRuntimeErrorCode values for newly categorized errors.
src/uipath_langchain/agent/tools/static_args.py Treats invalid object-typed static-arg values as fatal and raises categorized AgentRuntimeError.
src/uipath_langchain/agent/tools/schema_editing.py Introduces SchemaNavigationError vs InvalidStaticArgError and enforces dict-only object static values.
src/uipath_langchain/agent/tools/internal_tools/analyze_files_tool.py Validates attachment IDs as UUIDs and categorizes missing Orchestrator attachments via raise_for_enriched.
src/uipath_langchain/agent/tools/context_tool.py Categorizes context grounding “index not found” and “ingestion in progress” exceptions.
src/uipath_langchain/agent/react/terminate_node.py Converts output schema validation failures into a typed user error (OUTPUT_VALIDATION_ERROR).
tests/agent/tools/test_static_args.py Adds coverage for fatal invalid static arg value behavior and correct categorization.
tests/agent/tools/test_schema_editing.py Updates tests for renamed schema error and adds coverage for invalid object static values.
tests/agent/tools/test_context_tool.py Adds coverage for newly categorized context grounding exceptions.
tests/agent/tools/internal_tools/test_analyze_files_tool.py Updates invalid UUID expectation and adds missing attachment (404) categorized error coverage.
tests/agent/react/test_terminate_node.py Adds coverage for termination output schema mismatch categorization.

Comment thread src/uipath_langchain/agent/tools/internal_tools/analyze_files_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/schema_editing.py
@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

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.

2 participants