Skip to content

fix: apply connection binding overwrite to BYO model resolution - #126

Merged
andreiancuta-uipath merged 1 commit into
mainfrom
fix/byo-connection-binding-overwrite
Aug 13, 2026
Merged

fix: apply connection binding overwrite to BYO model resolution#126
andreiancuta-uipath merged 1 commit into
mainfrom
fix/byo-connection-binding-overwrite

Conversation

@andreiancuta-uipath

@andreiancuta-uipath andreiancuta-uipath commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Problem

Binding overwrite for model connection id (enabled for a few customers that need models scoped to folders) was not applied. This means that both lookup and completions used the original, in-project id. This can lead to the discovery lookup not matching the model, because it was looking for the wrong connection id.

The same stale id also reaches the gateway as X-UiPath-LlmGateway-ByoIsConnectionId, so even a successful lookup would route against the wrong connection.

Fix

Apply the active connection.<id> overwrite at the two points where byo_connection_id is consumed:

Function Covers
UiPathBaseSettings.get_model_info discovery lookup — get_chat_model, get_embedding_model, and UiPathBaseLLMClient.setup_model_info
build_routing_headers X-UiPath-LlmGateway-ByoIsConnectionId — both the sync and async UiPathHttpxClient

Every entry point inherits the remap: the factory functions, direct UiPathChat(...) / embeddings construction, and callers layered above them. resource_override is a no-op when no overwrites are active, so local and non-BYOM runs are unchanged.

This mirrors BindingsOverwriter.ApplyAgentSettingsOverwrites on the C# side. The legacy in-repo clients (uipath-langchain) carry the decorator on their __init__, which fixed the header but never the lookup, because the legacy factory resolves the model before constructing the client — the same ordering trap one layer up.

CI

The Test job is red, but no test failed. The session collects 3164 items and reaches [100%] with no F or E in the progress output, and the log has no FAILED line and no short test summary. pytest then crashes in pytest_sessionfinish while writing the warnings summary:

_pytest/terminal.py:1107  summary_warnings
_pytest/_io/terminalwriter.py:168  write_raw
BlockingIOError: [Errno 11] write could not complete without blocking

The runner's stdout pipe is non-blocking, so a full buffer returns EAGAIN instead of blocking. The warnings summary is large enough to fill it: langchain_tests marks its sync tests with a class-level @pytest.mark.asyncio, emitting one long PytestWarning per parametrized model/provider combination. The unhandled error propagates out of the hook and pytest exits 1.

Unrelated branches hit the same crash (run 31717075787), and the same commit flips between pass and fail across re-runs. Fix tracked in a separate PR — silencing the warning via filterwarnings in pyproject.toml.

🤖 Generated with Claude Code

Solution-deployed BYOM agents fail at startup with "Model <name> not found"
listing that same model: the package carries the design-time connection id while
the job's resource overwrites carry the connection actually bound in the target
folder. get_model_info filters discovery entries by
byomDetails.integrationServiceConnectionId against the stale id and matches
nothing.

Decorate the two places byo_connection_id is consumed — the discovery lookup and
the ByoIsConnectionId routing header. Every entry point inherits the remap:
get_chat_model, direct chat model construction, and embeddings. Callers that
forward a design-time id no longer have to apply the binding themselves.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@andreiancuta-uipath
andreiancuta-uipath merged commit c150738 into main Aug 13, 2026
11 of 12 checks passed
@andreiancuta-uipath
andreiancuta-uipath deleted the fix/byo-connection-binding-overwrite branch August 13, 2026 16:24
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