Skip to content

Codex SDK: Add abort() / cancel() method to stop active thread.run(...) calls #5494

@OhadAssulin

Description

@OhadAssulin

What feature would you like to see?

Currently, the Codex TypeScript SDK (sdk/typescript/src/thread.ts) does not provide a way to cancel or abort an active thread.run(...) operation once it has started. This creates issues in scenarios where the run may take longer than expected, hang, or needs to be stopped due to changing user input or application logic.

A native abort() or cancel() method would allow developers to gracefully stop ongoing runs, improving both control and UX for interactive applications.

Desired Behavior

Provide an API method to terminate a running operation. For example:

const thread = codex.startThread();
const run = thread.run("Generate code...");

// later:
thread.abort(); // or run.abort()

This should:
• Stop the underlying Codex process / stream
• Reject the pending promise

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsdkIssues related to the Codex SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions