Skip to content

Commit a76ed36

Browse files
committed
Fix codebase-memory readiness query cwd
1 parent d0b0e4c commit a76ed36

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

.github/workflows/contextbench-ci-recovery-master.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ jobs:
9898
});
9999
return {
100100
command: [command, ...args].join(' '),
101+
cwd: options.cwd ?? process.cwd(),
101102
status: result.status,
102103
signal: result.signal,
103104
error: result.error?.message ?? null,
@@ -178,18 +179,27 @@ jobs:
178179
mkdirSync(runDir, { recursive: true });
179180
const env = { ...process.env, CBM_CACHE_DIR: join(runDir, 'cbm-cache'), CBM_DIAGNOSTICS: '1' };
180181
const query = makeQuery(task.problem_statement);
182+
const firstTerm = query.split(/\s+/).find(Boolean) || 'TODO';
183+
const toolOptions = { env, cwd: task.repo_checkout_path, timeoutMs: 120_000 };
181184
const setup = run(cbmBin, ['--version'], { env, timeoutMs: 60_000 });
182-
const indexRun = run(cbmBin, ['cli', 'index_repository', JSON.stringify({ repo_path: task.repo_checkout_path })], { env, timeoutMs: 45 * 60 * 1000 });
183-
const listProjects = runCandidates('list_projects', [['cli', '--raw', 'list_projects'], ['cli', 'list_projects'], ['cli', 'list_projects', '{}']], { env, timeoutMs: 120_000 });
184-
const graphSchema = runCandidates('get_graph_schema', [['cli', '--raw', 'get_graph_schema'], ['cli', 'get_graph_schema'], ['cli', 'get_graph_schema', '{}']], { env, timeoutMs: 120_000 });
185-
const graphSearch = runCandidates('search_graph', [['cli', '--raw', 'search_graph', JSON.stringify({ label: 'Function', limit: 25 })], ['cli', 'search_graph', JSON.stringify({ label: 'Function', limit: 25 })]], { env, timeoutMs: 120_000 });
186-
const codeSearch = runCandidates('search_code', [['cli', '--raw', 'search_code', JSON.stringify({ query, limit: 25 })], ['cli', 'search_code', JSON.stringify({ query, limit: 25 })]], { env, timeoutMs: 120_000 });
185+
const indexRun = run(cbmBin, ['cli', 'index_repository', JSON.stringify({ repo_path: task.repo_checkout_path })], { env, cwd: task.repo_checkout_path, timeoutMs: 45 * 60 * 1000 });
186+
const listProjects = runCandidates('list_projects', [['cli', '--raw', 'list_projects'], ['cli', 'list_projects'], ['cli', 'list_projects', '{}']], toolOptions);
187+
const graphSchema = runCandidates('get_graph_schema', [['cli', '--raw', 'get_graph_schema'], ['cli', 'get_graph_schema'], ['cli', 'get_graph_schema', '{}']], toolOptions);
188+
const graphSearch = runCandidates('search_graph', [['cli', '--raw', 'search_graph', JSON.stringify({ label: 'Function', limit: 25 })], ['cli', 'search_graph', JSON.stringify({ label: 'Function', limit: 25 })]], toolOptions);
189+
const codeSearch = runCandidates('search_code', [
190+
['cli', '--raw', 'search_code', JSON.stringify({ pattern: query, limit: 25 })],
191+
['cli', 'search_code', JSON.stringify({ pattern: query, limit: 25 })],
192+
['cli', 'search_code', JSON.stringify({ pattern: firstTerm, limit: 25 })],
193+
['cli', 'search_code', JSON.stringify({ query, limit: 25 })]
194+
], toolOptions);
187195
188196
const spans = new Map();
189-
for (const text of [codeSearch.stdout, graphSearch.stdout, graphSchema.stdout, listProjects.stdout]) {
190-
const parsed = parseJsonish(text);
191-
if (parsed) collectSpans(parsed, spans);
192-
collectTextSpans(text, spans);
197+
for (const result of [codeSearch, graphSearch, graphSchema, listProjects]) {
198+
for (const text of [result.stdout, result.stderr]) {
199+
const parsed = parseJsonish(text);
200+
if (parsed) collectSpans(parsed, spans);
201+
collectTextSpans(text, spans);
202+
}
193203
}
194204
const predFiles = [...spans.keys()].slice(0, 20);
195205
const predSpans = Object.fromEntries([...spans.entries()].slice(0, 20));
@@ -227,6 +237,7 @@ jobs:
227237
laneIsolation: {
228238
allowedTool: 'codebase-memory-mcp',
229239
observedCommands: [setup.command, indexRun.command, listProjects.command, graphSchema.command, graphSearch.command, codeSearch.command],
240+
observedCwds: [setup.cwd, indexRun.cwd, listProjects.cwd, graphSchema.cwd, graphSearch.cwd, codeSearch.cwd],
230241
disallowedNativeReadSearchUsedForPrediction: false,
231242
note: 'Prediction spans are derived only from codebase-memory-mcp CLI outputs.'
232243
},

0 commit comments

Comments
 (0)