feat(context): fail fast when searchDuringIngestion lacks its feature flag - #1118
Open
CalebMartinUiPath wants to merge 1 commit into
Open
CalebMartinUiPath wants to merge 1 commit into
CalebMartinUiPath wants to merge 1 commit into
Conversation
… flag The agent.json ``searchDuringIngestion`` opt-in was honoured as soon as it appeared in the resource settings. An agent.json can carry it from a designer build, or by hand, before the tenant has the feature, so the setting alone is not enough to turn the behaviour on. Require EnableContextGroundingSearchDuringIngestion as well, and treat the mismatch as a configuration error: a resource that asks to search during ingestion without the feature enabled raises AgentStartupError at graph build, rather than quietly downgrading to the old blocking behaviour. Downgrading silently would look like the toggle was on while every search against an ingesting index kept failing, which is the harder thing to diagnose. The check sits in handle_semantic_search rather than ensure_valid_fields: that validator is shared with the DeepRAG and BatchTransform handlers, where the setting is inert, and failing those would reject agents over a setting that does nothing. Gated here rather than in unified_search: the flag registry is populated by the agents runtime at startup, so gating the SDK would silently disable `uipath context-grounding search --search-during-ingestion` for anyone using the SDK or CLI directly. The SDK keeps the capability; the runtime owns the policy. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CalebMartinUiPath
force-pushed
the
caleb/ff-search-during-ingestion
branch
from
September 28, 2026 20:55
ac61d69 to
c150672
Compare
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Newly added and modified test functions lack required complete type annotations.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Adds startup validation so semantic context resources cannot enable search-during-ingestion without the tenant feature flag.
Changes:
- Adds feature-flag validation with a structured startup error.
- Tests enabled, disabled, absent, and DeepRAG scenarios.
| File | Description |
|---|---|
src/uipath_langchain/agent/tools/context_tool.py |
Enforces the feature flag during semantic tool creation. |
tests/agent/tools/test_context_tool.py |
Covers feature-flag combinations and unaffected modes. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| @staticmethod | ||
| async def _retriever_kwargs_for(resource): | ||
| async def _retriever_kwargs_for(resource, *, flag_enabled: bool = False): |
|
|
||
| assert kwargs["search_during_ingestion"] is False | ||
|
|
||
| def test_opt_in_without_the_flag_fails_fast(self): |
pateljay43
reviewed
Sep 29, 2026
| AgentToolArgumentProperties, | ||
| LowCodeAgentDefinition, | ||
| ) | ||
| from uipath.core.feature_flags import FeatureFlags |
There was a problem hiding this comment.
is there no precedent on FF gating for any of the context tool features? idk much about this codebase so I cant comment if this is the ideal place or not.
pateljay43
approved these changes
Sep 29, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Why
Review feedback on the designer PR: the checkbox is flag-gated in the UI, so the backend should honour the same flag rather than trusting
agent.jsonalone.Today the runtime acts on
settings.searchDuringIngestionas soon as it appears. Anagent.jsoncan carry it from a designer build, or by hand, before the tenant has the feature — so the setting alone is not enough to turn the behaviour on.What
A resource that asks to search during ingestion without
EnableContextGroundingSearchDuringIngestionnow fails at graph build withAgentStartupError/INVALID_TOOL_CONFIG/USER:Why fail rather than downgrade. Silently coercing to
Falsewould look like the toggle was on while every search against an ingesting index kept being rejected — the harder thing to diagnose. Failing at startup puts the misconfiguration in front of whoever deployed it.Three decisions worth reviewing
Build time, not invocation.
prefetch_all_flags()runs at the top of runtime creation, before the graph is compiled, so the registry is populated by the timehandle_semantic_searchruns — the same assumption the ontology gate already makes. Checking here means a bad config never produces a runnable agent.In
handle_semantic_search, notensure_valid_fields. That validator is shared with the DeepRAG and BatchTransform handlers, where the setting is inert — failing those would reject agents over a setting that does nothing. Covered by a test.Not in
unified_search. The registry is populated by the agents runtime, so an SDK or CLI user has an empty registry; gating the SDK would makedefault=Falsesilently breakuipath context-grounding search --search-during-ingestion. The SDK keeps the capability; the runtime owns the policy. Same layering asDataFabricOntologyEnabled.Merge order — this one first
UiPath/uipath-agents-python#771 registers the flag in
_ALL_FLAGS. Without it the check falls through to env var thendefault=False, so a resource with the setting on would fail to start.Merge this PR first and let it release. #771 then bumps the agents repo's exact
uipath-langchain==pin to that release in the same PR as the flag registration, so the gate and the flag it reads go live in one commit — no window where one exists without the other. That bundling matches UiPath/uipath-agents-python#760, which moved the pin alongside the change that needed it.Nothing uses
searchDuringIngestiontoday, so there is no exposure either way.Testing
FalsefalseFalsetrueAgentStartupErrorfalseFalsetrueTruetrueon a DeepRAG resource6 tests. Negative-checked: removed the fail-fast, confirmed the test fails, restored.
ruff,ruff format(404 files),mypy(210 files) and the httpx linter clean; context-tool and retriever suites green.🤖 Generated with Claude Code