Skip to content
Source
Sign inSign up
pingdotgg/t3code

Bscholar/pi rpc #2812

Closedbscholar-tt(GitHub profile, opens in a new tab)wants to merge 38 commits intomain fromrefs/pull/2812/headopened View on GitHub

What Changed

Why

UI Changes

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

High Risk Large new provider adapter and release-pipeline changes affect core agent execution and how CLI/desktop are shipped; remote install now depends on GitHub release assets.

Overview Adds a first-class Pi Agent provider that runs the pi CLI in RPC mode and maps its JSONL events (turns, tools, streaming text, extension UI prompts) into T3’s provider runtime, plus settings/UI wiring and structured text-generation via Pi.

Fork-oriented release and distribution: CI/release runners move to GitHub-hosted images; the release workflow is trimmed to manual stable releases (no tag push, nightly cron, npm publish, Vercel deploy, Discord, or Windows/signing paths). Releases build macOS/Linux desktop artifacts and attach a t3 CLI .tgz from a new cli pack command instead of publishing to npm. Desktop remote SSH installs t3 from GitHub Release tarball URLs when repository.url points at the fork.

Product defaults and branding: Stage label Alpha → Bscholar across desktop/web; default auto-bootstrap and text-generation provider shift from Codex to Claude. Telemetry defaults to off. Composer/model UI keys trait options by provider instance id and limits the model picker sidebar to ready instances.

Some server tests around OTLP proxying and live CLI-over-running-server are removed or narrowed.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 967842729ad78d5a9ac5a8a1cbf660fbf7e1f319. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add Pi Agent provider with RPC adapter, text generation, and settings integration

  • Introduces the piAgent provider driver (PiDriver.ts, PiAdapter.ts) that manages Pi Agent sessions, turns, and UI interactions via the @earendil-works/pi-coding-agent package.
  • Adds PiTextGeneration (PiTextGeneration.ts) that spawns the Pi CLI with a 180s timeout, collects JSON output, and validates it against a schema.
  • Registers piAgent in contracts (model.ts, settings.ts), provider registry, and UI metadata, with default models claude-sonnet-4-6 and claude-haiku-4-5.
  • Switches auto-bootstrap and default text generation from Codex to Claude (claudeAgent/claude-haiku-4-5).
  • Renames the app stage label from Alpha to Bscholar across desktop, web, and contracts.
  • Overhauls the release workflow to require manual dispatch, drop nightly/Windows/macOS-x64 paths, and publish CLI tarballs via GitHub Releases.
  • Risk: default provider change from Codex to Claude affects all fresh installs and auto-bootstrapped configurations.
📊 Macroscope summarized 9678427. 35 files reviewed, 6 issues evaluated, 0 issues filtered, 5 comments posted

🗂️ Filtered Issues

    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

      Run ID: 89cb2b1f-0e52-4dfd-83c3-6ac95848c5d1

      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
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

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

    3. Cursor Bugbot has reviewed your changes and found 7 potential issues.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 967842729ad78d5a9ac5a8a1cbf660fbf7e1f319. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -161,4 +161,4 @@
      161161 const displayName = branding.displayName;
      162162 const stateDir = path.join(baseDir, isDevelopment ? "dev" : "userdata");
      163163 const userDataDirName = isDevelopment ? "t3code-dev" : "t3code";
      164- const legacyUserDataDirName = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)";
      164+ const legacyUserDataDirName = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Bscholar)";
      cursor[bot](GitHub profile, opens in a new tab)commented

      Alpha userData not migrated

      High Severity

      The legacyUserDataDirName was updated from "T3 Code (Alpha)" to "T3 Code (Bscholar)". This prevents resolveUserDataPath from finding existing user data in "Alpha" directories, causing a fresh user profile to be created and prior settings, SSH config, and Electron data to be lost on upgrade.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 967842729ad78d5a9ac5a8a1cbf660fbf7e1f319. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +707,21 @@
      707+ ),
      708+ );
      709+ }
      710+
      711+ const startedAt = yield* nowIso;
      712+ const threadId = input.threadId;
      713+ const modelSelection =
      714+ input.modelSelection !== undefined && input.modelSelection.instanceId === boundInstanceId
      715+ ? input.modelSelection
      716+ : undefined;
      717+
      718+ const piResumeState = readPiResumeState(input.resumeCursor);
      719+ const baseCwd = input.cwd ?? serverConfig.cwd;
      720+
      721+ const spawnArgs: string[] = ["--mode", "rpc"];
      722+ if (piResumeState) {
      723+ spawnArgs.push("--session", piResumeState.sessionFile);
      724+ }
      725+ if (modelSelection?.model) {
      726+ spawnArgs.push("--model", modelSelection.model);
      727+ }
      cursor[bot](GitHub profile, opens in a new tab)commented

      Pi launchArgs never applied

      Medium Severity

      The PiAdapter's startSession function omits PiSettings.launchArgs when spawning the Pi RPC process. This prevents user-configured arguments from being applied, unlike other drivers that support these settings.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 967842729ad78d5a9ac5a8a1cbf660fbf7e1f319. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +913,21 @@
      913+ activeTurnId: turnId,
      914+ updatedAt: turnStartedAt,
      915+ };
      916+
      917+ const turnStartedStamp = yield* makeEventStamp();
      918+ yield* offerRuntimeEvent({
      919+ type: "turn.started",
      920+ eventId: turnStartedStamp.eventId,
      921+ provider: PROVIDER,
      922+ createdAt: turnStartedStamp.createdAt,
      923+ threadId: context.session.threadId,
      924+ turnId,
      925+ payload: {},
      926+ providerRefs: {},
      927+ });
      928+
      929+ const promptText = typeof input.input === "string" ? input.input : "";
      930+
      931+ yield* context.writeCommand({ type: "prompt", message: promptText }).pipe(
      932+ Effect.catchDefect(() => completeTurn(context, "failed", "Failed to send prompt.")),
      933+ );
      cursor[bot](GitHub profile, opens in a new tab)commented

      Pi turns ignore attachments

      Medium Severity

      The sendTurn implementation only forwards the string input to Pi's prompt RPC, completely ignoring any attachments from ProviderSendTurnInput. This results in Pi receiving incomplete prompts when users include images or files.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 967842729ad78d5a9ac5a8a1cbf660fbf7e1f319. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -145,10 +53,13 @@
      145- echo "cli_dist_tag=latest" >> "$GITHUB_OUTPUT"
      146- if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
      147- echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
      148- echo "make_latest=true" >> "$GITHUB_OUTPUT"
      149- else
      150- echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
      151- echo "make_latest=false" >> "$GITHUB_OUTPUT"
      152- fi
      53+ raw="${DISPATCH_VERSION}"
      54+ version="${raw#v}"
      55+ if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
      56+ echo "Invalid release version: $raw" >&2
      57+ exit 1
      15358 fi
      15459
      60+ echo "release_channel=stable" >> "$GITHUB_OUTPUT"
      61+ echo "version=$version" >> "$GITHUB_OUTPUT"
      62+ echo "tag=v$version" >> "$GITHUB_OUTPUT"
      63+ echo "name=T3 Code v$version" >> "$GITHUB_OUTPUT"
      64+ echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
      65+ echo "make_latest=true" >> "$GITHUB_OUTPUT"
      cursor[bot](GitHub profile, opens in a new tab)commented

      Prerelease versions marked latest

      Medium Severity

      The release_meta step now always sets is_prerelease to false and make_latest to true. This means any version provided with a pre-release suffix (e.g., 1.2.3-beta.1) will be incorrectly published and promoted as the latest stable GitHub release.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 967842729ad78d5a9ac5a8a1cbf660fbf7e1f319. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -993,3 +993,10 @@
      993993 claudeAgent: { enabled: false },
      994994 cursor: { enabled: false },
      995995 opencode: { enabled: false },
      996+ piAgent: {
      997+ enabled: true,
      998+ binaryPath: "",
      999+ homePath: "",
      1000+ customModels: [],
      1001+ launchArgs: "",
      1002+ },
      cursor[bot](GitHub profile, opens in a new tab)commented

      Tests enable Pi probing

      Low Severity

      Several registry tests disable Codex, Claude, Cursor, and OpenCode probes to avoid spawning on CI, but set piAgent.enabled: true, which still runs the Pi --version health check. That breaks the stated isolation and can add flaky PATH-dependent behavior to Codex-focused cases.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 967842729ad78d5a9ac5a8a1cbf660fbf7e1f319. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +885,21 @@
      885+
      886+ const readyStamp = yield* makeEventStamp();
      887+ yield* offerRuntimeEvent({
      888+ type: "session.state.changed",
      889+ eventId: readyStamp.eventId,
      890+ provider: PROVIDER,
      891+ createdAt: readyStamp.createdAt,
      892+ threadId,
      893+ payload: { state: "ready" },
      894+ providerRefs: {},
      895+ });
      896+
      897+ return { ...context.session };
      898+ });
      899+
      900+ const sendTurn: PiAdapterShape["sendTurn"] = Effect.fn("sendTurn")(function* (input) {
      901+ const context = yield* requireSession(input.threadId);
      902+
      903+ if (context.turnState) {
      904+ yield* completeTurn(context, "completed");
      905+ }
      cursor[bot](GitHub profile, opens in a new tab)commented

      Inflight Pi turn marked completed

      Medium Severity

      If sendTurn is called while a Pi turn is still active, the adapter calls completeTurn with state completed before sending the new prompt. The Pi agent may still be running the previous work, so the UI can close a turn prematurely while RPC work continues.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 967842729ad78d5a9ac5a8a1cbf660fbf7e1f319. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -550,6 +220,5 @@
      550220 release-assets/*.dmg
      551221 release-assets/*.zip
      552222 release-assets/*.AppImage
      553- release-assets/*.exe
      554- release-assets/*.blockmap
      555223 release-assets/*.yml
      224+ release-assets/*.tgz
      cursor[bot](GitHub profile, opens in a new tab)commented

      Mac updater blockmaps not published

      Medium Severity

      The release job still collects *.blockmap files into artifacts but the GitHub release upload lists no longer include release-assets/*.blockmap. Mac builds that rely on electron-updater blockmaps may fail or fall back when updating from the published release.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 967842729ad78d5a9ac5a8a1cbf660fbf7e1f319. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. @@ -0,0 +820,21 @@
      820+ ),
      821+ );
      822+ context.stdoutFiber = stdoutFiber;
      823+
      824+ // Drain stderr to avoid blocking the process
      825+ runFork(
      826+ child.stderr.pipe(
      827+ Stream.runDrain,
      828+ Effect.ignore,
      829+ ),
      830+ );
      831+
      832+ // Fetch the session file path via get_state for resume cursor
      833+ const stateReqId = yield* Random.nextUUIDv4;
      834+ const stateDeferred = yield* Deferred.make<unknown, never>();
      835+ pendingRequests.set(stateReqId, stateDeferred);
      836+ yield* writeCommand({ type: "get_state", id: stateReqId });
      837+
      838+ const stateResponse = yield* Deferred.await(stateDeferred).pipe(
      839+ Effect.timeoutOption(5000),
      840+ );
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟢 Low Layers/PiAdapter.ts:838

      The pendingRequests entry for stateReqId is never cleaned up when Deferred.await times out at lines 838-840. If the 5-second timeout fires, the map entry remains orphaned until the session closes, leaking one entry per timed-out session startup. Consider deleting the entry on timeout using Effect.tap or Effect.ensuring.

           const stateResponse = yield* Deferred.await(stateDeferred).pipe(
             Effect.timeoutOption(5000),
      +      Effect.tap(() => Effect.sync(() => pendingRequests.delete(stateReqId))),
           );
      🤖 Copy this AI Prompt to have your agent fix this:
      In file apps/server/src/provider/Layers/PiAdapter.ts around lines 838-840:
      
      The `pendingRequests` entry for `stateReqId` is never cleaned up when `Deferred.await` times out at lines 838-840. If the 5-second timeout fires, the map entry remains orphaned until the session closes, leaking one entry per timed-out session startup. Consider deleting the entry on timeout using `Effect.tap` or `Effect.ensuring`.
      
      Evidence trail:
      apps/server/src/provider/Layers/PiAdapter.ts line 835: `pendingRequests.set(stateReqId, stateDeferred)` — entry added. Lines 838-840: `Deferred.await(stateDeferred).pipe(Effect.timeoutOption(5000))` — timeout does not delete entry. Line 598: `context.pendingRequests.delete(msg['id'])` — only deletion path, requires a response to arrive. Lines 613-665 (`stopSessionInternal`): `pendingExtensionUIs` explicitly cleaned at 625-631 with `.clear()`, but no cleanup for `pendingRequests` at all. Line 664: `sessions.delete(context.session.threadId)` removes context reference (GC-eligible), but entry persists in map until that point.
      @@ -468,19 +190,2 @@
      468- with:
      469- app-id: ${{ secrets.RELEASE_APP_ID }}
      470- private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
      471- owner: ${{ github.repository_owner }}
      472-
      473- - name: Checkout
      474- uses: actions/checkout@v6
      475- with:
      476- ref: ${{ needs.preflight.outputs.ref }}
      477-
      478- - name: Setup Bun
      479- uses: oven-sh/setup-bun@v2
      480- with:
      481- bun-version-file: package.json
      482-
      483- - name: Setup Node
      484- uses: actions/setup-node@v6
      485- with:
      486- node-version-file: package.json
      190+ - name: Build t3 server package
      191+ run: bun run build --filter=t3
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High workflows/release.yml:191

      bun run build --filter=t3 passes --filter=t3 to the build script instead of interpreting it as a workspace filter. Bun requires top-level flags before subcommands, so the filter is ignored and the build may fail or run against the wrong packages. Use bun --filter=t3 run build to ensure the filter is applied.

      Suggested change
      191- run: bun run build --filter=t3
      191+ - name: Build t3 server package
      192+ run: bun --filter=t3 run build
      🤖 Copy this AI Prompt to have your agent fix this:
      In file .github/workflows/release.yml around line 191:
      
      `bun run build --filter=t3` passes `--filter=t3` to the build script instead of interpreting it as a workspace filter. Bun requires top-level flags before subcommands, so the filter is ignored and the build may fail or run against the wrong packages. Use `bun --filter=t3 run build` to ensure the filter is applied.
      @@ -89,4 +89,4 @@
      8989 href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300..800;1,9..40,300..800&display=swap"
      9090 rel="stylesheet"
      9191 />
      92- <title>T3 Code (Alpha)</title>
      92+ <title>T3 Code (Bscholar)</title>
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High web/index.html:92

      The <title> was changed to T3 Code (Bscholar), where "Bscholar" appears to be the PR author's username rather than an intentional product stage name. This displays a personal identifier to all users in browser tabs, bookmarks, and search results. Consider reverting to a stage name like (Alpha) or confirming if this change is intentional.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file apps/web/index.html around line 92:
      
      The `<title>` was changed to `T3 Code (Bscholar)`, where "Bscholar" appears to be the PR author's username rather than an intentional product stage name. This displays a personal identifier to all users in browser tabs, bookmarks, and search results. Consider reverting to a stage name like `(Alpha)` or confirming if this change is intentional.
      @@ -139,16 +53,7 @@
      139- fi
      140-
      141- echo "release_channel=stable" >> "$GITHUB_OUTPUT"
      142- echo "version=$version" >> "$GITHUB_OUTPUT"
      143- echo "tag=v$version" >> "$GITHUB_OUTPUT"
      144- echo "name=T3 Code v$version" >> "$GITHUB_OUTPUT"
      145- echo "cli_dist_tag=latest" >> "$GITHUB_OUTPUT"
      146- if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
      147- echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
      148- echo "make_latest=true" >> "$GITHUB_OUTPUT"
      149- else
      150- echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
      151- echo "make_latest=false" >> "$GITHUB_OUTPUT"
      152- fi
      53+ raw="${DISPATCH_VERSION}"
      54+ version="${raw#v}"
      55+ if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
      56+ echo "Invalid release version: $raw" >&2
      57+ exit 1
      15358 fi
      15459
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High workflows/release.yml:59

      The version validation regex on line 55 accepts pre-release suffixes like -beta.1, but lines 64-65 unconditionally set is_prerelease=false and make_latest=true. When a user dispatches the workflow with version 1.2.3-beta.1, the GitHub Release is published as the latest stable release, directing all users to a pre-release build instead of respecting the pre-release semantics.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file .github/workflows/release.yml around line 59:
      
      The version validation regex on line 55 accepts pre-release suffixes like `-beta.1`, but lines 64-65 unconditionally set `is_prerelease=false` and `make_latest=true`. When a user dispatches the workflow with version `1.2.3-beta.1`, the GitHub Release is published as the latest stable release, directing all users to a pre-release build instead of respecting the pre-release semantics.
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/967842729ad78d5a9ac5a8a1cbf660fbf7e1f319/packages/contracts/src/settings.ts#L505

      Adding piAgent to ServerSettings.providers at line 416 without a corresponding entry in ServerSettingsPatch.providers breaks the patch API for Pi settings. When users attempt to modify Pi settings, the request will fail validation because piAgent is missing from the patch struct at lines 505-511. Every other provider has a matching patch schema, so piAgent should have one too.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file packages/contracts/src/settings.ts around line 505:
      
      Adding `piAgent` to `ServerSettings.providers` at line 416 without a corresponding entry in `ServerSettingsPatch.providers` breaks the patch API for Pi settings. When users attempt to modify Pi settings, the request will fail validation because `piAgent` is missing from the patch struct at lines 505-511. Every other provider has a matching patch schema, so `piAgent` should have one too.
      
      Evidence trail:
      packages/contracts/src/settings.ts lines 411-417 (ServerSettings.providers includes piAgent), lines 505-511 (ServerSettingsPatch.providers omits piAgent), lines 461-490 (CodexSettingsPatch, ClaudeSettingsPatch, CursorSettingsPatch, OpenCodeSettingsPatch all defined, no PiSettingsPatch). PI_PLAN.md line 110 and 125 mention PiSettingsPatch only in a planning doc.
    5. Approvability

      Verdict: Needs human review

      4 blocking correctness issues found. This PR introduces a new Pi Agent provider integration alongside major CI/CD workflow changes, branding modifications, and default behavior changes. Multiple high-severity unresolved comments identify potential data loss, broken release semantics, and questionable branding changes that require human assessment.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).

Sign in to join this conversation.