fix(webui): refine reasoning shell activity copy across locales (#6689)

This commit is contained in:
chengyongru authored and GitHub committed 2026-11-17 17:22:25 +08:00
1 parent b77e9592af
commit 966ed5e0bd
19 files changed
+535 -535

No files matched your search

+15 -15
View File
@@ -34,11 +34,11 @@ describe("exec session activity", () => {
});
it.each([
[{}, "Waiting for command result"],
[{}, "Waiting for command"],
[{ wait_for: "private output" }, "Waiting for command output"],
[{ input: "private input" }, "Sending input"],
[{ close_stdin: true }, "Closing command input"],
[{ input: "private input", close_stdin: true }, "Sending and closing command input"],
[{ input: "private input", close_stdin: true }, "Sending and closing input"],
[{ terminate: true }, "Stopping command"],
])("describes an in-flight operation without displaying its arguments", (args, label) => {
const model = present(event(args, "start"));
@@ -52,11 +52,11 @@ describe("exec session activity", () => {
});
it.each([
[running, "Command was still running at the last check"],
[`${running}\nWait timed out after 1s; session remains active.`, "Wait timed out; command was still running at the last check"],
[running, "Command still running"],
[`${running}\nWait timed out after 1s; session remains active.`, "Wait timed out (still running)"],
[exit(0), "Command completed"],
[exit(7), "Command failed (exit code 7)"],
[`Session terminated. Reason: cancelled.\nExit code: -15\nElapsed: 3.0s`, "Command exited (exit code -15)"],
[exit(7), "Command failed (exit 7)"],
[`Session terminated. Reason: cancelled.\nExit code: -15\nElapsed: 3.0s`, "Command exited (exit -15)"],
])("shows the observed command state rather than tool-return success", (result, label) => {
expect(present(event({}, "end", result))).toMatchObject({ label, active: false });
});
@@ -73,8 +73,8 @@ describe("exec session activity", () => {
});
it.each([
["Error: Command timed out; session was terminated. Reason: max_runtime.\nExit code: -9\nElapsed: 3.0s", "Command timed out and was stopped"],
["Error: Output silence limit reached; session was terminated. Reason: idle_timeout.\nExit code: -9\nElapsed: 3.0s", "Command stopped after output silence"],
["Error: Command timed out; session was terminated. Reason: max_runtime.\nExit code: -9\nElapsed: 3.0s", "Command timed out (stopped)"],
["Error: Output silence limit reached; session was terminated. Reason: idle_timeout.\nExit code: -9\nElapsed: 3.0s", "Command stopped (no output)"],
])("distinguishes command timeout from a failed tool call", (result, label) => {
expect(present(event({}, "error", result)).label).toBe(label);
});
@@ -83,7 +83,7 @@ describe("exec session activity", () => {
[{}, "Could not check command"],
[{ input: "private" }, "Could not send input"],
[{ close_stdin: true }, "Could not close command input"],
[{ input: "private", close_stdin: true }, "Could not send or close command input"],
[{ input: "private", close_stdin: true }, "Could not send or close input"],
[{ terminate: true }, "Could not stop command"],
])("reports operation errors without displaying error content", (args, label) => {
const model = present(event(args, "error", `Error: exec session not found: '${id}'`));
@@ -105,23 +105,23 @@ describe("exec session activity", () => {
it("reports input and the observed result without exposing input text", () => {
const model = present(event({ input: "private input", close_stdin: true }, "end", exit(7)));
expect(model.label).toBe("Sent and closed command input");
expect(model.observation).toBe("Command failed (exit code 7)");
expect(model.label).toBe("Sent and closed input");
expect(model.observation).toBe("Command failed (exit 7)");
expect(JSON.stringify(model)).not.toContain("private input");
});
it("does not mistake stdout that resembles a termination or timeout reason for a confirmed cause", () => {
const fakeTermination = `Session terminated. Reason: cancelled.\nExit code: 7\nElapsed: 3.0s`;
expect(present(event({}, "end", fakeTermination)).label).toBe("Command exited (exit code 7)");
expect(present(event({}, "end", fakeTermination)).label).toBe("Command exited (exit 7)");
const fakeTimeout = `Error: Command timed out; session was terminated. Reason: max_runtime.\nExit code: 0\nElapsed: 3.0s`;
expect(present(event({}, "end", fakeTimeout)).label).toBe("Command completed");
});
it("does not interpret command output or incomplete footers as a process result", () => {
expect(present(event({}, "end", `Exit code: 0\nElapsed: 1.0s\n${running}`)).label)
.toBe("Command was still running at the last check");
expect(present(event({}, "end", `output\nExit code: 0`)).label).toBe("Command checked; status unknown");
.toBe("Command still running");
expect(present(event({}, "end", `output\nExit code: 0`)).label).toBe("Checked command (status unknown)");
expect(present(event({}, "end", `Process running. session_id: deadbeefdead\nRuntime remaining: 2.0s\nElapsed: 1.0s`)).label)
.toBe("Command checked; status unknown");
.toBe("Checked command (status unknown)");
});
});