feat: ship enterprise control and desktop governance
This commit is contained in:
47
tests/fixtures/codex-desktop-refresh-flaky-runtime.mjs
vendored
Normal file
47
tests/fixtures/codex-desktop-refresh-flaky-runtime.mjs
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import fs from "node:fs/promises";
|
||||
|
||||
const chunks = [];
|
||||
for await (const chunk of process.stdin) {
|
||||
chunks.push(typeof chunk === "string" ? chunk : chunk.toString("utf8"));
|
||||
}
|
||||
|
||||
const payload = JSON.parse(chunks.join("") || "{}");
|
||||
const stateFile = process.env.BOSS_CODEX_REFRESH_FLAKY_STATE;
|
||||
let count = 0;
|
||||
if (stateFile) {
|
||||
try {
|
||||
const state = JSON.parse(await fs.readFile(stateFile, "utf8"));
|
||||
count = Number.isFinite(state.count) ? state.count : 0;
|
||||
} catch {
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
count += 1;
|
||||
if (stateFile) {
|
||||
await fs.writeFile(stateFile, `${JSON.stringify({ count })}\n`, "utf8");
|
||||
}
|
||||
|
||||
if (count === 1) {
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({
|
||||
status: "failed",
|
||||
targetThreadRef: payload.targetThreadRef,
|
||||
appName: payload.appName,
|
||||
error: "transient desktop refresh failure",
|
||||
})}\n`,
|
||||
);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({
|
||||
status: "completed",
|
||||
targetThreadRef: payload.targetThreadRef,
|
||||
appName: payload.appName,
|
||||
deepLink: `codex://threads/${payload.targetThreadRef}`,
|
||||
detail: `flaky refresh accepted after ${count} attempts`,
|
||||
attemptCount: count,
|
||||
})}\n`,
|
||||
);
|
||||
Reference in New Issue
Block a user