From bc3d6db1c0cb117a10f4223f635847d710a19280 Mon Sep 17 00:00:00 2001 From: Artspark <77367116+artsparkAI@users.noreply.github.com> Date: Thu, 12 Mar 2026 10:36:04 -0700 Subject: [PATCH] fix: emit valid codex agent TOML (#1008) --- bin/install.js | 6 ++++-- tests/codex-config.test.cjs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/install.js b/bin/install.js index b7f11e4cf..4d297d2a1 100755 --- a/bin/install.js +++ b/bin/install.js @@ -563,9 +563,11 @@ function generateCodexAgentToml(agentName, agentContent) { const lines = [ `sandbox_mode = "${sandboxMode}"`, - `developer_instructions = """`, + // Agent prompts contain raw backslashes in regexes and shell snippets. + // TOML literal multiline strings preserve them without escape parsing. + `developer_instructions = '''`, instructions, - `"""`, + `'''`, ]; return lines.join('\n') + '\n'; } diff --git a/tests/codex-config.test.cjs b/tests/codex-config.test.cjs index 758eedc84..58fe10e03 100644 --- a/tests/codex-config.test.cjs +++ b/tests/codex-config.test.cjs @@ -155,9 +155,9 @@ tools: Read, Grep, Glob test('includes developer_instructions from body', () => { const result = generateCodexAgentToml('gsd-executor', sampleAgent); - assert.ok(result.includes('developer_instructions = """'), 'has triple-quoted instructions'); + assert.ok(result.includes("developer_instructions = '''"), 'has literal triple-quoted instructions'); assert.ok(result.includes('You are an executor.'), 'body content in instructions'); - assert.ok(result.includes('"""'), 'has closing triple quotes'); + assert.ok(result.includes("'''"), 'has closing literal triple quotes'); }); test('defaults unknown agents to read-only', () => {