@devries-cameron20 / t3code Mirror · read-only / commits / ab1e221618
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, 13:15 UTC

fix(server): guest links no longer return file diffs (#26538)

Shoubhit Dash committed Oct 29, 2026 at 10:24 UTC ab1e221618724177d67ff3d2cf07e5b211a0bfc2
2 files changed +46 -13
apps/server/src/guest/GuestShareService.test.ts
+40 -11
@@ -411,7 +411,6 @@ it.effect("serves no render for an item outside the shared thread", () =>
411 }).pipe(Effect.provide(layerTest)),
412 );
413
414 -/** A message from the owner, which opens a run for the command below. */
414 const ownerRun = Effect.gen(function* () {
415 const orchestrator = yield* Orchestrator.OrchestratorV2;
416 yield* orchestrator.dispatch({
@@ -430,12 +429,17 @@ const ownerRun = Effect.gen(function* () {
429 return runs[0]!.id;
430 });
431
433 -const writeCommand = (
432 +const writeItem = (
433 id: string,
435 - fields: Pick<
436 - Extract<OrchestrationV2TurnItem, { type: "command_execution" }>,
437 - "status" | "output"
438 - >,
434 + fields:
435 + | Pick<
436 + Extract<OrchestrationV2TurnItem, { type: "command_execution" }>,
437 + "type" | "status" | "input" | "output"
438 + >
439 + | Pick<
440 + Extract<OrchestrationV2TurnItem, { type: "file_change" }>,
441 + "type" | "status" | "fileName" | "diffStr" | "oldStr" | "newStr"
442 + >,
443 ) =>
444 Effect.gen(function* () {
445 const runId = yield* ownerRun;
@@ -464,8 +468,6 @@ const writeCommand = (
468 startedAt: now,
469 completedAt: fields.status === "running" ? null : now,
470 updatedAt: now,
467 - type: "command_execution",
468 - input: "ls /work/src",
471 ...fields,
472 },
473 },
@@ -474,17 +476,40 @@ const writeCommand = (
476 return TurnItemId.make(id);
477 });
478
477 -it.effect("gives the guest a command's detail and output, as the owner's row loads them", () =>
479 +it.effect("gives the guest a command's detail and output, but no file diffs", () =>
480 Effect.gen(function* () {
481 const { guestShares, credential } = yield* shareThread;
482 const { token: session } = yield* guestShares.redeem({ credential, name: "Sam" });
481 - const command = yield* writeCommand("item:command", {
483 + const command = yield* writeItem("item:command", {
484 + type: "command_execution",
485 status: "completed",
486 + input: "ls /work/src",
487 output: "/work/src/auth.ts\n",
488 });
489
490 const detail = (yield* guestShares.item(session, command)).item;
491 assert.deepInclude(detail, { input: "ls /work/src", output: "/work/src/auth.ts\n" });
492 + const edit = yield* writeItem("item:edit", {
493 + type: "file_change",
494 + status: "completed",
495 + fileName: "src/auth.ts",
496 + diffStr: "-const token = 1;\n+const token = 2;\n",
497 + });
498 + const write = yield* writeItem("item:write", {
499 + type: "file_change",
500 + status: "completed",
501 + fileName: "src/config.ts",
502 + oldStr: "",
503 + newStr: "export const key = 1;\n",
504 + });
505 + for (const [id, fileName] of [
506 + [edit, "src/auth.ts"],
507 + [write, "src/config.ts"],
508 + ] as const) {
509 + const change = (yield* guestShares.item(session, id)).item;
510 + assert.deepInclude(change, { type: "file_change", fileName });
511 + assert.doesNotHaveAnyKeys(change, ["diffStr", "oldStr", "newStr"]);
512 + }
513 const frames = Array.from(
514 yield* Stream.runCollect(yield* guestShares.commandOutput(session, command)),
515 );
@@ -508,7 +533,11 @@ it.effect("ends a running command's output once the owner stops sharing", () =>
533 Effect.gen(function* () {
534 const { orchestrator, guestShares, credential } = yield* shareThread;
535 const { token: session } = yield* guestShares.redeem({ credential, name: "Sam" });
511 - const command = yield* writeCommand("item:running", { status: "running" });
536 + const command = yield* writeItem("item:running", {
537 + type: "command_execution",
538 + status: "running",
539 + input: "ls /work/src",
540 + });
541 const collecting = yield* Stream.runCollect(
542 yield* guestShares.commandOutput(session, command),
543 ).pipe(Effect.forkChild);
apps/server/src/guest/GuestShareService.ts
+6 -2
@@ -57,6 +57,7 @@ import { buildBoundedThreadStreamSnapshot } from "../orchestration-v2/ThreadStre
57 import {
58 projectDomainEventForWire,
59 projectTurnItemForDetail,
60 + projectTurnItemForWire,
61 } from "../orchestration-v2/WireProjection.ts";
62 import * as ProviderRegistry from "../provider/ProviderRegistry.ts";
63 import * as ServerSettings from "../serverSettings.ts";
@@ -179,7 +180,7 @@ export class GuestShareService extends Context.Service<
180 session: string,
181 itemId: string,
182 ) => Effect.Effect<{ readonly path: string; readonly title: string }, GuestShareAccessError>;
182 - /** One item of the shared thread, as the owner's expanded row loads it. */
183 + /** One item of the shared thread, as the owner's expanded row loads it, without file diffs. */
184 readonly item: (
185 session: string,
186 itemId: string,
@@ -658,7 +659,10 @@ const make = Effect.gen(function* () {
659
660 const item = Effect.fn("GuestShareService.item")(function* (session: string, itemId: string) {
661 const { item } = yield* threadItem(session, itemId);
661 - return { item: projectTurnItemForDetail(item) };
662 + return {
663 + item:
664 + item.type === "file_change" ? projectTurnItemForWire(item) : projectTurnItemForDetail(item),
665 + };
666 });
667
668 const commandOutput = Effect.fn("GuestShareService.commandOutput")(function* (