Skip to content

fix: dev to main - Fix environment lookup errors and simplify data setup process - #1061

Merged
Roopan-Microsoft merged 11 commits into
mainfrom
dev
Sep 1, 2026
Merged

Roopan-Microsoft merged 11 commits into
mainfrom
dev

Conversation

@Pavan-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces several improvements and fixes across deployment scripts and the API ingestion module, focusing on more robust environment variable handling, safer agent settings synchronization, streamlined data upload and registration, and improved multi-instance ingestion status checks.

Deployment and Environment Handling Improvements:

  • Improved Get-AzdEnvValue in both connect-data.ps1 and setup-agent.ps1 to more robustly filter out error values and handle exit codes, preventing invalid data from being used in subsequent steps. [1] [2]
  • Enhanced agent settings synchronization logic in both scripts to only include settings with valid values, omitting unset or invalid ones to avoid API validation errors. [1] [2]

Data Upload and Registration Workflow:

  • Refactored the data setup process in setup-data.ps1 to confirm only upload registration (not full ingestion), reducing deployment time and risk of timeouts. The new Confirm-UploadRegistered function replaces the previous ingestion completion polling and batch upload retry logic. [1] [2] [3]
  • Simplified batch upload error handling by removing the custom retry wrapper and handling errors inline, improving clarity and reliability. [1] [2]

Documentation and API Reliability:

  • Updated documentation to clarify that Azure AI Search must have public network access enabled.
  • Improved the ingestion API's multi-instance reliability by checking the SQL source of truth before marking files as failed, preventing false negatives in distributed deployments. [1] [2]

These changes together make the deployment process more robust, reduce the chance of configuration errors, and improve the reliability of file ingestion status reporting in multi-instance environments.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

Kevin Yang (cyberflying) and others added 11 commits August 25, 2026 22:39
Prevent azd error output from being written into App Service settings when optional agent environment keys are missing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- setup-data.ps1: remove long wait/retry indexing logic added in PR #1044;
  restore pre-PR-1044 simple upload/cleanup flow since App Services keep
  VNet integration regardless of public network toggle. Keep -ResourceGroupName
  param and RG auto-discovery.
- connect-data.ps1, setup-agent.ps1: fix Get-AzdEnvValue error detection
  (align with PR #1057) and only send USE_SQL/agent settings when valid/non-empty
  to avoid Pydantic bool validation crash on API startup.
- nginx.conf: add client_max_body_size to fix 413 errors on manual UI uploads
  proxied through the frontend in private-networking mode.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… in stale-file watchdog

- sql_service.get_file_status now closes the connection in a finally
  block so a query exception doesn't leak the connection.
- router.py's stale-file watchdog now runs the SQL status check via
  asyncio.to_thread so the blocking pyodbc call doesn't stall the
  event loop, and syncs the in-memory cache to the SQL status instead
  of just skipping the flip, so the UI stops showing stale 'processing'
  state on this instance.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…dates

chore: Simplify data setup and fix upload
docs: Add prerequisite note for Azure AI Search network access

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 deployment reliability and ingestion status correctness by hardening environment/appsettings sync logic, simplifying post-provision data setup to avoid long waits/timeouts, and adding a multi-instance-safe check before marking uploads as failed.

Changes:

  • Increase Nginx upload size limit to align with backend upload constraints for proxied uploads.
  • Add a SQL “source of truth” point-read and use it to avoid false “failed” flips in multi-instance ingestion scenarios.
  • Refactor post-provision data setup to confirm upload registration only (not full ingestion completion) and simplify upload error handling.

Reviewed changes

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

Show a summary per file
File Description
src/app/nginx.conf Raises client_max_body_size so Nginx doesn’t block legitimate uploads before the API sees them.
src/api/storage/sql_service.py Adds get_file_status SQL point-read used as a multi-instance consistency guard.
src/api/modules/ingestion/router.py Uses SQL point-read (via asyncio.to_thread) before force-failing stale “processing” files.
infra/scripts/post-provision/setup-data.ps1 Reworks post-provision flow to verify registration only and simplifies batch upload handling.
infra/scripts/post-provision/setup-agent.ps1 Makes azd env get-value parsing safer and syncs only valid/non-empty app settings.
infra/scripts/post-provision/connect-data.ps1 Mirrors safer azd env lookup and avoids pushing invalid agent settings.
docs/ConnectDataSource.md Documents BYOD Search requirement for public network access.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/api/storage/sql_service.py
Comment thread infra/scripts/post-provision/setup-data.ps1
@Roopan-Microsoft
Roopan-Microsoft merged commit 8a00aa5 into main Sep 1, 2026
9 checks passed
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.

6 participants