Skip to content

Commit b1dbdd3

Browse files
authored
fix(codex): keep live commentary tables and code blocks readable (#129828)
* fix(codex): preserve markdown in live commentary * chore: keep release-owned changelog out of bug fix
1 parent 43fb810 commit b1dbdd3

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

‎extensions/codex/src/app-server/event-projector-assistant.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ export class CodexAssistantProjection {
555555
}
556556

557557
private emitCommentaryProgress(params: { itemId: string; text: string }): void {
558-
const progressText = params.text.replace(/\s+/g, " ").trim();
558+
const progressText = params.text.trim();
559559
if (
560560
!progressText ||
561561
this.lastCommentaryProgressTextByItem.get(params.itemId) === progressText

‎extensions/codex/src/app-server/event-projector.commentary.test.ts‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,18 @@ describe("CodexAppServerEventProjector commentary projection", () => {
206206
it("streams commentary agent messages as keyed progress events", async () => {
207207
const onAgentEvent = vi.fn();
208208
const onPartialReply = vi.fn();
209+
const commentaryText = [
210+
"Checking the app-server stream",
211+
"",
212+
"| Intent | Command |",
213+
"| --- | --- |",
214+
"| Session only | `/model opus` |",
215+
"",
216+
"```text",
217+
"BEFORE /model opus → persistent",
218+
"AFTER /model opus → session only",
219+
"```",
220+
].join("\n");
209221
const projector = await createProjector({
210222
...(await createParams()),
211223
onAgentEvent,
@@ -224,15 +236,15 @@ describe("CodexAppServerEventProjector commentary projection", () => {
224236
);
225237
await projector.handleNotification(agentMessageDelta("Checking", "msg-commentary"));
226238
await projector.handleNotification(
227-
agentMessageDelta(" the app-server stream", "msg-commentary"),
239+
agentMessageDelta(commentaryText.slice("Checking".length), "msg-commentary"),
228240
);
229241
await projector.handleNotification(
230242
turnCompleted([
231243
{
232244
type: "agentMessage",
233245
id: "msg-commentary",
234246
phase: "commentary",
235-
text: "Checking the app-server stream",
247+
text: commentaryText,
236248
},
237249
{
238250
type: "agentMessage",
@@ -262,7 +274,7 @@ describe("CodexAppServerEventProjector commentary projection", () => {
262274
kind: "preamble",
263275
title: "Preamble",
264276
phase: "update",
265-
progressText: "Checking the app-server stream",
277+
progressText: commentaryText,
266278
source: "codex-app-server",
267279
},
268280
]);
@@ -276,9 +288,9 @@ describe("CodexAppServerEventProjector commentary projection", () => {
276288
);
277289
expect(commentary).toMatchObject({
278290
role: "assistant",
279-
content: [{ type: "text", text: "Checking the app-server stream" }],
291+
content: [{ type: "text", text: commentaryText }],
280292
openclawStreamFallback: {
281-
replacementText: "Checking the app-server stream",
293+
replacementText: commentaryText,
282294
source: "segment",
283295
itemId: "msg-commentary",
284296
},

0 commit comments

Comments
 (0)