




























@@ -469,7 +469,7 @@ describe("tui-event-handlers: handleAgentEvent", () => {
469469});
470470471471it("keeps a local BTW result visible when its empty final chat event arrives", () => {
472-const { state, btw, loadHistory, noteLocalBtwRunId, handleBtwEvent, handleChatEvent } =
472+const { state, btw, loadHistory, noteLocalBtwRunId, tui, handleBtwEvent, handleChatEvent } =
473473createHandlersHarness({
474474state: { activeChatRunId: null },
475475});
@@ -482,6 +482,7 @@ describe("tui-event-handlers: handleAgentEvent", () => {
482482question: "what changed?",
483483text: "nothing important",
484484} satisfies BtwEvent);
485+tui.requestRender.mockClear();
485486486487handleChatEvent({
487488runId: "run-btw",
@@ -495,6 +496,8 @@ describe("tui-event-handlers: handleAgentEvent", () => {
495496text: "nothing important",
496497isError: undefined,
497498});
499+expect(tui.requestRender).toHaveBeenCalledTimes(1);
500+expect(tui.requestRender).toHaveBeenCalledWith(true);
498501});
499502500503it("clears stale streaming for a local BTW empty final without hiding the result", () => {
@@ -701,6 +704,26 @@ describe("tui-event-handlers: handleAgentEvent", () => {
701704expect(loadHistory).toHaveBeenCalledTimes(1);
702705});
703706707+it("forces render when a command final only adds system text", () => {
708+const { state, chatLog, tui, handleChatEvent } = createHandlersHarness({
709+state: { activeChatRunId: "run-command" },
710+});
711+712+handleChatEvent({
713+runId: "run-command",
714+sessionKey: state.currentSessionKey,
715+state: "final",
716+message: {
717+command: true,
718+content: [{ type: "text", text: "/status done" }],
719+},
720+});
721+722+expect(chatLog.addSystem).toHaveBeenCalledWith("/status done");
723+expect(tui.requestRender).toHaveBeenCalledTimes(1);
724+expect(tui.requestRender).toHaveBeenCalledWith(true);
725+});
726+704727it("binds optimistic pending messages to the first gateway run id and skips history reload", () => {
705728const { state, loadHistory, isLocalRunId, handleChatEvent } = createHandlersHarness({
706729state: { activeChatRunId: null, pendingOptimisticUserMessage: true },
@@ -1127,7 +1150,7 @@ describe("tui-event-handlers: handleAgentEvent", () => {
11271150});
1128115111291152it("reloads history when a local run ends without a displayable final message", () => {
1130-const { state, loadHistory, noteLocalRunId, handleChatEvent } = createHandlersHarness({
1153+const { state, loadHistory, noteLocalRunId, tui, handleChatEvent } = createHandlersHarness({
11311154state: { activeChatRunId: "run-local-silent" },
11321155});
11331156@@ -1140,6 +1163,8 @@ describe("tui-event-handlers: handleAgentEvent", () => {
11401163});
1141116411421165expect(loadHistory).toHaveBeenCalledTimes(1);
1166+expect(tui.requestRender).toHaveBeenCalledTimes(1);
1167+expect(tui.requestRender).toHaveBeenCalledWith(true);
11431168});
1144116911451170it("does not reload history for local run with empty final when another run is active (#53115)", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。