GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(pi): stop marking recovered turns as failed by KyrosHendrix · Pull Request #24805 · pingdotgg/t3code

Conversation

@KyrosHendrix

@KyrosHendrix KyrosHendrix commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Pi can finish a native continuation successfully while T3 persists a failed run and reports an earlier "This operation was aborted" message. The adapter retained an intermediate assistant error unless Pi emitted a specific retry-recovery event.

Track the latest assistant message failure separately from terminal failures. A successful assistant response clears the stale message error without clearing rejected prompts or exhausted retries. Explicit cancellation remains interrupted.

This is submitted under the small, focused obvious-bug exception. It corrects existing turn-completion bookkeeping, with no new feature, setting, contract, or database migration. The diff contains only the Pi adapter and regression tests for this defect.

Reproduction and evidence

The new orchestration regression replays this sanitized sequence through provider stdio, the real adapter, orchestration, persistence, and projections:

assistant message_end: error, "This operation was aborted"
agent_end: willRetry=false
agent_start
assistant message_end: stop
agent_settled: aborted=false

Original adapter: persisted run status = failed
Fixed adapter: run, attempt, provider turn = completed
               session = ready, lastError = null, no error item

With only the production adapter restored to the original base, the regression failed with expected [ 'failed' ] to deeply equal [ 'completed' ]. The same test passes with the fix. Adapter regressions also failed before implementation for recovery with and without compaction and for replacing an old error with the latest error.

Verification

Refreshed against upstream a96cf0818eff. Environment: Windows, Node 24.20.0, Vite+ 1.3.0.

vp test run packages/provider-pi/src/server/adapter.test.ts apps/server/src/orchestration-v2/testkit/PiReplayFixtures.integration.test.ts -t 'PiAdapterV2|PiRpc|recovered Pi message error'
vp run --parallel --filter t3 --filter @t3tools/provider-pi typecheck
vp fmt --check packages/provider-pi/src/server/adapter.ts packages/provider-pi/src/server/adapter.test.ts apps/server/src/orchestration-v2/testkit/PiReplayFixtures.integration.test.ts
vp lint packages/provider-pi/src/server/adapter.ts packages/provider-pi/src/server/adapter.test.ts apps/server/src/orchestration-v2/testkit/PiReplayFixtures.integration.test.ts
git diff --check
  • 97 focused tests passed: all 96 adapter tests and the new persisted orchestration regression. Eight existing replay cases were deselected. Controls cover genuine errors, unfinished continuation, non-retrying compaction, exhausted retries, rejected prompts, and cancellation.
  • Both scoped typechecks, formatting, lint, and diff checks passed. Existing unused layer and Duration warnings remain.
  • Additional earlier QA passed all nine replay cases with a temporary POSIX context matching their recorded subprocess arguments. That override for the existing cases is not committed. The new regression supplies its recording's POSIX context directly.

vp run check:changed was attempted but did not finish within 120 seconds; it printed the three-file change header without a step summary. It is not claimed as passing. A wider Pi-package run also hit Windows subprocess-fixture failures, including two status/discovery failures independently reproduced with the original adapter. These unrelated failures are not changed here. No live model-provider or browser verification ran. The original native abort trigger is not established, and historical failed turns are not rewritten.

Implemented and verified with openai-codex/gpt-6.1-sol in pi.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@KyrosHendrix
fix(pi): stop marking recovered turns as failed
5d4c49e
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 25, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 5d4c49e

Macroscope's review found this PR approvable — This is a focused Pi adapter bug fix that separates transient message errors from terminal failures so recovered continuations persist as completed. It changes one production adapter and adds targeted unit and orchestration regression coverage without altering schemas, defaults, infrastructure, or static-analysis settings.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

macroscopeapp[bot]
macroscopeapp Bot approved these changes Oct 25, 2026
View reviewed changes
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Pi adapter now tracks assistant-message failures separately from other turn failures. Finalization considers these failures when determining terminal turn and compaction status. Tests cover successful recovery and cases where a message error remains the terminal failure.

Changes: Pi message failure recovery

Layer / File(s) Summary
Track and resolve message failures
packages/provider-pi/src/server/adapter.ts
The adapter records assistant-message errors separately, clears message failures after successful compaction retries and auto-retries, and considers them when determining terminal status.
Validate recovery and terminal status
packages/provider-pi/src/server/adapter.test.ts
Tests cover recovery after a message error and cases where that error, or a later retry error, remains the terminal failure.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to e77d6

This fix stops Pi turns that recovered after an intermediate error from being recorded as failed. Cancellation and unrecovered errors keep their existing behavior. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(pi): stop marking recovered turns as failed" follows conventional commit format and matches the main change. The adapter now clears a stale assistant message error after a successful re…
Description check Passed The description covers the problem, the change, the scope justification, and detailed verification. It follows the template's Problem, Change, Scope, and Verification sections. It states the bug, expl…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(pi): stop marking recovered turns as failed" follows conventional commit format and matches the main change. The adapter now clears a stale assistant message error after a successful response, so recovered turns no longer persist as failed. The title is short, specific, and states the primary bug fix from the developer's perspective.

Full details: Description check

Explanation

The description covers the problem, the change, the scope justification, and detailed verification. It follows the template's Problem, Change, Scope, and Verification sections. It states the bug, explains the fix at the adapter level, cites the small obvious-bug exception with a link, and lists focused test commands, results, and unverified areas. It also names the agent and model used, as the template requests. The Problem section is folded into the opening paragraph rather than under a separate heading, which is a minor deviation.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: main
  • File: .coderabbit.config.ts
  • Commit: d899bdd
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 17267137-9b3c-48a4-b196-13c5a18c72c5
Commits

Reviewing files that changed from the base of the PR and between 5d4c49e and e77d614.

Files selected for processing: 2

  • packages/provider-pi/src/server/adapter.test.ts
  • packages/provider-pi/src/server/adapter.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request Oct 30, 2026
fix(pi): hold messages until compaction ends #24388
Merged
@maria-rcks GitCafe Production

maria-rcks commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

verified as-is at 5d4c49e243e099faaede49a7981dc1bd06cfcc73. reproduced the bug first on github/main at 32ecd71726 in /home/user/main, then repeated it on the exact pr head. one dev server ran at a time, with isolated state. no source changes or pushes.

used repository playwright with /usr/bin/google-chrome. created the project and threads through the web app. codex gpt-6.1-sol completed a baseline turn on both revisions. the changed path used real pi 1.4.0 with cliproxyapi/gpt-6.1-sol through this vm's proxy using its chat-completions api.

reproduction: disable pi's automatic retries, start a long response, click "steer message" with Reply exactly RECOVERY_OK. Do not use tools or change files., then disconnect only pi's active tcp socket with sudo -n ss -K dst 127.0.0.1 dport = 28317 sport = <pi-client-port>. this induces a real connection failure without replacing the provider, injecting events, or using replay data. both native pi sessions recorded stopReason=error with Connection error., followed by stopReason=stop with RECOVERY_OK.

read-only sqlite inspection after the ui completed:

                         main                 pr head
assistant response       RECOVERY_OK          RECOVERY_OK
run / attempt / turn     failed               completed
provider session         error                ready
lastError                Connection error.    null
persisted error items    1                    0

neighboring checks on the pr: disconnecting pi without a steer still failed; "stop generation" persisted interrupted; another message after stop completed with AFTER_STOP_OK. reloading preserved the recovered response and clean state.

blacksmith vp run check:changed a96cf0818eff4a113c3ff52ae702683e51a5803b passed format, lint, knip, graphql, five affected typechecks, and all 105 tests in the two affected test files. the explicit base was needed because the worker starts with shallow history. two existing unused-variable lint warnings remain.

screenshots use matching prompts and response data. the recording shows the steer and successful continuation; loading screens were removed. uploaded images, video playback, and seeking were checked in chrome.

main: successful continuation incorrectly persists a connection failure

pr head: the same continuation completes without a stale error

pi steer and successful recovery in the running pr app

Not verified

  • the original "This operation was aborted" trigger was not reproduced. the live reproduction exercised the same stale-message-error bookkeeping with a controlled connection failure.
  • pi's responses api could not complete through this proxy, returning empty-response errors; live pi verification used chat completions.
  • native ios/android, electron, macos/windows, remote relay/tunnel, and live compaction/exhausted-retry recovery were not exercised on this linux vm. focused existing tests cover the latter terminal semantics.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@KyrosHendrix

KyrosHendrix commented Nov 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Following up on this fix. I am still encountering the reported bug. Could a maintainer take another look?

A fresh source review against main at 7e565c510d6dfaef2e1fd97bf9d89a97ce9cece7 confirms that the stale-error path is still present: an assistant message_end with stopReason: error sets turn.failure, and a later successful assistant message does not clear it. Without an explicit successful retry or retrying compaction event, finalization still marks the recovered turn failed.

Re-reviewed PR head 5d4c49e243e099faaede49a7981dc1bd06cfcc73 and found no new correctness issues. The patch clears recovered assistant-message failures while retaining terminal failures and cancellation semantics.

Fresh verification on the unchanged PR head:

  • PASS: pnpm exec vp test run packages/provider-pi/src/server/adapter.test.ts apps/server/src/orchestration-v2/testkit/PiReplayFixtures.integration.test.ts -t 'PiAdapterV2|PiRpc|recovered Pi message error', exit 0. Both test files passed, 97 tests passed and 8 were skipped by the name filter.
  • PASS: git diff --check, exit 0.

This follow-up includes source review and focused tests, not a new live-provider or UI reproduction. The earlier live verification in #24805 (comment) remains relevant.

@juliusmarminge, since you've worked on Pi's compaction and steering behavior, could you take a look when you have time?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 14, 2026
juliusmarminge and others added 2 commits November 14, 2026 07:23
@juliusmarminge @claude
Merge origin/main into fix/pi-stale-message-failure
911c839
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge @claude
test(pi): keep the adapter-level cases for recovered message errors
e77d614
Drop the replay-fixture case that repeated the adapter test one layer up,
and the table rows that a sibling row or unchanged code already covers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge

juliusmarminge commented Nov 14, 2026

Copy link
Copy Markdown
Member

The automated pipeline ran the reported steps in the real app without this change, and the problem did not appear. So it cannot show that this change fixes anything.

What was run on d899bddfa2, the commit before this change:

Added Pi through Settings > Providers and created synthetic project/thread data through T3's CLI. Sent the exact lighthouse-story prompt. During streaming, typed the exact RECOVERY_OK prompt and clicked Steer message; about one second later, used sudo ss -K on only that Pi process's established model-server socket. Left Pi running, waited for completion, reloaded, and inspected persisted state and native Pi history. Repeated on both commits, including a second base run around the requested streaming interval. Both sides recorded terminated: read ECONNABORTED followed by successful recovery. Both emitted a successful native retry, completed the run, attempt and provider turn, and left the session ready with no lastError. Recovered responses ended with RECOVERY_OK; the comparison runs also included story prose.

How: Manual real-web-app comparison in separate checkouts with fresh isolated databases, Pi v1.5.2 and Claude Haiku 5.5. Chromium preview browser, light theme, 1280×800 viewport. Captures identically cropped to exclude environment identifiers. Both servers and checkouts cleaned up.

Closing this pull request. If you can share the exact steps, what you see, and the version and platform you are on, it can be reopened.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge closed this Nov 14, 2026
@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:in-progress A takeover lead is working on this PR labels Nov 14, 2026
@KyrosHendrix

KyrosHendrix commented Nov 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@juliusmarminge thanks for running it. (Edited: I first posted repro steps that don't work on current Pi. This version replaces them.)

I found where my failed turns came from, and current Pi already fixes it, so your 1.5.2 runs were right.

What happened: I use the killeros Pi extension. Its auto-compaction calls ctx.compact() in the middle of a turn, Pi aborts the running request, and then the extension continues with pi.sendMessage(..., { triggerTurn: true }). Before I updated to Pi 1.5.2 on Nov 10, Pi recorded that abort as an error:

assistant  stopReason=error  errorMessage="This operation was aborted"  (empty content, 0 tokens)
compaction tokensBefore=251140
custom_message "Continue the interrupted task from the compacted context."
assistant  stopReason=stop   (the full answer)

No retry event follows, so T3 kept the error and saved the turn as failed. In a read-only copy of my T3 database, two threads show this:

Pi reply finished (stopReason=stop) T3 run attempt saved as failed
2026-11-06 14:19:25.474Z 2026-11-06 14:19:25.498Z
2026-10-18 14:13:57.201Z 2026-10-18 14:13:57.272Z

On Pi 1.5.2 this no longer happens. I ran it live with killeros. Pi now ends the interrupted request with stopReason: "aborted" and agent_settled { aborted: true }. Replaying that recorded sequence through the adapter from just before this PR's fix completes the turn. The older "error" shape fails before this PR and completes with it. Pi 1.5.1 lists "Fixed cancellation during lazy provider loading or authentication being reported as an error instead of an abort" (#8635). That matches my logs, but I haven't confirmed it's that exact change.

Environment: Windows 11, T3 Code desktop nightly, openai-codex/gpt-6.1-sol. The failures happened on the Pi version I had before 1.5.2.

What's left: a real stopReason: "error" that Pi recovers from without a retry event, which is what Maria triggered with automatic retries off and the connection cut. I haven't rerun that on 1.5.2. If that isn't worth guarding against, leaving this closed is fine with me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@KyrosHendrix

KyrosHendrix commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Following up on your request for an exact reproduction. I reproduced this twice on T3 Code main at 06f513d50fe926a04b77a0b4d76f613adb32b717, using Pi 1.6.0 on Windows 11. Could you reopen #24805 for this case? Closure comment

How to reproduce

  1. Run the loopback model fixture below with node pi-recovery-endpoint.mjs. Configure the T3 Pi provider to use the isolated Pi home described below and select its default model. Pi automatic retries must be disabled.
  2. Start a reply in T3. The fixture streams First response is streaming. and holds the connection open. Send Reply exactly RECOVERY_OK. with Steer message.
  3. Once Pi acknowledges the steer, run curl -fsS -X POST http://127.0.0.1:18765/drop (curl.exe in PowerShell). In my verifier this request fired on Pi's successful RPC reply to the steered prompt. The fixture resets only the first model socket and returns RECOVERY_OK on the next request.
  4. Let the thread settle. The expected result is a saved reply, a completed run, and a ready session.

What I observed

Both live runs sent the steer through T3's chat WebSocket. I captured native Pi events and checked T3's thread timeline and SQLite after settlement.

Pi message_end       error | terminated: other side closed (UND_ERR_SOCKET)
Pi message_end       stop  | RECOVERY_OK
Pi agent_settled     aborted=false, 0 automatic retry events
T3 timeline          RECOVERY_OK plus one Provider error item
T3 SQLite            run=failed, attempt=failed, provider turn=failed
T3 SQLite            session=error, lastError=terminated: other side closed (UND_ERR_SOCKET)

The uninterrupted control saved BASELINE_OK, completed the run, and returned the session to ready with zero error items. This reproduces the recovery with automatic retries disabled that Maria reported. Maria's reproduction

Runnable loopback fixture and Pi settings

Save this as pi-recovery-endpoint.mjs. Start a fresh fixture process for each run. Pass --baseline for the uninterrupted control.

import { createServer } from "node:http";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";

export function createFixture(getRun) {
  return createServer(async (req, res) => {
    const run = getRun();
    if (req.method === "POST" && req.url === "/drop") {
      if (!run?.socket || run.socket.destroyed) return res.writeHead(409).end();
      run.steerAck = true;
      run.socket.destroy();
      return res.writeHead(204).end();
    }
    if (req.method !== "POST" || req.url !== "/v1/chat/completions" || !run) {
      return res.writeHead(404).end();
    }

    let body = "";
    for await (const part of req) body += part;
    const number = ++run.requests;
    if (number > 1) run.steerInSecondRequest = body.includes("RECOVERY_OK");
    res.writeHead(200, { "Content-Type": "text/event-stream" });
    const chunk = (delta, finish_reason) => "data: " + JSON.stringify({
      id: "chatcmpl-proof-" + number, object: "chat.completion.chunk", created: 1,
      model: "proof", choices: [{ index: 0, delta, finish_reason }],
    }) + "\n\n";

    if (run.cut && number === 1) {
      run.socket = res.socket;
      res.write(chunk({ role: "assistant", content: "First response is streaming. " }, null));
      run.firstStreaming?.resolve(true);
      return;
    }

    const content = run.cut ? "RECOVERY_OK" : "BASELINE_OK";
    res.write(chunk({ role: "assistant", content }, null));
    res.end(chunk({}, "stop") + "data: [DONE]\n\n");
  });
}

if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
  const run = { cut: !process.argv.includes("--baseline"), requests: 0 };
  createFixture(() => run).listen(18765, "127.0.0.1", () => {
    console.log("Model base URL http://127.0.0.1:18765/v1");
  });
}

Point the Pi process launched by T3 at an isolated PI_CODING_AGENT_DIR containing these two files. The API key is a dummy value for the loopback fixture.

models.json

{
  "providers": {
    "recoveryproof": {
      "baseUrl": "http://127.0.0.1:18765/v1",
      "apiKey": "local-fixture",
      "api": "openai-completions",
      "models": [
        {
          "id": "proof",
          "name": "Recovery proof",
          "contextWindow": 16000,
          "maxTokens": 1000
        }
      ]
    }
  }
}

settings.json

{
  "defaultProvider": "recoveryproof",
  "defaultModel": "proof",
  "retry": {
    "enabled": false
  }
}
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:S 10-29 changed lines (additions + deletions). takeover:blocked Takeover blocked; reason in the PR body vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@KyrosHendrix @maria-rcks @juliusmarminge
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.