Skip to content

Move abort operation from ISession to ITurn#9

Merged
mikea merged 1 commit into
masterfrom
codex/move-abort-signal-to-turn
Mar 29, 2026
Merged

Move abort operation from ISession to ITurn#9
mikea merged 1 commit into
masterfrom
codex/move-abort-signal-to-turn

Conversation

@mikea

@mikea mikea commented Mar 29, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Cancellation should be turn-scoped rather than session-scoped so callers can only abort the active turn (ITurn) instead of the whole session (ISession).
  • Keep the public API spec and implementation in sync by moving the abort capability to the turn object and updating dependent code and docs.

Description

  • Added abort(): Promise<void> to ITurn and removed abort() from ISession in the public API (packages/api/src/index.ts and specs/api.md).
  • Updated AgentSessionDO to construct TurnImpl with an abort delegate (#abortCurrentTurn) and removed the session-level forwarder for abort() in SessionTarget (packages/core/src/agent-session-do.ts).
  • Exposed TurnImpl.abort() which invokes the DO's abort delegate to cancel the active turn stream.
  • Updated gateway and CLI usage: web UI now resolves session.getCurrentTurn() and calls turn?.abort(); Telegram /abort and gateway examples in specs/gateway.md and specs/telegram_gateway.md were updated to call getCurrentTurn()?.abort().
  • Updated test mocks and test code to match the new API shape (web mock ITurn includes abort(), core mocks removed ISession.abort() no-op, and in-DO tests now call getCurrentTurn()?.abort() where appropriate).

Testing

  • Ran unit tests for core with pnpm -C packages/core test, all tests passed (314 tests passed).
  • Ran web gateway tests with pnpm -C gateways/web test, all tests passed (3 tests passed).

Codex Task

@mikea mikea merged commit 9375476 into master Mar 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant