Skip to content

feat: add interrupt support for active run lifecycle management#3588

Open
Oxygen56 wants to merge 1 commit into
openai:mainfrom
Oxygen56:feat/run-interrupt-798
Open

feat: add interrupt support for active run lifecycle management#3588
Oxygen56 wants to merge 1 commit into
openai:mainfrom
Oxygen56:feat/run-interrupt-798

Conversation

@Oxygen56
Copy link
Copy Markdown

@Oxygen56 Oxygen56 commented Jun 5, 2026

Adds interrupt signal to RunConfig for graceful run interruption.

Closes #798

Adds RunInterruptSignal class that allows external code to request
graceful interruption of the agent loop. The agent finishes the
current turn and returns partial results.

Changes:
- Add RunInterruptSignal class with interrupt() method, is_interrupted
  property, and clear() for reuse
- Add interrupt_signal field to RunConfig for configuring the signal
- Add interrupted boolean flag to RunResult and RunResultStreaming
- Check interrupt signal at top of main loop in AgentRunner.run()
- Return partial result with interrupted=True when signaled
- Check interrupt signal in streaming loop and set interrupted flag
- Export RunInterruptSignal from the public API

Closes openai#798

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 859746c518

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/run_config.py
agent. The model_provider passed in below must be able to resolve this model name.
"""

interrupt_signal: RunInterruptSignal | None = None
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Append interrupt_signal to preserve RunConfig positional calls

Because RunConfig is an exported dataclass, inserting this field before model_provider changes the meaning of existing positional calls such as RunConfig("gpt-4.1", my_provider): the provider is now stored in interrupt_signal, leaving the default provider in use and causing the new loop check to access my_provider.is_interrupted. This violates the repo's public API positional-compatibility rule and silently breaks released callers; add the new optional field after the existing fields or provide a compatibility layer.

Useful? React with 👍 / 👎.

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.

Feature Request: Enhanced Run Lifecycle Management - Interrupt and Update Active Runs

1 participant