Keep attachments visible after creating an agent (#2030)

* fix(chat): keep attachments visible after creating agents

Agent creation could receive the canonical user message before the client knew the new agent ID. Hand the local rich presentation to that message and preserve it through later timeline hydration.

* refactor(chat): clarify local message presentation naming

* fix(chat): clear pending state after message handoff
This commit is contained in:
Mohamed Boudra
2026-07-13 11:05:07 +02:00
committed by GitHub
parent a1e81685a1
commit 1f7efbd185
7 changed files with 240 additions and 70 deletions
@@ -352,6 +352,29 @@ describe("processTimelineResponse", () => {
attachments: [attachment],
});
expect(userMessages[0]?.optimistic).toBeUndefined();
const repeated = processTimelineResponse({
...baseTimelineInput,
currentTail: result.tail,
payload: {
...baseTimelineInput.payload,
reset: true,
startCursor: { seq: 1 },
endCursor: { seq: 1 },
entries: [
{
...makeTimelineEntry(1, "Analyze this", "user_message"),
item: {
type: "user_message",
text: "server-rendered attachment text",
messageId: "canonical-create-user",
},
},
],
},
});
expect(repeated.tail.filter((item) => item.kind === "user_message")).toEqual(userMessages);
});
it("keeps an unmatched optimistic user message during tail replacement", () => {