mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:01:24 +00:00
fix(daemon): avoid freezing Windows PATH in task scripts (#39139, thanks @Narcooo)
Co-authored-by: majx_mac <mjxnarco@pku.edu.cn>
This commit is contained in:
@@ -484,4 +484,20 @@ describe("tui-event-handlers: handleAgentEvent", () => {
|
||||
expect(chatLog.dropAssistant).toHaveBeenCalledWith("run-silent");
|
||||
expect(chatLog.finalizeAssistant).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("reloads history when a local run ends without a displayable final message", () => {
|
||||
const { state, loadHistory, noteLocalRunId, handleChatEvent } = createHandlersHarness({
|
||||
state: { activeChatRunId: "run-local-silent" },
|
||||
});
|
||||
|
||||
noteLocalRunId("run-local-silent");
|
||||
|
||||
handleChatEvent({
|
||||
runId: "run-local-silent",
|
||||
sessionKey: state.currentSessionKey,
|
||||
state: "final",
|
||||
});
|
||||
|
||||
expect(loadHistory).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -136,10 +136,16 @@ export function createEventHandlers(context: EventHandlerContext) {
|
||||
return sessionRuns.has(activeRunId);
|
||||
};
|
||||
|
||||
const maybeRefreshHistoryForRun = (runId: string) => {
|
||||
if (isLocalRunId?.(runId)) {
|
||||
const maybeRefreshHistoryForRun = (
|
||||
runId: string,
|
||||
opts?: { allowLocalWithoutDisplayableFinal?: boolean },
|
||||
) => {
|
||||
const isLocalRun = isLocalRunId?.(runId) ?? false;
|
||||
if (isLocalRun) {
|
||||
forgetLocalRunId?.(runId);
|
||||
return;
|
||||
if (!opts?.allowLocalWithoutDisplayableFinal) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (hasConcurrentActiveRun(runId)) {
|
||||
return;
|
||||
@@ -202,7 +208,9 @@ export function createEventHandlers(context: EventHandlerContext) {
|
||||
if (evt.state === "final") {
|
||||
const wasActiveRun = state.activeChatRunId === evt.runId;
|
||||
if (!evt.message) {
|
||||
maybeRefreshHistoryForRun(evt.runId);
|
||||
maybeRefreshHistoryForRun(evt.runId, {
|
||||
allowLocalWithoutDisplayableFinal: true,
|
||||
});
|
||||
chatLog.dropAssistant(evt.runId);
|
||||
finalizeRun({ runId: evt.runId, wasActiveRun, status: "idle" });
|
||||
tui.requestRender();
|
||||
|
||||
Reference in New Issue
Block a user