fix: 修复 Web observe turn 可见性

This commit is contained in:
Codex
2026-07-10 07:01:23 +02:00
parent f128d73663
commit 5e8d3201ec
10 changed files with 350 additions and 19 deletions
@@ -1,8 +1,28 @@
import assert from "node:assert/strict";
import { test } from "bun:test";
import { withWebObserveCommandRendered } from "../hwlab-node-web-observe-render";
import { renderWebProbeScriptResult } from "./web-observe-render";
test("observe command renderer separates control completion from async turn terminal state", () => {
const rendered = withWebObserveCommandRendered({
ok: true,
status: "control-completed",
command: "web-probe observe command",
id: "webobs-fixture",
commandId: "cmd-fixture",
observerCommand: { type: "sendPrompt" },
observer: { ok: true, completedAt: "2026-07-10T01:00:01.000Z", result: { mark: "submitted" } },
control: { executionStatus: "completed", businessTurnTerminalImplied: false },
asyncTurn: { applicable: true, submissionStatus: "accepted", terminalStatus: null, terminalObserved: false, traceId: "trc_fixture" },
});
const text = String(rendered.renderedText);
assert.match(text, /CONTROL.*TURN_SUBMIT.*TURN_TERMINAL/u);
assert.match(text, /completed.*accepted.*not-observed.*trc_fixture/u);
assert.match(text, /does not imply the asynchronous business turn reached a terminal state/u);
assert.match(text, /--view turn-summary --command-id cmd-fixture/u);
});
test("web-probe script render warns to promote repeated scripts into commands", () => {
const rendered = renderWebProbeScriptResult({
ok: true,