Visitar URL original
fix: propagate cancellation during OpenAI attachment reads by ranadeepsingh · Pull Request #2807 · microsoft/SynapseML · GitHub
Skip to content

fix: propagate cancellation during OpenAI attachment reads - #2807

Merged
Rana Singh (ranadeepsingh) merged 1 commit into
microsoft:masterfrom
ranadeepsingh:fix/attachment-cancellation-20261105
Nov 9, 2026
Merged

Rana Singh (ranadeepsingh) merged 1 commit into
microsoft:masterfrom
ranadeepsingh:fix/attachment-cancellation-20261105

Conversation

@ranadeepsingh

Copy link
Copy Markdown
Collaborator

A canceled attachment read can become an ordinary row error instead of unwinding inference. This preserves actual thread and Spark-task cancellation through file reading and prompt-message construction, while retaining sanitized errors for normal read failures.

Related Issues/PRs

Fixes #2801.

Extracted from the scope refinement for #2759. This fix is independent of the native feature and optional recovery work.

What changes are proposed in this pull request?

Recognize real interruption or killed tasks and propagate cancellation through both legacy generative APIs. Preserve ordinary timeout/IO diagnostics and the current public overloads. Add public-transform cancellation regressions and direct read controls; no native adapters, response caps or recovery machinery are included.

How is this patch tested?

  • I have written tests (not required for typo or doc fix) and confirmed the proposed feature/bug-fix/change works.

The interrupted-read regression and both public generative-API cancellation cases failed on baseline. All three and the existing request/schema/persistence controls passed after the fix.

The SBT commands below ran with the branch-selected JDK on baseline d3f3af6bd3e4b7d191f51c9eb29f9aeffe788193 plus the five isolated prerequisite fixes, without AIPrompt feature code. This PR's changed files are byte-identical to those tested files; its patch also applies independently to baseline. The five fixes were tested together, not as five separately rebuilt worktrees. Current-head CI is tracked separately.

Baseline: sbt "cognitive/testOnly com.microsoft.azure.synapse.ml.services.openai.OpenAIPromptMultimodalRequestSuite -- -z \"attachment file reads propagate\" -z \"attachment task cancellation escapes\"" - 3 expected failures with unchanged baseline production.

Fixed: sbt "cognitive/testOnly com.microsoft.azure.synapse.ml.services.openai.OpenAIPromptMultimodalRequestSuite" - 25 passed, none canceled or ignored.

sbt cognitive/scalastyle cognitive/Test/scalastyle - passed, zero errors/warnings.

Does this PR change any dependencies?

  • No. You can skip this section.
  • Yes. Make sure the dependencies are resolved correctly, and list changes here.

Does this PR add a new feature? If so, have you added samples on website?

  • No. You can skip this section.
  • Yes. Make sure you have added samples following below steps.
  1. Find the corresponding markdown file for your new feature in website/docs/documentation folder.
    Make sure you choose the correct class estimators/transformers and namespace.
  2. Follow the pattern in markdown file and add another section for your new API, including pyspark, scala (and .NET potentially) samples.
  3. Make sure the DocTable points to correct API link.
  4. Navigate to website folder, and run npm start to make sure the website renders correctly.
  5. Don't forget to add <!--pytest-codeblocks:cont--> before each python code blocks to enable auto-tests for python samples.
  6. Make sure the WebsiteSamplesTests job pass in the pipeline.

## Summary
Preserve actual thread and Spark-task cancellation through attachment reads
and prompt message construction. Keep ordinary timeout and IO failures as
sanitized row diagnostics. Cover both legacy generative APIs through public
transform actions and retain existing request and persistence cases.

## Prompting Intent
Repair the independently reproduced legacy cancellation defect in its own PR,
without bundling native AIPrompt adapters, bounded attachment features or
optional recovery machinery.

## Linked Sources
- Bug: microsoft#2801
- Scope: microsoft#2759

## Rationale
Cancellation is control flow and must unwind inference rather than become a
normal content-row error. Recognize actual task/thread interruption while
preserving sanitized behavior for unrelated failures. All three new regression
cases failed on baseline; the complete 25-test legacy multimodal suite passed
with the fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733
Copilot AI balanced review requested due to automatic review settings November 5, 2026 10:01
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Hey Rana Singh (@ranadeepsingh) 👋!
Thank you so much for contributing to our repository 🙌.
Someone from SynapseML Team will be reviewing this pull request soon.

We use semantic commit messages to streamline the release process.
Before your pull request can be merged, you should make sure your first commit and PR title start with a semantic prefix.
This helps us to create release messages and credit you for your hard work!

Examples of commit messages with semantic prefixes:

  • fix: Fix LightGBM crashes with empty partitions
  • feat: Make HTTP on Spark back-offs configurable
  • docs: Update Spark Serving usage
  • build: Add codecov support
  • perf: improve LightGBM memory usage
  • refactor: make python code generation rely on classes
  • style: Remove nulls from CNTKModel
  • test: Add test coverage for CNTKModel

To test your commit locally, please follow our guild on building from source.
Check out the developer guide for additional guidance on testing your change.

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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.

🟢 Approval recommended

There are no active review issues for the attachment-read cancellation changes.

No open issues 🎉

What changed in this PR

This PR fixes cancellation handling during OpenAI attachment reads so thread interruption and Spark-task cancellation escape inference rather than becoming ordinary row errors.

Changes:

  • Propagates cancellation while preserving sanitized errors for normal attachment-read failures.
  • Rethrows task-cancellation exceptions during prompt-message construction.
  • Adds direct-read controls and public-transform cancellation regressions for both legacy generative APIs.
File Description
cognitive/​src/​test/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​openai/​OpenAIPromptMultimodalRequestSuite.scala Adds interruption, ordinary I/O failure, and task-cancellation regression tests.
cognitive/​src/​main/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​openai/​OpenAIPrompt.scala Prevents task cancellation from being converted into a row error.
cognitive/​src/​main/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​openai/​OpenAIAttachmentUtils.scala Centralizes read-error handling and propagates thread and task cancellation.

Review effort: Balanced

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

Readiness follow-up for f85a549b97a13a53f4a3fe0dd60ec11312e09bfe: the attachment cancellation fix needs no further production change from the independent review.

  • Local validation passed 35/35 checks, including both public API modes, actual Spark thread interruption, opened-stream cleanup, and ordinary timeout/I/O controls. The exact-base comparison failed precisely six cancellation cases while the other 29 controls passed. Compile, Scala style, pinned Black, and public JVM descriptor checks passed.
  • Azure build 244930473 completed successfully for this exact source head; the published attachment suite passed 25/25. Current GitHub checks are complete.
  • All review bodies and threads were audited, including suppressed/outdated feedback. There are no unresolved findings or requested-change reviews.

The scope remains cancellation classification/propagation after a read throws, not new transport deadlines or active abort of an unresponsive read. A close-failure masking edge case in the existing stream utility reproduces on both base and head and is not introduced here.

Engineering validation is complete for this head. Required human approval remains; this comment is not an approval or a merge.

@ranadeepsingh
Rana Singh (ranadeepsingh) merged commit 4a06252 into microsoft:master Nov 9, 2026
77 checks passed
Bora Elkin (BoraElkin) pushed a commit to BoraElkin/SynapseML that referenced this pull request Nov 9, 2026
AB#5837660

## Summary
Add a combined persistence regression after integrating the latest master fixes.
Verify that an explicitly assigned Spark session is used without promoting
default scalar parameters into explicit values. Preserve the historical review
archive through rebased links and include the focused integration review.

## Prompting Intent
The engineer approved resolving the newly introduced merge conflicts without
losing either CU behavior or upstream fixes, validating and reviewing the
result, publishing with an explicit force-with-lease, and rerunning CI.

## Linked Sources
- Feature PR: microsoft#2815
- Python method extraction: microsoft#2810
- Assigned Spark sessions: microsoft#2809
- Response cleanup: microsoft#2808
- Attachment cancellation: microsoft#2807
- Global parameter synchronization: microsoft#2806
- Integration target: 6c2699d
- Focused review: reviews/pr-2815/task-5837660-attempt-10-review-0-harness.md

## Rationale
Keep both sides of the code-generation and persistence conflicts rather than
choosing one wholesale. A combined public save/load test checks the interaction
that independent upstream and CU tests do not explicitly cover. Rebase preserves
the six original changes and their messages; all 53 archived report blobs and
modes are unchanged. Local validation passed 310 Scala and 73 Python tests,
with one existing ignored global-fuzzing test, plus style, compilation, codegen
and pinned formatting. New-head CI remains a separate post-publication gate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 653e4257-0554-408f-9e0e-b23750249edb
Rana Singh (ranadeepsingh) added a commit to ranadeepsingh/SynapseML that referenced this pull request Nov 9, 2026
## Summary
Extract the existing loopback HTTP fixture from the combined multimodal
suite and remove two blank lines from OpenAIPrompt. Keep both files within
the existing 800-line style limit after integrating master.

## Prompting Intent
Rebase PR 2781 onto the latest master after the owner's recent merges,
preserving both upstream fixes and the PR's cache and parameter changes.

## Linked Sources
- Rebased PR: microsoft#2781
- Upstream cancellation fix: microsoft#2807
- Owner's request to rebase onto the latest master.

## Rationale
Keep upstream TaskKilledException propagation and all existing PR behavior.
Retain every test and assertion while moving only fixture setup into a test
base. Production changes are whitespace-only; the style gate is not weakened.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8129ea36-8506-40f7-a401-b14bc08e5b30
Rana Singh (ranadeepsingh) added a commit to ranadeepsingh/SynapseML that referenced this pull request Nov 10, 2026
Summary:
- Check task/thread cancellation before and after attachment IO.
- Recognize wrapped and suppressed interruption, including cyclic exception graphs, without treating storage timeouts as cancellation or replacing fatal errors.
- Cover both legacy chat-completions and responses paths with local filesystem and HTTP fixtures; no live service calls.

Prompting intent:
Preserve reviewed follow-up fixes after the prerequisite PRs were merged, and complete current-source validation and review.

Linked sources:
Follow-up to microsoft#2807 and microsoft#2801.

Rationale:
Attachment storage can wrap or clear interruption signals, causing a canceled Spark task to continue or return an ordinary row error. This follow-up preserves cancellation through file reads and cleanup while keeping storage timeouts sanitized and row-local.

Local validation:
sbt "set cognitive / Test / fork := false" "cognitive/compile" "cognitive/Test/compile" "cognitive/testOnly com.microsoft.azure.synapse.ml.services.openai.OpenAIPromptMultimodalRequestSuite" "cognitive/scalastyle" "cognitive/Test/scalastyle"
Passed: 69 tests, 0 skipped, compile/Test compile, both scalastyle gates.

Publication:
Explicitly authorized draft-first bootstrap; formal reviews and current-head CI remain pending.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733
Rana Singh (ranadeepsingh) added a commit to ranadeepsingh/SynapseML that referenced this pull request Nov 10, 2026
Add AIPrompt on the existing OpenAIPrompt interface for explicit chat,
Responses, embeddings and native decision-model APIs. Preserve request
options, typed results, errors and raw responses through Scala and generated
Python, copy, persistence and pipelines. Add the AIPrompt notebook and guide.

Keep the contribution focused on AIPrompt and small native specializations.
Separate independent legacy defects and optional Delta recovery into their
own issues and PRs. Exercise supported notebook examples on packaged
artifacts, but leave OpenAIDecisions examples commented because Azure
OpenAI/Foundry does not support that API.

- Native inference proposal: microsoft#2759
- Deferred recovery: microsoft#2800
- Deferred live Decisions qualification: microsoft#2760
- Global parameter prerequisite: microsoft#2806
- Attachment cancellation prerequisite: microsoft#2807
- Response cleanup prerequisite: microsoft#2808
- Assigned-session prerequisite: microsoft#2809
- Python stub prerequisite: microsoft#2810
- Existing tutorial: docs/Explore Algorithms/OpenAI/OpenAI.ipynb

Reuse existing authentication and HTTP infrastructure rather than add a
second inference transport. Keep public behavior in Scala and generate
Python conveniences without changing legacy public JVM signatures or
serialized parameter shapes. Explicit API selection and lossless JSON avoid
silent option loss; bounded cancellation handles interrupted Spark work.
Keep ordinary inference lazy and replayable, without Delta, an automatic
tool loop, response-size configuration or an exactly-once claim.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733
Rana Singh (ranadeepsingh) added a commit to ranadeepsingh/SynapseML that referenced this pull request Nov 10, 2026
Add AIPrompt on the existing OpenAIPrompt interface for explicit chat,
Responses, embeddings and native decision-model APIs. Preserve request
options, typed results, errors and raw responses through Scala and generated
Python, copy, persistence and pipelines. Add the AIPrompt notebook and guide.

Keep the contribution focused on AIPrompt and small native specializations.
Separate independent legacy defects and optional Delta recovery into their
own issues and PRs. Exercise supported notebook examples on packaged
artifacts, but leave OpenAIDecisions examples commented because Azure
OpenAI/Foundry does not support that API.

- Native inference proposal: microsoft#2759
- Deferred recovery: microsoft#2800
- Deferred live Decisions qualification: microsoft#2760
- Global parameter prerequisite: microsoft#2806
- Attachment cancellation prerequisite: microsoft#2807
- Response cleanup prerequisite: microsoft#2808
- Assigned-session prerequisite: microsoft#2809
- Python stub prerequisite: microsoft#2810
- Existing tutorial: docs/Explore Algorithms/OpenAI/OpenAI.ipynb

Reuse existing authentication and HTTP infrastructure rather than add a
second inference transport. Keep public behavior in Scala and generate
Python conveniences without changing legacy public JVM signatures or
serialized parameter shapes. Explicit API selection and lossless JSON avoid
silent option loss; bounded cancellation handles interrupted Spark work.
Keep ordinary inference lazy and replayable, without Delta, an automatic
tool loop, response-size configuration or an exactly-once claim.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733
Rana Singh (ranadeepsingh) added a commit to ranadeepsingh/SynapseML that referenced this pull request Nov 10, 2026
Add AIPrompt on the existing OpenAIPrompt interface for explicit chat,
Responses, embeddings and native decision-model APIs. Preserve request
options, typed results, errors and raw responses through Scala and generated
Python, copy, persistence and pipelines. Add the AIPrompt notebook and guide.

Keep the contribution focused on AIPrompt and small native specializations.
Separate independent legacy defects and optional Delta recovery into their
own issues and PRs. Exercise supported notebook examples on packaged
artifacts, but leave OpenAIDecisions examples commented because Azure
OpenAI/Foundry does not support that API.

- Native inference proposal: microsoft#2759
- Deferred recovery: microsoft#2800
- Deferred live Decisions qualification: microsoft#2760
- Global parameter prerequisite: microsoft#2806
- Attachment cancellation prerequisite: microsoft#2807
- Response cleanup prerequisite: microsoft#2808
- Assigned-session prerequisite: microsoft#2809
- Python stub prerequisite: microsoft#2810
- Existing tutorial: docs/Explore Algorithms/OpenAI/OpenAI.ipynb

Reuse existing authentication and HTTP infrastructure rather than add a
second inference transport. Keep public behavior in Scala and generate
Python conveniences without changing legacy public JVM signatures or
serialized parameter shapes. Explicit API selection and lossless JSON avoid
silent option loss; bounded cancellation handles interrupted Spark work.
Keep ordinary inference lazy and replayable, without Delta, an automatic
tool loop, response-size configuration or an exactly-once claim.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733
Rana Singh (ranadeepsingh) added a commit to ranadeepsingh/SynapseML that referenced this pull request Nov 10, 2026
Add AIPrompt on the existing OpenAIPrompt interface for explicit chat,
Responses, embeddings and native decision-model APIs. Preserve request
options, typed results, errors and raw responses through Scala and generated
Python, copy, persistence and pipelines. Add the AIPrompt notebook and guide.

Keep the contribution focused on AIPrompt and small native specializations.
Separate independent legacy defects and optional Delta recovery into their
own issues and PRs. Exercise supported notebook examples on packaged
artifacts, but leave OpenAIDecisions examples commented because Azure
OpenAI/Foundry does not support that API.

- Native inference proposal: microsoft#2759
- Deferred recovery: microsoft#2800
- Deferred live Decisions qualification: microsoft#2760
- Global parameter prerequisite: microsoft#2806
- Attachment cancellation prerequisite: microsoft#2807
- Response cleanup prerequisite: microsoft#2808
- Assigned-session prerequisite: microsoft#2809
- Python stub prerequisite: microsoft#2810
- Existing tutorial: docs/Explore Algorithms/OpenAI/OpenAI.ipynb

Reuse existing authentication and HTTP infrastructure rather than add a
second inference transport. Keep public behavior in Scala and generate
Python conveniences without changing legacy public JVM signatures or
serialized parameter shapes. Explicit API selection and lossless JSON avoid
silent option loss; bounded cancellation handles interrupted Spark work.
Keep ordinary inference lazy and replayable, without Delta, an automatic
tool loop, response-size configuration or an exactly-once claim.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733
Rana Singh (ranadeepsingh) added a commit to ranadeepsingh/SynapseML that referenced this pull request Nov 12, 2026
Extract the existing loopback HTTP fixture from the combined multimodal
suite and remove two blank lines from OpenAIPrompt. Keep both files within
the existing 800-line style limit after integrating master.

Rebase PR 2781 onto the latest master after the owner's recent merges,
preserving both upstream fixes and the PR's cache and parameter changes.

- Rebased PR: microsoft#2781
- Upstream cancellation fix: microsoft#2807
- Owner's request to rebase onto the latest master.

Keep upstream TaskKilledException propagation and all existing PR behavior.
Retain every test and assertion while moving only fixture setup into a test
base. Production changes are whitespace-only; the style gate is not weakened.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8129ea36-8506-40f7-a401-b14bc08e5b30
Rana Singh (ranadeepsingh) added a commit that referenced this pull request Nov 12, 2026
* feat: add unified AI prompting and native decision model support

Add AIPrompt on the existing OpenAIPrompt interface for explicit chat,
Responses, embeddings and native decision-model APIs. Preserve request
options, typed results, errors and raw responses through Scala and generated
Python, copy, persistence and pipelines. Add the AIPrompt notebook and guide.

Keep the contribution focused on AIPrompt and small native specializations.
Separate independent legacy defects and optional Delta recovery into their
own issues and PRs. Exercise supported notebook examples on packaged
artifacts, but leave OpenAIDecisions examples commented because Azure
OpenAI/Foundry does not support that API.

- Native inference proposal: #2759
- Deferred recovery: #2800
- Deferred live Decisions qualification: #2760
- Global parameter prerequisite: #2806
- Attachment cancellation prerequisite: #2807
- Response cleanup prerequisite: #2808
- Assigned-session prerequisite: #2809
- Python stub prerequisite: #2810
- Existing tutorial: docs/Explore Algorithms/OpenAI/OpenAI.ipynb

Reuse existing authentication and HTTP infrastructure rather than add a
second inference transport. Keep public behavior in Scala and generate
Python conveniences without changing legacy public JVM signatures or
serialized parameter shapes. Explicit API selection and lossless JSON avoid
silent option loss; bounded cancellation handles interrupted Spark work.
Keep ordinary inference lazy and replayable, without Delta, an automatic
tool loop, response-size configuration or an exactly-once claim.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733

* style: format AIPrompt Python regression tests

Summary
- Apply the pinned Black formatter to the AIPrompt regression suite and its
  Fabric validation helper.

Prompting Intent
- Keep the focused AIPrompt pull request limited to required feature work
  and repairs to its own validation gates.

Linked Sources
- #2811
- https://github.com/microsoft/SynapseML/actions/runs/42014432464

Rationale
- The Python style gate identified formatting in two new test files.
- The changes preserve both files' Python ASTs, and the repository's
  tracked Python files pass Black 22.3.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733

* fix: align AIPrompt coverage count and notebook formatting

## Summary
Account for the additional AI test lane in Codecov's expected upload count
and apply the pinned notebook formatter to the new AIPrompt tutorial.

## Prompting Intent
Repair the deterministic checks introduced by the focused AIPrompt change
without changing dependency pins, workflows, release tooling or unrelated
notebooks, and preserve the already-executed tutorial behavior.

## Linked Sources
- #2759
- #2811

## Rationale
The authorized AI matrix lane raises expected uploads from 54 to 55.
Keep the existing coverage-count assertion unchanged and fix its configuration.
Black 22.3.0 with Jupyter support changes formatting only: all 18 code-cell
ASTs, metadata and markdown remain identical, outputs stay cleared and
OpenAIDecisions remains commented. The full CI Black command and the targeted
coverage-upload selection test pass locally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733

* fix: harden AIPrompt cancellation and compatibility boundaries

Integrate reviewed session-persistence, codegen and attachment fixes; retain
task kill reasons, transport cancellation, value-codec regressions and the
32 supported notebook examples.

Freeze scope, finish running reviews, address blockers, publish and run
current-head CI instead of starting additional full review matrices.

- #2811
- #2818
- #2819
- #2820

Ensure the integrated public AIPrompt path preserves the same cancellation,
persistence and generated-wrapper contracts as the prerequisite fixes.
Keep unsupported Decisions examples commented out and existing limitations
visible. Do not expand scope to unrelated codegen or connector behavior.

Source-scoped qualification covers 511 cognitive and 189 core cases with zero
skips, six notebook cases and 33 installed Python cases. Compile, style,
codegen, packaging and exact installed artifact provenance are retained.
The latest test-only changes passed targeted regressions without altering
the qualified runtime artifacts. Existing reviews and dispositions are
retained; no additional full matrix is claimed. Fresh CI is still required.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733

* docs: explain AIPrompt API contracts with a diagram

## Summary
Add a shared API-routing diagram to the AIPrompt getting-started notebook
and usage guide. Clarify supported parameter mappings, intentional legacy
differences, native results and provider availability without changing code.

## Prompting Intent
Explain whether AIPrompt supports all five API types and preserves the
semantics and parameters of OpenAIPrompt and the native decision stages.
Generate an understandable diagram and include it in the PR description
and the getting-started notebook.

## Linked Sources
- #2811
- #2759
- #2760
- docs/Explore Algorithms/OpenAI/Unified AI prompting.md
- cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/ai/AIRequestAdapter.scala
- cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/ai/AIPrompt.scala
- https://github.com/user-attachments/assets/bfcb52f9-b019-455b-9e23-598a44fae229

## Rationale
Use one GitHub-hosted diagram in the PR, notebook and guide, following
the tutorials' hosted-image convention. Combine a generated background
with deterministic labels and connectors for precise technical content.
Keep the existing runnable examples unchanged and explicitly distinguish
Foundry SystemOne from the unsupported Azure OpenAI/Foundry Decisions path.
Describe per-API support instead of claiming universal legacy parity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733

* fix: route AIPrompt API versions without a version allowlist

Summary:
- Select the v1 Chat Completions and Responses route with apiVersion.
- Forward other version strings in api-version, including for Decisions.
- Default OpenAIDecisions to v1 while preserving complete URL overrides.
- Cover scalar, per-row and persisted versions and document migration.

Prompting Intent:
Let callers use v1, preview, dated and future API versions through the
existing parameter without library-maintained version restrictions.

Linked Sources:
- User request to select the v1 URI and forward all other version strings.
- #2759
- #2811

Rationale:
API version selection belongs to the provider. Reuse the existing
ServiceParam and preserve public signatures, legacy stages and URL
override behavior instead of introducing a separate routing parameter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733

* fix: default AIPrompt chat and responses to v1

Summary:
- Default Chat Completions and Responses requests to the v1 route.
- Preserve explicit and configured version overrides and embedding defaults.
- Cover default routing through copy, save/load and clearing an override.
- Update the usage guide and notebook migration notes.

Prompting Intent:
Keep v1 as the default API version for Chat Completions and Responses,
alongside the existing OpenAIDecisions v1 default.

Linked Sources:
- User request: keep v1 as the default for Chat Completions and Responses.
- #2811
- #2759

Rationale:
Use the v1 route without requiring a redundant setter. Change only the
generative fallback so configured scalar and per-row versions, complete
URL overrides, embeddings and legacy OpenAI stages retain their behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733

* fix: support Foundry Decisions inference

Foundry exposes Decisions for supported gpt-6-luna deployments, but the
new stages rejected Azure hosts before HTTP and selected bearer-key
authentication for every Decisions endpoint.

Route Azure resource roots through /openai/v1/decisions, retain api-key
authentication for Azure keys, and preserve Entra, proxy, version and
complete-URL behavior. Replace obsolete rejection tests with routing and
authentication regressions. Add opt-in Chat and Responses live tests,
enable the notebook's Foundry Decisions examples, and correct the guide
and shared diagram.

User intent: correct Foundry support and live-test all four inference APIs.
Sources: #2759, #2760,
https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/decisions

Validation: 215 Scala cases, 33 installed-package Python cases, six
notebook tests and four real service tests passed with zero skips.
The live tests exercised Chat, Responses, Decisions and SystemOne using
six valid stage invocations on existing Sweden Central deployments.
Compilation, Scala style, Python formatting, codegen and packaging passed.
Loaded JARs and generated Python sources matched the validated build.
No new deployments or dependency changes; no full notebook rerun or
current-head remote CI pass is claimed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ba39157-c8dd-4adb-90e0-ff963a1e6733
Bora Elkin (BoraElkin) pushed a commit to BoraElkin/SynapseML that referenced this pull request Nov 12, 2026
AB#5837660

## Summary
Add a combined persistence regression after integrating the latest master fixes.
Verify that an explicitly assigned Spark session is used without promoting
default scalar parameters into explicit values. Preserve the historical review
archive through rebased links and include the focused integration review.

## Prompting Intent
The engineer approved resolving the newly introduced merge conflicts without
losing either CU behavior or upstream fixes, validating and reviewing the
result, publishing with an explicit force-with-lease, and rerunning CI.

## Linked Sources
- Feature PR: microsoft#2815
- Python method extraction: microsoft#2810
- Assigned Spark sessions: microsoft#2809
- Response cleanup: microsoft#2808
- Attachment cancellation: microsoft#2807
- Global parameter synchronization: microsoft#2806
- Integration target: 6c2699d
- Focused review: reviews/pr-2815/task-5837660-attempt-10-review-0-harness.md

## Rationale
Keep both sides of the code-generation and persistence conflicts rather than
choosing one wholesale. A combined public save/load test checks the interaction
that independent upstream and CU tests do not explicitly cover. Rebase preserves
the six original changes and their messages; all 53 archived report blobs and
modes are unchanged. Local validation passed 310 Scala and 73 Python tests,
with one existing ignored global-fuzzing test, plus style, compilation, codegen
and pinned formatting. New-head CI remains a separate post-publication gate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 653e4257-0554-408f-9e0e-b23750249edb
Rana Singh (ranadeepsingh) added a commit to ranadeepsingh/SynapseML that referenced this pull request Nov 13, 2026
Extract the existing loopback HTTP fixture from the combined multimodal
suite and remove two blank lines from OpenAIPrompt. Keep both files within
the existing 800-line style limit after integrating master.

Rebase PR 2781 onto the latest master after the owner's recent merges,
preserving both upstream fixes and the PR's cache and parameter changes.

- Rebased PR: microsoft#2781
- Upstream cancellation fix: microsoft#2807
- Owner's request to rebase onto the latest master.

Keep upstream TaskKilledException propagation and all existing PR behavior.
Retain every test and assertion while moving only fixture setup into a test
base. Production changes are whitespace-only; the style gate is not weakened.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8129ea36-8506-40f7-a401-b14bc08e5b30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: propagate task cancellation during OpenAI attachment reads

3 participants