fix(setup): keep Codex TOML comments when adding or removing REA
Setup and uninstall rewrote the whole Codex config.toml with a fresh TOML serializer, which dropped every comment and respelled unrelated values, although the plan promises to preserve unrelated configuration. Grok Build already edited only REA's server tables. Share that table editor with Codex, without Grok's root disabled_mcp_servers handling, keep the original final line break, and fall back to the full rewrite only when the edited text would not parse to the requested document. Fixes #1163 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
de5bfec79f
commit
e9c48a61e4
@@ -1310,6 +1310,35 @@ describe("Grok Bot registration", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Codex configuration comments", () => {
|
||||
it("keeps Codex comments and value spelling through setup and uninstall", async () => {
|
||||
const home = await createTestTempDirectory("rea-toml-comments-");
|
||||
roots.push(home);
|
||||
const configPath = join(home, ".codex/config.toml");
|
||||
const original =
|
||||
'# Keep this explanation.\nnotify = ["a", "b"]\nliteral = \'C:\\demo\\path\'\n';
|
||||
await mkdir(dirname(configPath), { recursive: true });
|
||||
await writeFile(configPath, original);
|
||||
|
||||
expect(
|
||||
await configureClientConfiguration(
|
||||
{ name: "codex", configPath, format: "toml" },
|
||||
{},
|
||||
["/isolated prefix/bin/rea", "mcp"],
|
||||
),
|
||||
).toMatchObject({ status: "configured" });
|
||||
const configured = await readFile(configPath, "utf8");
|
||||
expect(configured.startsWith(original)).toBe(true);
|
||||
expect(configured).toContain("[mcp_servers.rea]");
|
||||
|
||||
const removed = await runUninstall(false, systemUninstallHost(home));
|
||||
expect(removed.items).toContainEqual(
|
||||
expect.objectContaining({ name: "codex", status: "removed" }),
|
||||
);
|
||||
expect(await readFile(configPath, "utf8")).toBe(original);
|
||||
});
|
||||
});
|
||||
|
||||
describe("client configuration filesystem removal", () => {
|
||||
it("uninstalls only owned entries and refuses purge symlinks", async () => {
|
||||
const home = await createTestTempDirectory("rea-uninstall-");
|
||||
|
||||
Reference in New Issue
Block a user