Skip to content

fix(server): settle aborted provider turns - #6018

Closed
cheruvian wants to merge 1 commit into
pingdotgg:mainfrom
cheruvian:release/fix-aborted-session-lifecycle
Closed

fix(server): settle aborted provider turns#6018
cheruvian wants to merge 1 commit into
pingdotgg:mainfrom
cheruvian:release/fix-aborted-session-lifecycle

Conversation

@cheruvian

@cheruvian cheruvian commented Aug 10, 2026

Copy link
Copy Markdown

What Changed

Canonical turn.aborted events now persist an interrupted lifecycle through the orchestration event stream. A matching active turn becomes interrupted, its activeTurnId is cleared, and its plan progress settles so clients stop showing active work.

Aborts apply only when they identify the currently active turn. Unscoped, stale, duplicate, replayed, and post-terminal aborts are lifecycle no-ops. Later provider state, completion, or exit events remain deterministic, while approval and user-input requests keep their existing pending semantics. Coverage exercises OpenCode's canonical abort path alongside Codex's native interrupted completion and compatibility abort mapping.

The production change is 22 lines; the rest of the diff is focused adapter, ordering, idempotency, and projection-rebuild coverage.

Why

Provider runtime ingestion previously cleared only in-memory plan progress for turn.aborted; it did not persist a terminal orchestration lifecycle transition. That could leave the durable session projection at running and clients showing “Working” after the provider had stopped.

interrupted preserves the distinction between an aborted turn, successful completion, and failure. The fix stays event-sourced and ingestion-only: it does not write projection tables directly, alter provider behavior, restructure status models, or add shutdown/startup reconciliation.

Testing

  • vp test run for the four touched server suites: 144 tests passed
  • vp run --filter t3 typecheck
  • Targeted vp lint --report-unused-disable-directives
  • Targeted vp fmt --check
  • git diff --check

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • UI screenshots are not applicable
  • Animation or interaction video is not applicable

Prepared with GPT-5.6 Sol using the Codex harness in T3 Code.


Note

Medium Risk
Changes core thread/session lifecycle ingestion and ordering rules for aborts; mistakes could leave threads stuck “running” or flip state incorrectly, though scope is narrow and heavily tested.

Overview
Provider runtime ingestion now treats canonical turn.aborted like other lifecycle events: matching aborts set session status to interrupted, clear activeTurnId, and settle plan progress. Aborts apply only when the event’s turn id matches the thread’s active turn, so unscoped, stale, duplicate, and post-terminal aborts are no-ops.

Codex and OpenCode adapters gain tests (and implied mapping) for interrupted completions, raw turn/aborted, failed sendTurn, and interrupt flows so ingestion receives consistent abort events.

Tests add projection-pipeline rebuild parity for interrupted sessions with pending approvals/user input, plus ingestion scenarios for provider ordering, idempotency, later session/turn events, and pending requests while a waiting turn aborts.

Reviewed by Cursor Bugbot for commit 7c52a7c. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix aborted provider turns to correctly settle session state as interrupted

  • ProviderRuntimeIngestion now handles turn.aborted events by setting session status to interrupted, clearing activeTurnId, marking the latest turn as interrupted, and clearing plan progress — but only when the abort matches the currently active turn.
  • Stale, duplicate, unscoped, and post-terminal aborts are ignored and no longer mutate lifecycle state or plan progress.
  • CodexAdapter maps turn/completed with provider status interrupted to a canonical turn.completed with state interrupted, and maps turn/aborted to a canonical turn.aborted with the reason propagated.
  • OpenCodeAdapter emits turn.started then turn.aborted on send failure, and invokes the runtime abort endpoint when a turn is interrupted.
  • Behavioral Change: previously aborted turns did not settle session state; sessions will now transition to interrupted status on abort.

Macroscope summarized 7c52a7c.

Persist matching canonical aborts as interrupted session lifecycle events so clients stop showing active work. Keep duplicate, stale, replayed, and later terminal provider events deterministic across Codex and OpenCode.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 321199a2-30b2-4012-8c68-85f5a1eb5b25

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 10, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This bug fix adds handling for aborted provider turns in the orchestration layer. While the production changes are small and follow existing patterns, they affect core session/turn lifecycle state management. Combined with the author being new to this file, human review is recommended to validate the state transition logic.

You can customize Macroscope's approvability policy. Learn more.

@t3dotgg

t3dotgg commented Sep 4, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-6 Astra (preview) responding on behalf of Theo

This was closed as part of an automated cleanup pass. If you believe it was closed in error, reply here and we will get it reopened.

Closing in favor of #8859. Both patches settle the exact active aborted turn, but the retained patch also finalizes buffered assistant text and proposed plans when abort is the last event. Review continues there. The event-ordering and projection-rebuild cases from this branch are recorded on the retained PR.

@t3dotgg t3dotgg closed this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants