Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/sdk/src/adapters/codex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ export const codexAdapter: HeadlessAdapter = {
buildAgentInvocation(instruction: string, model?: string): CliInvocation {
return {
args: [
'exec', '--ephemeral', '--skip-git-repo-check',
// Real steps must retain Codex's native session under CODEX_HOME (or
// ~/.codex). Hosted Relayflow teardown captures that provider history
// and uploads it to Relayhistory; --ephemeral silently leaves nothing
// for the bounded flush to capture. Readiness probes above stay
// ephemeral because they are diagnostics, not workflow steps.
'exec', '--skip-git-repo-check',
// Agent-mode is where the flow explicitly delegates code changes to
// the CLI. Without this flag codex prompts for approval on every
// write, gets nothing (no TTY), and completes "successfully" without
Expand All @@ -54,7 +59,7 @@ export const codexAdapter: HeadlessAdapter = {

buildLlmInvocation(prompt: string, model?: string): CliInvocation {
return {
args: ['exec', '--ephemeral', '--sandbox', 'read-only', '--skip-git-repo-check',
args: ['exec', '--sandbox', 'read-only', '--skip-git-repo-check',
...(model === undefined ? [] : ['--model', model]), prompt],
timeoutMs: 0,
};
Expand Down
7 changes: 4 additions & 3 deletions packages/sdk/tests/adapters/codex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ describe('codexAdapter — HeadlessAdapter contract', () => {
expect(inv.args).toContain('gpt-6-astra');
});

it('buildAgentInvocation uses exec --ephemeral --skip-git-repo-check with instruction at the tail', () => {
it('buildAgentInvocation persists provider history and keeps the instruction at the tail', () => {
const inv = codexAdapter.buildAgentInvocation('build the thing', 'gpt-6-astra');
expect(inv.args[0]).toBe('exec');
expect(inv.args).toContain('--ephemeral');
expect(inv.args).not.toContain('--ephemeral');
expect(inv.args).toContain('--skip-git-repo-check');
expect(inv.args).toContain('--model');
expect(inv.args).toContain('gpt-6-astra');
Expand All @@ -44,8 +44,9 @@ describe('codexAdapter — HeadlessAdapter contract', () => {
expect(inv.args).not.toContain('--sandbox');
});

it('buildLlmInvocation adds --sandbox read-only', () => {
it('buildLlmInvocation persists provider history in its read-only sandbox', () => {
const inv = codexAdapter.buildLlmInvocation('summarize');
expect(inv.args).not.toContain('--ephemeral');
expect(inv.args).toContain('--sandbox');
expect(inv.args).toContain('read-only');
});
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/tests/cli-adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('typed CLI adapters', () => {
timeoutMs: 60_000,
});
expect(agentExecution(kind, 'Review.', 'gpt-model')).toEqual({
args: ['exec', '--ephemeral', '--skip-git-repo-check', '--dangerously-bypass-approvals-and-sandbox',
args: ['exec', '--skip-git-repo-check', '--dangerously-bypass-approvals-and-sandbox',
'--model', 'gpt-model', 'Review.'],
timeoutMs: 0,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/tests/live-kernel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ process.stdout.write('{"must_not":"execute"}');

it.each([
['claude', '-p --dangerously-skip-permissions --model declared-model-xyz'],
['codex', 'exec --ephemeral --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox --model declared-model-xyz'],
['codex', 'exec --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox --model declared-model-xyz'],
] as const)('AgentWorker executes the raw %s adapter with its real model flag', async (name, prefix) => {
const dataDir = temporaryDirectory(`flows-live-${name}-adapter-`);
await startDaemon(dataDir);
Expand Down
Loading