Skip to content

Think: allow rejecting an execution without auto-continuing the agent #1968

Description

@BradenHartsell

Problem

Think.rejectExecution(executionId, reason?) currently applies the rejected outcome to the transcript and automatically starts another model turn. This is useful when rejection means "do not perform this particular action, but keep working."

Some approval interfaces also need a second semantic: "the user rejected this action and wants the agent run to pause until they provide a new instruction." In that case, automatically continuing can cause the model to propose alternatives or keep working after the user intended to stop.

These are both valid behaviors, but rejectExecution() currently does not let the caller distinguish them.

Current behavior

This appears intentional. The current implementation routes both durable-pause actions and Codemode executions through _applyExecutionOutcome(), which updates the transcript and triggers auto-continuation so the model can adapt to the rejection.

PR #1656 describes this model-mediated rejection behavior. There is also precedent in the AIChat approval flow for distinguishing ordinary rejection that continues from a deliberately supplied error result that does not auto-continue, as discussed in PR #967.

Suggested API direction

Would the maintainers be open to an optional continuation policy, for example:

await agent.rejectExecution(executionId, reason, {
  autoContinue: false
});

The default could remain true for backward compatibility. With false, Think would still durably reject the pending execution, preserve the rejection outcome, and prevent the rejected action from executing, but it would not start another model turn. A later user message could resume the conversation normally.

The exact API shape is open for discussion. A separate method or a more general resolution policy may fit the project better. Ideally, the behavior would be consistent for both durable-pause actions and Codemode executions.

Expected semantics

  • Existing callers retain the current auto-continuation behavior by default.
  • autoContinue: false never executes the rejected action.
  • The rejection remains durable and idempotent.
  • No new model turn begins solely because of that rejection.
  • A subsequent user message can continue the conversation normally.

This issue was researched and drafted with AI assistance. The referenced documentation and implementation were checked against the current repository before submission.

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