fix(codex): treat a literal null from the CLI as an empty list, not a 500

This commit is contained in:
2026-09-09 01:29:17 +07:00
parent 42db57ee18
commit ed418d5696
2 changed files with 17 additions and 2 deletions
+13
View File
@@ -321,6 +321,19 @@ describe("codex-cli run outcomes", () => {
}
});
it("treats a literal `null` on stdout as an empty list, not a crash", async () => {
// `null` is valid JSON, so it parses and slips past the unparseable-output
// guard. Reading `.installed` off it would surface as a 500 from a route
// whose whole contract is that CLI output never produces one.
const restore = stubCodex("echo null");
try {
assert.deepEqual((await cli.pluginList()).data, []);
assert.deepEqual((await cli.marketplaceList()).data, []);
} finally {
restore();
}
});
it("unwraps `codex plugin marketplace list --json`'s {marketplaces} object into a bare array", async () => {
const restore = stubCodex(`cat <<'JSON'\n{"marketplaces":[{"name":"sg"}]}\nJSON`);
try {