Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): settle error session exits #7854

Closedlukdz(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7854/headopened View on GitHub

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](https://cursor.com/bugbot) for commit ccdecf16800025f3456f72e0fa3639bf2bf89264. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

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.
    1. 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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at ccdecf1

      Macroscope's review found this PR approvable — This is a narrow server-side bug fix that distinguishes error-classified provider exits from graceful stops and settles affected turns consistently with existing error handling. The production change is localized and covered by a focused regression test, with no product-default or static-analysis configuration impact.

      Notes:

      • Diff unchanged. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge added labelsmacroscope-review

    5. Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition.

      This change touches ProviderRuntimeIngestion.ts, which the V2 merge removed. V2 ingests typed provider events into run and turn-item projections.

      Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved.

    6. juliusmarminge closed this

Sign in to join this conversation.