Skip to content

fix(server): settle error session exits - #7854

Open
lukdz wants to merge 1 commit into
pingdotgg:mainfrom
lukdz:fix/server/settle-error-session-exits
Open

fix(server): settle error session exits#7854
lukdz wants to merge 1 commit into
pingdotgg:mainfrom
lukdz:fix/server/settle-error-session-exits

Conversation

@lukdz

@lukdz lukdz commented Aug 21, 2026

Copy link
Copy Markdown

Problem

An abruptly terminated provider process can emit a typed session.exited event with exitKind error without a separate runtime.error. The ingestion path treated every session exit as a normal stop, leaving an active turn without an error state.

Fix

Treat error-classified session exits as an error lifecycle transition, clear the active turn, and preserve the provider exit reason as lastError. Graceful exits remain stopped.

Added a focused regression test covering an active turn followed by an error session exit without runtime.error.

Verification

  • git diff --check passed.
  • Focused test, typecheck, and lint commands were attempted but could not run because the checkout had no complete vp installation. Dependency bootstrap exceeded the available timeout.

Model: GPT-5.6 Luna
Harness: OpenCode


Note

Medium Risk
Touches provider session lifecycle projection, so a misclassified exit could leave threads in error vs stopped incorrectly. Scope is small and covered by a focused test.

Overview
Treats unexpected provider process exits as a real session error, not a graceful stop.

When session.exited arrives with exitKind: "error" (even without a separate runtime.error), ingestion now sets session status to error, clears the active turn, and stores the provider exit reason as lastError. Normal exits still map to stopped.

Adds a regression test for an in-flight turn followed by an error-classified session exit.

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

Note

Set session status to 'error' on unexpected session.exited events in ProviderRuntimeIngestion

When a session.exited event arrives with exitKind='error', the ingestion layer now sets the thread session status to 'error', clears activeTurnId to null, and records lastError from the payload reason (or a default message). Non-error exits continue to set status to 'stopped'. Adds a test verifying this transition.

  • Risk: the dispatched thread.session.set command now uses lifecycleStatus instead of the previously computed status; any downstream consumers expecting 'stopped' for error exits will see 'error' instead.

Macroscope summarized ccdecf1.

@coderabbitai

coderabbitai Bot commented Aug 21, 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: f280849c-bc2a-4e77-94b8-c85df53153d8

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 21, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at ccdecf1

Macroscope's review found this PR approvable — Straightforward bug fix that correctly handles error session exits by setting status to 'error' instead of 'stopped' and preserving the error message. The change is self-contained with a corresponding test case validating the fix.

You can add or adjust custom eligibility rules. Learn more.

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.

1 participant