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): retry T3 tool discovery with a fresh session by StiensWout · Pull Request #42612 · pingdotgg/t3code

Conversation

@StiensWout

@StiensWout StiensWout commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

A temporary tool discovery failure at startup could leave Pi without T3 tools until the session was reloaded. Pi now attempts to close the previous MCP session with an authenticated request and a separate one-second timeout, then gives the fresh handshake and discovery their full ten-second deadline. After discovery, Pi reconciles the active tool loadout so recovered tools are ready to use.

Related: #37521, #37839, #36336, #30996

Reproduction on main

Commit 4e6b1fa771 (main). Pi’s startup retry is rejected, leaving it without the T3 tools for that session. Expected: Pi retries tool discovery and can use the T3 tool to list available providers.

The cause is at packages/provider-pi/src/server/mcpExtensionSource.ts:196. Ran cd packages/provider-pi && pnpm exec vp test run src/server/mcpExtensionSource.test.ts with the repro test added: it failed in 2 of 2 runs on a clean checkout, with expected undefined to deeply equal [ { type: 'text', …(1) } ] in the output.

Evidence

Environment: Linux x64, the repository's own tests.

Proven: the repro fails at the test commit 366ca22204 and passes on the head 9d85035db7, both on main 6632511cd8.

Before After
Commit 366ca22204 9d85035db7
Result failed with "expected undefined to deeply equal [ { type: 'text', …(1) } ]" passed

Outside view: not shown in the running app. The bug fails the rule that every step is the person's or the world's and that the app gets there by itself. The stuck session only exists after a stand-in fetch returns one error for the tool list once initialize has kept a session id, then rejects the retry initialize because that id is still sent; opening a Pi thread does not make T3's own tool list fail and recover between those two calls, and the startup warning is dropped while no turn is active.

Tests

  • 366ca22204 adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed 6632511cd8f523c2b9439272d776fb44c2bce110 passed on head.

Not in this change

  • The retry count and startup warning behavior are outside the scope of this change.
  • The regression tests exercise Pi against a simulated HTTP transport and verify the bearer token on the cleanup request. Live client behavior was outside the test scope.

Who did the work

  • Repro written by GPT 6.2 Sol, in Codex
  • Outside view by Grok 4.7, in Grok
  • Duplicate check judged by Claude Opus 5.5, in Claude Code
  • Written by GPT 6.2 Sol, in Codex
  • Trimmed by Claude Opus 5.5, in Claude Code
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex, and by Gemini 4 Neon, in Antigravity
  • Reproduction, checks and proof run by a program on base and head, not by an agent

Made in T3 Code by GPT 6.2 Sol, Claude Opus 5.5, Grok 4.7 and Gemini 4 Neon

Sorry, something went wrong.

Uh oh!

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

All reactions
StiensWout and others added 6 commits November 25, 2026 05:15
@StiensWout @codex
test(pi): cover tool discovery retry after a startup error
366ca22
Co-authored-by: GPT 6.2 Sol <[email protected]>
@StiensWout @codex
fix(pi): retry T3 tool discovery with a fresh session
4cc0889
Co-authored-by: GPT 6.2 Sol <[email protected]>
@StiensWout @codex
fix(pi): release failed startup sessions and reconcile retried tools
a150aa0
Co-authored-by: GPT 6.2 Sol <[email protected]>
@StiensWout @claude
refactor(pi): drop unreachable signal-less branch from MCP connect
5dbf175
connect is only called with ensureStarted's timeout signal.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@StiensWout @claude
test(pi): drop redundant DELETE guards from the bridge testkit
c8dd469
The recorded session ID already proves which session was released.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@StiensWout @codex
fix(pi): give tool discovery its full retry deadline
9d85035
Co-authored-by: GPT 6.2 Sol <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 25, 2026
@coderabbitai

coderabbitai Bot commented Nov 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 MCP client closes an existing session before connecting. The session-start handler now completes startup and reports connection errors before reconciling discovery. The test bridge and extension tests cover startup discovery failures and session termination outcomes.

Changes: MCP Session Startup Recovery

Layer / File(s) Summary
Session lifecycle and startup ordering
packages/provider-pi/src/server/mcpExtensionSource.ts
The client sends a best-effort DELETE for an existing session and clears its session ID. Startup closes the previous session before connecting. The session-start handler reports startup errors before reconciling discovery.
Startup retry test coverage
packages/provider-pi/src/server/mcpBridge.testkit.ts, packages/provider-pi/src/server/mcpExtensionSource.test.ts
The test bridge simulates session initialization, discovery failures, and DELETE responses or network errors. Tests check the termination attempt, active tools, and preview-snapshot result.

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

Change: Bug fix

Suggested labels: bugfix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to d7ac3

This change closes a stale MCP session before retrying startup, so tool discovery recovers after a failed first attempt. The new regression tests cover both a successful and an offline session close. No concrete merge-blocking risk remains. Live client behavior is not tested, but the change is small and easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix (retrying T3 tool discovery with a fresh session) and the affected package (pi). The raw summary shows the change closes the previous MCP session before startup discovery and r…
Description check Passed The description covers the problem (startup tool discovery failure leaving Pi without T3 tools), the change (closing the previous session, separate timeout, reconciliation after discovery), reproducti…
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 names the fix (retrying T3 tool discovery with a fresh session) and the affected package (pi). The raw summary shows the change closes the previous MCP session before startup discovery and reconciles tools on session start, so the title matches the main change. It is specific and follows conventional commit format.

Full details: Description check

Explanation

The description covers the problem (startup tool discovery failure leaving Pi without T3 tools), the change (closing the previous session, separate timeout, reconciliation after discovery), reproduction steps and environment, verification (failing test before the fix, passing on head, check:changed run), and scope notes. It also lists related issues and the authors. It does not follow the template strictly: the Scope section does not clearly say why no issue is linked beyond the 'Related' issue list, and the Verification section includes a claim about an 'Outside view' that is hard to verify and uses non-standard prose. The description is mostly complete, so the check passes, but the Scope section should state explicitly that the change is a bug fix and link the issue that shows the bug.

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: fbd939e
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0e340ed9-26cc-4521-8e27-b4e94c939dfb
Commits

Reviewing files that changed from the base of the PR and between 9d85035 and d7ac350.

Files selected for processing: 2

  • packages/provider-pi/src/server/mcpBridge.testkit.ts
  • packages/provider-pi/src/server/mcpExtensionSource.test.ts

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

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 25, 2026
juliusmarminge and others added 2 commits November 25, 2026 04:44
@juliusmarminge
Merge remote-tracking branch 'origin/main' into wf/find-ff8a96b9e7a48…
50e1a61
…9afd179a438
@juliusmarminge @claude
test(pi): keep one startup-retry regression test beside the bridge tests
d7ac350
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge

juliusmarminge commented Nov 25, 2026

Copy link
Copy Markdown
Member

Evidence

Evidence from Linux Chromium, Pi 1.6.0 / Claude Haiku 5.5, fresh databases, identical light theme and viewport. A fault proxy held the first tools/list beyond the 10-second discovery deadline, then forwarded subsequent traffic to the real T3 MCP endpoint. Asked for orchestrator_capabilities, then asked again in the same thread after recovery.

Before After
fbd939eb4c d7ac350730
Before: no T3 tools after discovery timeout After: capabilities call succeeds after recovery
Before: same-thread follow-up still fails After: same-thread follow-up succeeds
Before recording After recording
Protocol trace: retry carries session-1; real endpoint rejects initialize with HTTP 400. Protocol trace: DELETE returns 204; initialize without session header and tools/list return 200; both capabilities calls succeed.

Fault-injection driver · Reproduction instructions. Captures crop out the environment details panel while retaining the chat and composer.

Not shown:

  • The failed/offline DELETE fallback was not exercised; the real endpoint returned 204.
  • Used a deterministic tools/list timeout instead of literal SIGSTOP/SIGCONT of the server. The real Pi bridge, retry, session validation, discovery, and tool execution were exercised.
All reactions

Sorry, something went wrong.

Uh oh!

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

@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 25, 2026

This branch has not been deployed

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

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

size:M 30-99 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:trusted Author is trusted by repo permissions or 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.

2 participants

@StiensWout @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.