Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

fix(init): an inline Codex table prints the exact block [A9,I1]

Corey Olson7f5f9b08c602
diff --git a/src/init-finish.js b/src/init-finish.js
index 5b7e3ab7..9243ea2c 100644
--- a/src/init-finish.js
+++ b/src/init-finish.js
@@ -26,6 +26,7 @@ import {
tryGit,
} from './git.js';
import { loadConfig } from './config.js';
+import { CODEX_MANUAL_NOTE, mcpSetup } from './init.js';
import {
alreadyAddedLine,
initWaitingRows,
@@ -211,7 +212,7 @@ export function reportInitSetup(io, info, notes, landed, { verbose = false } = {
const waiting = landed.length ? initWaitingRows(info.root, { rows: fresh.flatMap(added => added.rows) }) : [];
/** Give each blueprint the same complete list of still-undecided rows. */
const blueprintResult = added => ({ ...initBlueprintResult(added), marked: added.marked, waitingRows: waiting });
- const result = { root: info.root, notes, proposedLanes: proposeLanes(info.root),
+ const result = { root: info.root, notes, proposedLanes: proposeLanes(info.root), mcp: mcpSetup(notes),
...(landed.length ? { blueprint: blueprintResult(landed[0]), blueprints: landed.map(blueprintResult) } : {}) };
io.result?.(result);
const staging = notes.at(-1)?.startsWith('git add -f -- ') ? notes.at(-1) : null;
@@ -220,6 +221,9 @@ export function reportInitSetup(io, info, notes, landed, { verbose = false } = {
const missingGate = notes.find(note => note.startsWith('gate command "'));
if (missingGate) io.say(missingGate.split(';')[0] + '.');
if (landed.length) io.say(`Blueprints: ${landed.length}; ${waiting.length} rows waiting for a decision.`);
+ // Codex needs the person when its config writes mcp_servers inline: the exact block shows even without --verbose (#961).
+ const codexManual = notes.find(note => note.startsWith(CODEX_MANUAL_NOTE));
+ if (codexManual) io.say(codexManual);
return { result, staging };
}
io.say('Setup details:');
diff --git a/src/init.js b/src/init.js
index c0a2df4a..a4838aea 100644
--- a/src/init.js
+++ b/src/init.js
@@ -514,6 +514,27 @@ export function codexMcpServersInline(contents) {
return false;
}
+/** The one [mcp_servers.pullboard] block init writes, or prints for the person when it cannot write it (#961). */
+export const CODEX_MCP_BLOCK = `[mcp_servers.pullboard]\ncommand = "sh"\nargs = ["-c", ${JSON.stringify(MCP_COMMAND)}]`;
+
+/** How a note begins when Codex needs the person: an inline mcp_servers table that init leaves byte-identical. */
+export const CODEX_MANUAL_NOTE = 'kept .codex/config.toml as written: its mcp_servers is an inline table, which TOML cannot extend from outside it.';
+
+/**
+ * How init left each client's MCP server, read from its notes: added, kept (already there), or manual (the person adds
+ * it). --json reports this so a script can tell a Codex setup that needs the person (#961).
+ *
+ * @param {string[]} notes
+ * @returns {{ claude: 'added'|'kept'|'manual', codex: 'added'|'kept'|'manual' }}
+ */
+export function mcpSetup(notes) {
+ const has = (start) => notes.some((note) => note.startsWith(start));
+ return {
+ claude: has('added pullboard mcp to .mcp.json') ? 'added' : has('kept the Claude Code MCP server') ? 'kept' : 'manual',
+ codex: has(CODEX_MANUAL_NOTE) ? 'manual' : has('added pullboard mcp to .codex/config.toml') ? 'added' : 'kept',
+ };
+}
+
/**
* Register pullboard mcp for Claude Code (.mcp.json) and Codex (.codex/config.toml), merging with any servers already
* there and never replacing a pullboard entry or a file it cannot read, so an agent can work the loop through MCP (#961).
@@ -546,11 +567,11 @@ function writeMcpConfig(root, onWrite) {
notes.push('kept the Codex MCP server in .codex/config.toml');
} else if (codexMcpServersInline(contents)) {
// Rewriting the person's inline table would change bytes they wrote; they add the entry where TOML allows it.
- notes.push(`kept .codex/config.toml, whose mcp_servers is an inline table; add pullboard = { command = "sh", args = ["-c", ${JSON.stringify(MCP_COMMAND)}] } inside it so Codex runs pullboard mcp`);
+ notes.push(`${CODEX_MANUAL_NOTE} To run pullboard mcp in Codex, move those servers into [mcp_servers.<name>] tables, then add:\n${CODEX_MCP_BLOCK}`);
} else {
// A new table at the end is valid TOML after any existing content, so nothing already there is rewritten.
const prefix = contents && !contents.endsWith('\n') ? `${contents}\n` : contents;
- const table = `${prefix ? `${prefix}\n` : ''}[mcp_servers.pullboard]\ncommand = "sh"\nargs = ["-c", ${JSON.stringify(MCP_COMMAND)}]\n`;
+ const table = `${prefix ? `${prefix}\n` : ''}${CODEX_MCP_BLOCK}\n`;
mkdirSync(join(root, '.codex'), { recursive: true });
writeFileSync(codex, table);
onWrite('.codex/config.toml');
diff --git a/src/json.js b/src/json.js
index 3a77b6ba..b3eb10d9 100644
--- a/src/json.js
+++ b/src/json.js
@@ -15,7 +15,7 @@ export const JSON_SHAPES = {
commands: {
help: shape({ help: 'string' }),
version: shape({ release: 'string' }),
- init: shape({ root: 'string', notes: 'array', proposedLanes: 'array' }),
+ init: shape({ root: 'string', notes: 'array', proposedLanes: 'array', mcp: 'object' }),
hooks: shape({ notes: 'array' }),
join: shape({ agent: 'string', lane: 'string', route: 'string', path: 'string', model: 'string', displayName: 'string' }),
takeover: shape({ agent: 'string', path: 'string' }),
diff --git a/test/init-permissions.test.js b/test/init-permissions.test.js
index 99bdaf6e..37d8f58f 100644
--- a/test/init-permissions.test.js
+++ b/test/init-permissions.test.js
@@ -224,8 +224,8 @@ test('init keeps an existing Codex pullboard server in any TOML form and adds no
assert.match(after.slice(other.length), /^\n\[mcp_servers\.pullboard\]\ncommand = "sh"\n/u, 'the pullboard server is appended once');
});
-test('init leaves an inline mcp_servers table as written and names the entry to add [A9,I1]', (t) => {
- // TOML never adds to an inline table, so appending [mcp_servers.pullboard] after one makes the file invalid.
+test('init leaves an inline mcp_servers table as written, prints the exact block and marks Codex manual [A9,I1]', (t) => {
+ // TOML never adds to an inline table from outside it, so init writes nothing and the person adds the block.
for (const existing of ['mcp_servers = { other = { command = "other-server", args = ["serve"] } }\n', 'mcp_servers = {}\n']) {
const box = initFixture(t);
mkdirSync(join(box.root, '.codex'), { recursive: true });
@@ -233,8 +233,20 @@ test('init leaves an inline mcp_servers table as written and names the entry to
const initialized = box.init();
assert.equal(initialized.code, 0, initialized.stderr);
assert.equal(readFileSync(join(box.root, '.codex', 'config.toml'), 'utf8'), existing, 'the inline table is byte for byte as it was');
- const note = initialized.document.notes.find(entry => entry.startsWith('kept .codex/config.toml, whose mcp_servers is an inline table'));
+ assert.equal(initialized.document.mcp.codex, 'manual', '--json marks Codex as manual');
+ assert.equal(initialized.document.mcp.claude, 'added');
+ const note = initialized.document.notes.find(entry => entry.startsWith('kept .codex/config.toml as written: its mcp_servers is an inline table'));
assert.ok(note, 'init says why it kept the file');
- assert.match(note, /add pullboard = \{ command = "sh", args = \["-c", "[^\n]+"\] \} inside it/u, 'and names the exact entry to add');
+ assert.match(note, /\n\[mcp_servers\.pullboard\]\ncommand = "sh"\nargs = \["-c", "[^\n]+"\]$/u, 'and prints the one exact block to add');
}
+ // The plain command prints the block too, without --verbose.
+ const box = initFixture(t);
+ mkdirSync(join(box.root, '.codex'), { recursive: true });
+ writeFileSync(join(box.root, '.codex', 'config.toml'), 'mcp_servers = {}\n');
+ const plain = runFixtureChild(process.execPath, [BIN, 'init'], { cwd: box.root, env: box.env, encoding: 'utf8' });
+ assert.equal(plain.status, 0, plain.stderr);
+ assert.match(plain.stdout, /\[mcp_servers\.pullboard\]\ncommand = "sh"\nargs = \["-c", /u, 'the plain output shows the block');
+ // A config init can extend says added.
+ const ordinary = initFixture(t);
+ assert.equal(ordinary.init().document.mcp.codex, 'added');
});