@devries-cameron20 / t3code Mirror · read-only / commits / d7ee7b31f4
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 04:30 UTC

fix(pi): extension errors name folder extensions instead of "index" (#29768)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>

Alex Southwell committed Nov 3, 2026 at 23:37 UTC d7ee7b31f4dd73671fd6a74965cf075041d56079
2 files changed +12 -4
packages/provider-pi/src/server/adapter.test.ts
+8 -2
@@ -1533,7 +1533,10 @@ describe("PiAdapterV2", () => {
1533 it.effect("gives notify and extension-error items distinct ids in each thread", () =>
1534 Effect.gen(function* () {
1535 const itemIds = new Set<string>();
1536 - for (const threadId of [THREAD_ID, ThreadId.make("thread-pi-test-2")]) {
1536 + for (const [threadId, extensionPath] of [
1537 + [THREAD_ID, "/ext/a.ts"],
1538 + [ThreadId.make("thread-pi-test-2"), "/ext/a/index.ts"],
1539 + ] as const) {
1540 const fake = yield* makeFakePi;
1541 const { runtime, takeEvent } = yield* openRuntime(fake, "default", threadId);
1542 const providerThread = yield* runtime.ensureThread({
@@ -1558,7 +1561,7 @@ describe("PiAdapterV2", () => {
1561 method: "notify",
1562 message: "note",
1563 });
1561 - yield* fake.emit({ type: "extension_error", extensionPath: "/ext/a.ts", error: "boom" });
1564 + yield* fake.emit({ type: "extension_error", extensionPath, error: "boom" });
1565 for (const prefix of ["notify:", "extension-error:"]) {
1566 const item = yield* takeEvent(
1567 (event) =>
@@ -1566,6 +1569,9 @@ describe("PiAdapterV2", () => {
1569 event.turnItem.nativeItemRef?.nativeId?.startsWith(prefix) === true,
1570 );
1571 if (item.type === "turn_item.updated") itemIds.add(item.turnItem.id);
1572 + if (item.type === "turn_item.updated" && prefix === "extension-error:") {
1573 + assert.equal(item.turnItem.title, "a");
1574 + }
1575 }
1576 }
1577 assert.equal(itemIds.size, 4);
packages/provider-pi/src/server/adapter.ts
+4 -2
@@ -3376,8 +3376,10 @@ function piSubagentOutput(result: unknown): string {
3376
3377 function piExtensionDisplayName(extensionPath: string | undefined): string {
3378 if (extensionPath === undefined) return "Pi extension";
3379 - const normalized = extensionPath.replace(/\\/g, "/").replace(/\/+$/, "");
3380 - const name = normalized.slice(normalized.lastIndexOf("/") + 1).replace(/\.[^.]+$/, "");
3379 + const segments = extensionPath.replace(/\\/g, "/").split("/").filter(Boolean);
3380 + const fileName = segments.at(-1)?.replace(/\.[^.]+$/, "") ?? "";
3381 + // Pi loads a directory extension from its index file; the folder names it.
3382 + const name = fileName === "index" ? (segments.at(-2) ?? fileName) : fileName;
3383 return name.length === 0 ? "Pi extension" : name;
3384 }
3385