

























@@ -112,6 +112,33 @@ function relativeToArtifactBase(artifactBase: string, filePath: string) {
112112return path.relative(artifactBase, filePath).split(path.sep).join("/");
113113}
114114115+function sanitizeArtifactText(
116+value: string,
117+params: {
118+artifactBase?: string;
119+repoRoot: string;
120+},
121+) {
122+const roots = [
123+{ from: path.resolve(params.repoRoot), to: "<repo-root>" },
124+{ from: pathToFileURL(path.resolve(params.repoRoot)).href, to: "file://<repo-root>" },
125+ ...(params.artifactBase
126+ ? [
127+{ from: path.resolve(params.artifactBase), to: "<artifact-base>" },
128+{
129+from: pathToFileURL(path.resolve(params.artifactBase)).href,
130+to: "file://<artifact-base>",
131+},
132+]
133+ : []),
134+{ from: os.homedir(), to: "<home>" },
135+{ from: pathToFileURL(os.homedir()).href, to: "file://<home>" },
136+].filter((entry) => entry.from && entry.from !== path.parse(entry.from).root);
137+return roots
138+.toSorted((a, b) => b.from.length - a.from.length)
139+.reduce((text, entry) => text.replaceAll(entry.from, entry.to), value);
140+}
141+115142function buildExecution(params: {
116143artifacts: MatrixCell["artifacts"];
117144source: string;
@@ -195,6 +222,7 @@ function buildEvidenceSummary(params: {
195222196223async function runCommandForCell(params: {
197224args: string[];
225+artifactBase: string;
198226command: string;
199227cwd: string;
200228logPath: string;
@@ -209,13 +237,22 @@ async function runCommandForCell(params: {
209237env: process.env,
210238maxBuffer: 1024 * 1024,
211239});
212-await writeText(params.logPath, `$ ${commandLine}\n${stdout}${stderr}`);
240+await writeText(
241+params.logPath,
242+sanitizeArtifactText(`$ ${commandLine}\n${stdout}${stderr}`, {
243+artifactBase: params.artifactBase,
244+repoRoot: params.cwd,
245+}),
246+);
213247return {
214248status: "pass" as const,
215249wallMs: Date.now() - startedAt,
216250};
217251} catch (error) {
218-const details = error instanceof Error ? error.message : String(error);
252+const details = sanitizeArtifactText(error instanceof Error ? error.message : String(error), {
253+artifactBase: params.artifactBase,
254+repoRoot: params.cwd,
255+});
219256await writeText(params.logPath, `$ ${commandLine}\nblocked: ${details}\n`);
220257return {
221258failureReason: details,
@@ -242,6 +279,7 @@ async function captureControlUiScreenshot(params: {
242279artifactBase: string;
243280htmlPath: string;
244281logPath: string;
282+repoRoot: string;
245283screenshotPath: string;
246284}) {
247285const startedAt = Date.now();
@@ -264,7 +302,10 @@ async function captureControlUiScreenshot(params: {
264302wallMs: Date.now() - startedAt,
265303};
266304} catch (error) {
267-const details = error instanceof Error ? error.message : String(error);
305+const details = sanitizeArtifactText(error instanceof Error ? error.message : String(error), {
306+artifactBase: params.artifactBase,
307+repoRoot: params.repoRoot,
308+});
268309await writeText(params.logPath, `blocked: ${details}\n`);
269310return {
270311failureReason: details,
@@ -363,8 +404,10 @@ async function writeProducerArtifactFixtureHtml(params: {
363404}
364405365406async function captureProducerArtifactFixtureProof(params: {
407+artifactBase: string;
366408htmlPath: string;
367409logPath: string;
410+repoRoot: string;
368411screenshotPath: string;
369412skipVisualProof: boolean;
370413videoPath: string;
@@ -423,7 +466,10 @@ async function captureProducerArtifactFixtureProof(params: {
423466wallMs: Date.now() - startedAt,
424467};
425468} catch (error) {
426-const details = error instanceof Error ? error.message : String(error);
469+const details = sanitizeArtifactText(error instanceof Error ? error.message : String(error), {
470+artifactBase: params.artifactBase,
471+repoRoot: params.repoRoot,
472+});
427473await writeText(params.logPath, `blocked: ${details}\n`);
428474return {
429475failureReason: details,
@@ -494,8 +540,9 @@ export async function runUxMatrixEvidenceProducer(options: ProducerOptions) {
494540"logs.txt",
495541);
496542const cliResult = await runCommandForCell({
497-command: process.execPath,
498543args: ["openclaw.mjs", "--help"],
544+artifactBase: options.artifactBase,
545+command: process.execPath,
499546cwd: options.repoRoot,
500547logPath: cliLogPath,
501548timeoutMs: 30_000,
@@ -515,6 +562,7 @@ export async function runUxMatrixEvidenceProducer(options: ProducerOptions) {
515562artifactBase: options.artifactBase,
516563htmlPath: matrixHtmlPath,
517564logPath: path.join(screenshotCellDir, "logs.txt"),
565+repoRoot: options.repoRoot,
518566screenshotPath: matrixScreenshotPath,
519567});
520568@@ -575,8 +623,10 @@ export async function runUxMatrixEvidenceProducer(options: ProducerOptions) {
575623});
576624577625const fixtureProofResult = await captureProducerArtifactFixtureProof({
626+artifactBase: options.artifactBase,
578627htmlPath: fixtureHtmlPath,
579628logPath: path.join(fixtureProofDir, "logs.txt"),
629+repoRoot: options.repoRoot,
580630screenshotPath: path.join(fixtureProofDir, "producer-artifact-fixture.png"),
581631skipVisualProof: options.skipVisualProof,
582632videoPath: path.join(fixtureProofDir, "producer-artifact-fixture.webm"),
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。