Skip to content

Foundry hosting: WorkflowAgent path drops cancellation_signal #7511

Description

Summary

In agent-framework-foundry-hosting==1.0.0b260730 (and current main), ResponsesHostServer._handle_response accepts cancellation_signal: asyncio.Event but the WorkflowAgent branch calls _handle_inner_workflow(request, context) without forwarding the signal. _handle_inner_workflow has no cancellation_signal parameter and does not poll it around WorkflowAgent.run().

Impact

POST /responses/{id}/cancel (via azure-ai-agentserver-responses) sets the same event and stops event consumption (with winddown), so the response can become cancelled while in-flight model/tool/workflow execution continues until natural completion. This wastes quota and risks late work after cancel for hosted WorkflowAgent products.

Earlier design

Commit ce8b630 (Foundry hosted agent V2) previously passed cancellation_signal into the workflow handler. The current Responses adapter appears to have dropped that wiring.

Expected

  1. Forward cancellation_signal into the WorkflowAgent (and preferably regular agent) inner handlers.
  2. Poll / honor the signal between restore, run(), and stream iterations.
  3. On cancel: stop scheduling new work, cancel in-flight run() awaits, and avoid emitting a successful terminal completion for abandoned work.

Environment

  • Package: agent-framework-foundry-hosting==1.0.0b260730
  • Related: azure-ai-agentserver-responses==1.0.0b9

Tracked downstream as CFX-10485.

Activity

  1. added
    workflowsUsage: [Issues, PRs], Target: Workflows
    and removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Aug 4, 2026
  2. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Aug 4, 2026
  3. github-actions commented on Aug 4, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    Repro: ResponsesHostServer._handle_response in python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py (line 548) accepts cancellation_signal: asyncio.Event but drops it at lines 560–561 when dispatching to _handle_inner_workflow (line 739) and _handle_inner_agent (line 563), neither of which has a cancellation_signal parameter. Minimal repro: run test_cancellation_signal_forwarded.py which uses AST inspection to confirm the parameter is absent from both inner handler signatures and call sites. Fix requires adding cancellation_signal to both inner methods' signatures, forwarding it from _handle_response, and polling/honoring it around run() calls and stream iterations in both handlers.

    • Failing test: python/packages/foundry_hosting/tests/test_cancellation_signal_forwarded.py
    • Files examined: python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py, python/packages/foundry_hosting/tests/test_responses.py, python/packages/foundry_hosting/pyproject.toml
    • Tests run: python/packages/foundry_hosting/tests/test_cancellation_signal_forwarded.py
    • Reported version: 1.0.0b260730
    • Current version: 1.0.0b260730
  4. TaoChenOSU commented on Aug 24, 2026

    @TaoChenOSU
    Contributor

    The Python path is addressed through #7670

  5. removed their assignment
    on Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowworkflowsUsage: [Issues, PRs], Target: Workflows

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions