























@@ -9,6 +9,7 @@ import {
99assertDiagnosticStabilityClean,
1010assertResourceCeiling,
1111cleanupKitchenSinkEnv,
12+createGatewayReadyLogScanner,
1213extractPluginCommandNames,
1314fetchJson,
1415findDistCallGatewayModuleFiles,
@@ -75,6 +76,44 @@ describe("kitchen-sink RPC gateway teardown", () => {
7576});
7677});
777879+describe("kitchen-sink RPC gateway readiness logs", () => {
80+it("scans gateway readiness logs incrementally across appended chunks", () => {
81+const root = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-rpc-log-scan-"));
82+try {
83+const logPath = path.join(root, "gateway.log");
84+writeFileSync(logPath, "booting\n".repeat(1000));
85+const scanner = createGatewayReadyLogScanner(logPath, "[gateway] ready");
86+87+expect(scanner()).toBe(false);
88+89+writeFileSync(logPath, "[gateway] rea", { flag: "a" });
90+expect(scanner()).toBe(false);
91+92+writeFileSync(logPath, "dy\n", { flag: "a" });
93+expect(scanner()).toBe(true);
94+expect(scanner()).toBe(true);
95+} finally {
96+rmSync(root, { recursive: true, force: true });
97+}
98+});
99+100+it("resets the readiness scanner after log rotation", () => {
101+const root = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-rpc-log-rotate-"));
102+try {
103+const logPath = path.join(root, "gateway.log");
104+writeFileSync(logPath, "older log contents without readiness\n");
105+const scanner = createGatewayReadyLogScanner(logPath, "[gateway] ready");
106+107+expect(scanner()).toBe(false);
108+109+writeFileSync(logPath, "[gateway] ready\n");
110+expect(scanner()).toBe(true);
111+} finally {
112+rmSync(root, { recursive: true, force: true });
113+}
114+});
115+});
116+78117describe("kitchen-sink RPC command output capture", () => {
79118it("keeps a bounded tail and tracks truncated output", () => {
80119const first = appendBoundedOutput({ text: "", truncatedChars: 0 }, "abcdef", 5);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。