Skip to content

Commit b9f2090

Browse files
committed
fix(server): retain long generated image paths
Preserve structured savedPath values in projected item data so generated images still render when the human-readable activity detail is truncated. Addresses pingdotgg#5114 (comment) AI-Assisted: true AI-Agent: codex AI-Model: openai/gpt-5.6-sol
1 parent 3ec9e15 commit b9f2090

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

‎apps/server/src/orchestration/ActivityPayloadProjection.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function collectChangedFiles(
8080
}
8181
}
8282

83-
function projectCommandData(data: Record<string, unknown>): Record<string, unknown> | undefined {
83+
function projectItemData(data: Record<string, unknown>): Record<string, unknown> | undefined {
8484
const item = asRecord(data.item);
8585
if (!item) {
8686
return undefined;
@@ -90,6 +90,9 @@ function projectCommandData(data: Record<string, unknown>): Record<string, unkno
9090
if ("command" in item) {
9191
projectedItem.command = item.command;
9292
}
93+
if ("savedPath" in item) {
94+
projectedItem.savedPath = item.savedPath;
95+
}
9396

9497
const input = asRecord(item.input);
9598
if (input && "command" in input) {
@@ -165,7 +168,7 @@ export function projectActivityPayload(
165168
}
166169

167170
const projectedData: Record<string, unknown> = {};
168-
const item = projectCommandData(data);
171+
const item = projectItemData(data);
169172
if (item) {
170173
projectedData.item = item;
171174
}

‎apps/server/test/ActivityPayloadProjection.test.ts‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ describe("projectActivityPayload", () => {
215215
detail: "/repo/project/generated/cat.png",
216216
status: "completed",
217217
requestKind: "command",
218-
data: {},
218+
data: {
219+
item: {
220+
savedPath: "/repo/project/generated/cat.png",
221+
},
222+
},
219223
});
220224
expect(deriveWorkLogEntries([projectedCodex])[0]?.imagePath).toBe(
221225
"/repo/project/generated/cat.png",
@@ -248,6 +252,27 @@ describe("projectActivityPayload", () => {
248252
);
249253
});
250254

255+
it("keeps generated image paths when the activity detail is truncated", () => {
256+
const imagePath = `/repo/project/${"generated/".repeat(20)}cat.png`;
257+
const truncatedDetail = `${imagePath.slice(0, 177)}...`;
258+
const projected = projectActivityPayload(
259+
makeActivity(
260+
"long-image",
261+
"image_view",
262+
{
263+
item: {
264+
type: "imageGeneration",
265+
savedPath: imagePath,
266+
},
267+
},
268+
truncatedDetail,
269+
),
270+
);
271+
272+
expect(imagePath.length).toBeGreaterThan(180);
273+
expect(deriveWorkLogEntries([projected])[0]?.imagePath).toBe(imagePath);
274+
});
275+
251276
it("projects snapshot and event transports without mutating their sources", () => {
252277
const activity = fixtures[0]!;
253278
const thread = makeThread([activity]);

0 commit comments

Comments
 (0)