diff --git a/backend/scripts/p2-acceptance.mjs b/backend/scripts/p2-acceptance.mjs index ace44310..d62d6542 100644 --- a/backend/scripts/p2-acceptance.mjs +++ b/backend/scripts/p2-acceptance.mjs @@ -780,8 +780,6 @@ async function writeInstallationFiles(ctx) { "workspace-maintenance": { image: ctx.coreImageTag, environment: { - P2_CHILD_DEBUG: "1", - THT_P2_DEBUG: "1", THT_EVIDENCE_PRIVATE_HOST_ALLOWLIST: "host.docker.internal", }, extra_hosts: ["host.docker.internal:host-gateway"], diff --git a/backend/src/workspace-maintenance.ts b/backend/src/workspace-maintenance.ts index 248a96f9..20b8e01d 100644 --- a/backend/src/workspace-maintenance.ts +++ b/backend/src/workspace-maintenance.ts @@ -149,17 +149,8 @@ export async function runWorkspaceMaintenanceCli( const result = failureResult(command, (() => { try { return JSON.parse(io.stdin).workspaceId ?? ""; } catch { return ""; } })(), failureCode); - if (process.env.P2_CHILD_DEBUG === "1") { - const detail = String((error as Error).message ?? "").replace(/[\r\n]+/g, " ").slice(0, 2048); - result.warnings = detail.length > 0 ? [detail] : undefined; - } io.writeStdout(boundedJson(result)); - if (process.env.P2_CHILD_DEBUG === "1") { - const detail = String((error as Error).message ?? "").replace(/[\r\n]+/g, " ").slice(0, 2048); - io.writeStderr(`workspace maintenance failed: ${detail}\n`); - } else { - io.writeStderr(sanitizeStderr(error)); - } + io.writeStderr(sanitizeStderr(error)); const message = String((error as Error).message ?? ""); const requestError = error instanceof SyntaxError || message === "invalid request" @@ -275,14 +266,7 @@ function createProductionService(): WorkspacePreprocessingService { let stderr = ""; child.stdout?.on("data", (chunk: Buffer) => { stdout += chunk.toString("utf8"); }); child.stderr?.on("data", (chunk: Buffer) => { stderr += chunk.toString("utf8"); }); - child.on("close", (code) => { - const capped = { exitCode: code ?? 0, stdout, stderr: stderr.slice(0, 64 * 1024) }; - if (process.env.P2_CHILD_DEBUG === "1" && (code ?? 0) !== 0) { - capped.stdout = stdout.slice(0, 4096); - capped.stderr = stderr.slice(0, 4096); - } - resolve(capped); - }); + child.on("close", (code) => resolve({ exitCode: code ?? 0, stdout, stderr: stderr.slice(0, 64 * 1024) })); child.on("error", (error) => resolve({ exitCode: 1, stdout, stderr: String(error.message).slice(0, 4096) })); }); } finally { diff --git a/backend/src/workspaces/preprocessing-service.ts b/backend/src/workspaces/preprocessing-service.ts index 7142ad56..87015df1 100644 --- a/backend/src/workspaces/preprocessing-service.ts +++ b/backend/src/workspaces/preprocessing-service.ts @@ -430,13 +430,7 @@ export class WorkspacePreprocessingService { private async runJsonStage(runtime: ActiveRuntime, argv: string[]): Promise> { const result = await this.deps.runChild({ argv, configPath: runtime.configLease.path }); - if (result.exitCode !== 0) { - if (process.env.P2_CHILD_DEBUG === "1") { - const detail = `${result.stderr ?? ""}${result.stdout ?? ""}`.replace(/[\r\n]+/g, " ").slice(0, 2048); - throw new Error(`workspace child failed: ${detail}`); - } - throw new Error("workspace child failed"); - } + if (result.exitCode !== 0) throw new Error("workspace child failed"); return JSON.parse(result.stdout) as Record; } diff --git a/harness/tht/cli/preprocess_cmd.py b/harness/tht/cli/preprocess_cmd.py index a716fa50..646af9ee 100644 --- a/harness/tht/cli/preprocess_cmd.py +++ b/harness/tht/cli/preprocess_cmd.py @@ -262,8 +262,6 @@ def dwh_cmd( result = run_dwh_from_config(config, steps=selected, resume=resume) except Exception as exc: # noqa: BLE001 payload = {"status": "failed", "error": "DWH preprocessing failed"} - if os.environ.get("THT_P2_DEBUG") == "1": - payload["error"] = f"DWH preprocessing failed: {type(exc).__name__}: {exc}" if json_output: typer.echo(json.dumps(payload, sort_keys=True)) else: