Skip to content

Commit 1fd9f10

Browse files
committed
fix: run discussion codex outside git repos
1 parent 34cc8f5 commit 1fd9f10

6 files changed

Lines changed: 22 additions & 4 deletions

File tree

__tests__/unit/discussion/codex-responder.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe('CodexDiscussionResponder', () => {
4747
expect.objectContaining({
4848
includeWorkspaceEnv: false,
4949
eventAudit: false,
50+
skipGitRepoCheck: true,
5051
})
5152
);
5253
});

__tests__/unit/providers/codex-provider.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ describe('CodexProvider', () => {
6868
outputLastMessageFile: '/tmp/codex-output.txt',
6969
outputSchemaFile: '/tmp/codex-schema.json',
7070
disableTools: true,
71+
skipGitRepoCheck: true,
7172
});
7273

7374
expect(args).toEqual(
@@ -78,6 +79,7 @@ describe('CodexProvider', () => {
7879
'browser_use',
7980
'computer_use',
8081
'plugins',
82+
'--skip-git-repo-check',
8183
])
8284
);
8385
});
@@ -336,6 +338,7 @@ describe('CodexProvider', () => {
336338
'plugins',
337339
])
338340
);
341+
expect(execCall?.[1]).not.toContain('--skip-git-repo-check');
339342
} finally {
340343
fs.rmSync(cwd, { recursive: true, force: true });
341344
}

dist/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13260,7 +13260,8 @@ var CodexProvider = class extends Provider {
1326013260
eventAudit: options.eventAudit,
1326113261
cwd: options.cwd,
1326213262
includeWorkspaceEnv: options.includeWorkspaceEnv,
13263-
disableTools: true
13263+
disableTools: true,
13264+
skipGitRepoCheck: options.skipGitRepoCheck
1326413265
}
1326513266
);
1326613267
const content = this.sanitizeReviewContent((lastMessage || stdout).trim());
@@ -13315,6 +13316,9 @@ var CodexProvider = class extends Provider {
1331513316
"plugins"
1331613317
);
1331713318
}
13319+
if (options.skipGitRepoCheck) {
13320+
args.push("--skip-git-repo-check");
13321+
}
1331813322
if (options.outputSchemaFile) {
1331913323
args.push("--output-schema", options.outputSchemaFile);
1332013324
}
@@ -27795,7 +27799,8 @@ var CodexDiscussionResponder = class {
2779527799
{
2779627800
cwd,
2779727801
eventAudit: false,
27798-
includeWorkspaceEnv: false
27802+
includeWorkspaceEnv: false,
27803+
skipGitRepoCheck: true
2779927804
}
2780027805
);
2780127806
return this.parse(content);

dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/discussion/codex-responder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class CodexDiscussionResponder implements DiscussionResponder {
4646
cwd,
4747
eventAudit: false,
4848
includeWorkspaceEnv: false,
49+
skipGitRepoCheck: true,
4950
}
5051
);
5152
return this.parse(content);

src/providers/codex.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type CodexRunOptions = {
2121
cwd?: string;
2222
includeWorkspaceEnv?: boolean;
2323
disableTools?: boolean;
24+
skipGitRepoCheck?: boolean;
2425
};
2526

2627
type CodexRunResult = {
@@ -157,6 +158,7 @@ export class CodexProvider extends Provider {
157158
cwd?: string;
158159
eventAudit?: boolean;
159160
includeWorkspaceEnv?: boolean;
161+
skipGitRepoCheck?: boolean;
160162
} = {}
161163
): Promise<string> {
162164
const binary = await this.resolveBinary();
@@ -171,6 +173,7 @@ export class CodexProvider extends Provider {
171173
cwd: options.cwd,
172174
includeWorkspaceEnv: options.includeWorkspaceEnv,
173175
disableTools: true,
176+
skipGitRepoCheck: options.skipGitRepoCheck,
174177
}
175178
);
176179
const content = this.sanitizeReviewContent((lastMessage || stdout).trim());
@@ -199,6 +202,7 @@ export class CodexProvider extends Provider {
199202
outputSchemaFile?: string;
200203
eventAudit?: boolean;
201204
disableTools?: boolean;
205+
skipGitRepoCheck?: boolean;
202206
}): string[] {
203207
// The top-level `codex` command starts the interactive TUI and fails in CI.
204208
const args = [
@@ -237,6 +241,10 @@ export class CodexProvider extends Provider {
237241
);
238242
}
239243

244+
if (options.skipGitRepoCheck) {
245+
args.push('--skip-git-repo-check');
246+
}
247+
240248
if (options.outputSchemaFile) {
241249
args.push('--output-schema', options.outputSchemaFile);
242250
}

0 commit comments

Comments
 (0)