Skip to content

Support Modal OAuth client credentials on the modal connection - #77858

Draft
Lee-W wants to merge 1 commit into
apache:mainfrom
astronomer:common-ai-strands-interrupt-fail
Draft

Lee-W wants to merge 1 commit into
apache:mainfrom
astronomer:common-ai-strands-interrupt-fail

Conversation

@Lee-W

@Lee-W Lee-W commented Dec 1, 2026

Copy link
Copy Markdown
Member

The modal connection type only modelled an API token, so a deployment that
was given Modal OAuth client credentials had to fall back to MODAL_OAUTH_*
environment variables on every worker.

The connection now accepts oauth_refresh_token, oauth_client_id and
oauth_client_secret in its extra. With all three set and login/password
empty, ModalHook builds the client with Client.from_oauth_credentials, on
both the sync and the async (trigger) path. A token field together with an
OAuth field, or only some of the OAuth fields, raises ModalConnectionError
instead of falling back to ambient credentials.

Client.from_oauth_credentials first shipped in modal 1.5.5, so the floor
moves from 1.5.0 to 1.5.5.

The async path now reads the connection extra with get_async_extra_dejson,
since Connection.extra_dejson masks secrets through a synchronous
supervisor call that must not run on the triggerer's event loop.

The Common AI Modal sandbox backend's rejected-credentials message no
longer says "login and password", which would be wrong for an OAuth
connection.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

A Strands tool or hook can call interrupt() to wait for a person's answer.
The agent then returns with stop_reason "interrupt" and the pending question
in result.interrupts. invoke_durably() treated that as a finished run: it
deleted the saved state and returned, so a task that returned
str(invoke_durably(...)) succeeded with the interrupt list in XCom, and the
tool that asked never ran.

invoke_durably() now raises UnsupportedToolDeferralError naming each
interrupt, and the task fails without retrying, as run_durably does for the
OpenAI Agents SDK when a run stops for tool approval. The message leaves out
each interrupt's reason, which can hold the data waiting for review. The
saved state is kept, so clearing the task with its task state kept resumes
from the last pause instead of running the earlier cycles again.
@Lee-W
Lee-W force-pushed the common-ai-strands-interrupt-fail branch from 50a45d2 to 7c60ac6 Compare December 1, 2026 15:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant