Skip to content

fix: detect job attachments independent of dynamic model build order#902

Open
radu-mocanu wants to merge 1 commit into
mainfrom
fix/job-attachment-build-order
Open

fix: detect job attachments independent of dynamic model build order#902
radu-mocanu wants to merge 1 commit into
mainfrom
fix/job-attachment-build-order

Conversation

@radu-mocanu

@radu-mocanu radu-mocanu commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • job attachment fields are now detected reliably even when several dynamic schemas (e.g. an agent's input and output, or a tool's args) are built in the same process

Why

attachment detection compared field types by object identity against a single process-wide module attribute. each schema build registered its own attachment class under that attribute, so the most recent build won and detection on every other schema silently returned nothing.

Copilot AI review requested due to automatic review settings June 11, 2026 13:25

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 fixes unreliable detection of “job attachment” fields in dynamically generated Pydantic models by removing dependence on the shared dynamic module’s last-written type object. Instead, each generated attachment class now carries a stable per-class marker used during JSONPath discovery, making detection independent of dynamic model build order.

Changes:

  • Add a per-class marker (__uipath_marker_name__) to dynamically generated BaseModel classes during schema-to-model conversion.
  • Update type-matching logic to prefer the per-class marker over module identity when detecting referenced types.
  • Add a regression test ensuring attachment detection remains correct after building a second dynamic model.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/uipath_langchain/agent/react/jsonschema_pydantic_converter.py Sets a stable per-class marker on each generated dynamic BaseModel to avoid build-order-dependent identity issues.
src/uipath_langchain/agent/react/json_utils.py Updates type matching to prefer the new per-class marker, keeping detection stable across multiple dynamic schema builds.
tests/agent/react/test_json_utils.py Adds a regression test covering build-order independence for attachment detection.
pyproject.toml Bumps project version to 0.11.17.
uv.lock Updates locked package version to match 0.11.17.

@radu-mocanu radu-mocanu force-pushed the fix/job-attachment-build-order branch from b23c600 to 9b875cb Compare June 11, 2026 13:38
@radu-mocanu radu-mocanu requested review from cotovanu-cristian and removed request for andreitava-uip and cristian-groza June 11, 2026 13:47
@radu-mocanu radu-mocanu force-pushed the fix/job-attachment-build-order branch from 9b875cb to b91fe74 Compare June 11, 2026 13:51
@sonarqubecloud

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