Skip to content

Add a run-scoped stop after the current tool call completes #47045

Not planned

Description

@xtaoopsorca

A local watchdog can detect that an AI provider is approaching a usage or billing limit. It needs to let a tool that is already running finish, then stop the turn before the provider can start another model request or tool call. An immediate interrupt can cut a write operation in half. Waiting for the full turn can allow more requests. Polling the activity log and interrupting leaves a race between tool completion and the next request.

Could T3 expose a run-scoped drain operation through the orchestrator or CLI? It would:

  • Take an expected run ID and an idempotency key. Reject stale requests without affecting a replacement run.
  • Let in-flight foreground tools finish and record their results, then prevent the next model request or tool dispatch. Return an explicit unsupported result for provider adapters that cannot enforce the boundary.
  • Expose whether the drain is pending or terminal, so a client can select another provider and resume the same thread safely.

A test could request a drain while the first of two synthetic tool calls is in flight, then assert the first result is recorded and the second call never starts. A stale-run case should confirm a replacement run remains untouched.

Related: #26844

Activity

  1. juliusmarminge commented on Dec 1, 2026

    @juliusmarminge
    Member

    Thanks for writing this up. It asks for new behaviour rather than reporting a defect, so it does not belong in the bug tracker and I'm closing it as not planned here. Feature ideas are discussed in Discussions: please post it there.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions