mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-07 14:06:42 +02:00
fix: address adversarial review findings — codex review cwd, test scope, fail-loud
1. codex review commands now cd to $_REPO_ROOT (review doesn't support -C) 2. Autoplan codex commands converted from prose "Prerequisite" to fenced bash blocks 3. || pwd fallback replaced with hard fail — silent wrong-dir is worse than error 4. Regression test now scans all resolver .ts files + generated SKILL.md files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1648,17 +1648,20 @@ describe('telemetry', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('codex exec -C must use $_REPO_ROOT, not inline $(git rev-parse)', () => {
|
||||
describe('codex commands must not use inline $(git rev-parse --show-toplevel) for cwd', () => {
|
||||
// Regression test: inline $(git rev-parse --show-toplevel) in codex exec -C
|
||||
// evaluates in whatever cwd the background shell inherits, which may be a
|
||||
// different project in Conductor workspaces. The fix is to resolve _REPO_ROOT
|
||||
// eagerly at the top of each bash block.
|
||||
// or codex review without cd evaluates in whatever cwd the background shell
|
||||
// inherits, which may be a different project in Conductor workspaces.
|
||||
// The fix is to resolve _REPO_ROOT eagerly at the top of each bash block.
|
||||
|
||||
// Scan all source files that could contain codex commands
|
||||
const sourceFiles = [
|
||||
...fs.readdirSync(ROOT, { recursive: true })
|
||||
.filter((f): f is string => typeof f === 'string' && f.endsWith('.tmpl') && !f.includes('node_modules')),
|
||||
'scripts/resolvers/review.ts',
|
||||
'scripts/resolvers/design.ts',
|
||||
...fs.readdirSync(path.join(ROOT, 'scripts/resolvers'))
|
||||
.filter(f => f.endsWith('.ts'))
|
||||
.map(f => `scripts/resolvers/${f}`),
|
||||
'scripts/gen-skill-docs.ts',
|
||||
];
|
||||
|
||||
test('no codex exec command uses inline $(git rev-parse --show-toplevel) in -C flag', () => {
|
||||
@@ -1677,4 +1680,27 @@ describe('codex exec -C must use $_REPO_ROOT, not inline $(git rev-parse)', () =
|
||||
}
|
||||
expect(violations).toEqual([]);
|
||||
});
|
||||
|
||||
test('no generated SKILL.md has codex exec with inline $(git rev-parse --show-toplevel) in -C flag', () => {
|
||||
const violations: string[] = [];
|
||||
const skillMdFiles = fs.readdirSync(ROOT, { recursive: true })
|
||||
.filter((f): f is string =>
|
||||
typeof f === 'string' &&
|
||||
f.endsWith('SKILL.md') &&
|
||||
!f.includes('node_modules') &&
|
||||
!f.includes('.tmpl'));
|
||||
for (const rel of skillMdFiles) {
|
||||
const abs = path.join(ROOT, rel);
|
||||
if (!fs.existsSync(abs)) continue;
|
||||
const content = fs.readFileSync(abs, 'utf-8');
|
||||
const lines = content.split('\n');
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
if (line.includes('codex exec') && line.includes('-C') && line.includes('$(git rev-parse --show-toplevel)')) {
|
||||
violations.push(`${rel}:${i + 1}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
expect(violations).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user