homegraph 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +305 -305
- package/dist/bin/command-supervision.d.ts.map +1 -1
- package/dist/bin/command-supervision.js +7 -4
- package/dist/bin/command-supervision.js.map +1 -1
- package/dist/bin/homegraph.js +9 -9
- package/dist/db/index.js +36 -36
- package/dist/db/migrations.js +37 -37
- package/dist/db/queries.js +156 -156
- package/dist/db/schema.sql +203 -203
- package/dist/directory.js +5 -5
- package/dist/extraction/languages/arkts-viewtree.d.ts +2 -4
- package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.js +6 -21
- package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +16 -6
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +174 -21
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/dist/installer/instructions-template.js +9 -9
- package/dist/mcp/liveness-watchdog.d.ts +18 -0
- package/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/dist/mcp/liveness-watchdog.js +185 -73
- package/dist/mcp/liveness-watchdog.js.map +1 -1
- package/dist/mcp/server-instructions.js +47 -47
- package/dist/reasoning/reasoner.js +32 -32
- package/dist/spec/db/commit-node.js +4 -4
- package/dist/spec/db/fragment-node.js +10 -10
- package/dist/spec/db/fts.js +8 -8
- package/dist/spec/db/relations.js +88 -88
- package/dist/spec/db/schema.js +6 -6
- package/dist/spec/db/schema.sql +121 -121
- package/dist/spec/db/spec-node.js +4 -4
- package/dist/spec/llm/prompts.js +53 -53
- package/dist/spec/utils.d.ts +16 -4
- package/dist/spec/utils.d.ts.map +1 -1
- package/dist/spec/utils.js +58 -6
- package/dist/spec/utils.js.map +1 -1
- package/package.json +62 -62
- package/scripts/_tmp-cfwk-resolve.log +0 -0
- package/scripts/_tmp-cfwk-sig.log +0 -0
- package/scripts/_tmp-cfwk-vt.log +0 -0
- package/scripts/add-lang/bench.sh +60 -60
- package/scripts/add-lang/check-grammar.mjs +75 -75
- package/scripts/add-lang/dump-ast.mjs +103 -103
- package/scripts/add-lang/verify-extraction.mjs +70 -70
- package/scripts/agent-eval/ab-adoption.sh +91 -91
- package/scripts/agent-eval/ab-hook.sh +86 -86
- package/scripts/agent-eval/ab-impl.sh +78 -78
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -102
- package/scripts/agent-eval/ab-sufficiency.sh +78 -78
- package/scripts/agent-eval/arms-F.sh +21 -21
- package/scripts/agent-eval/arms-matrix.sh +37 -37
- package/scripts/agent-eval/audit.sh +68 -68
- package/scripts/agent-eval/bench-readme.sh +28 -28
- package/scripts/agent-eval/bench-why-repo.sh +22 -22
- package/scripts/agent-eval/block-read-hook.sh +19 -19
- package/scripts/agent-eval/hook-settings.json +15 -15
- package/scripts/agent-eval/itrun.sh +120 -120
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -72
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -133
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -108
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -25
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -47
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -18
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -84
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -103
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -20
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -94
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -50
- package/scripts/agent-eval/offload-eval-setup.sh +24 -24
- package/scripts/agent-eval/offload-eval-styles.sh +71 -71
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -68
- package/scripts/agent-eval/offload-eval.md +76 -76
- package/scripts/agent-eval/parse-arms.mjs +116 -116
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -84
- package/scripts/agent-eval/parse-run.mjs +45 -45
- package/scripts/agent-eval/parse-session.mjs +93 -93
- package/scripts/agent-eval/probe-context.mjs +21 -21
- package/scripts/agent-eval/probe-explore.mjs +40 -40
- package/scripts/agent-eval/probe-node.mjs +20 -20
- package/scripts/agent-eval/probe-sweep.mjs +119 -119
- package/scripts/agent-eval/probe-trace.mjs +20 -20
- package/scripts/agent-eval/redirect-read-hook.sh +38 -38
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -119
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -125
- package/scripts/agent-eval/run-agent.sh +34 -34
- package/scripts/agent-eval/run-all.sh +75 -75
- package/scripts/agent-eval/run-arms.sh +56 -56
- package/scripts/agent-eval/seq-matrix.mjs +137 -137
- package/scripts/bench-arkts-init-rss.log +0 -0
- package/scripts/build-bundle.sh +123 -123
- package/scripts/exp_boundary_eval/README.md +247 -247
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/win_mcp_launcher.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -78
- package/scripts/exp_boundary_eval/_test_stdin.py +8 -8
- package/scripts/exp_boundary_eval/_utils.py +1116 -1116
- package/scripts/exp_boundary_eval/analyze.py +1313 -1313
- package/scripts/exp_boundary_eval/deveco_arm.py +519 -519
- package/scripts/exp_boundary_eval/run_all.py +378 -378
- package/scripts/exp_boundary_eval/run_one.py +165 -165
- package/scripts/exp_boundary_eval/run_session.py +158 -158
- package/scripts/exp_boundary_eval/setup.py +120 -120
- package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -73
- package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -36
- package/scripts/exp_boundary_eval/win_node_launcher.py +24 -24
- package/scripts/extract-release-notes.mjs +130 -130
- package/scripts/local-install.sh +41 -41
- package/scripts/npm-sdk.js +75 -75
- package/scripts/npm-shim.js +275 -275
- package/scripts/ohos-sdk-publish.mjs +133 -133
- package/scripts/pack-npm.sh +119 -119
- package/scripts/prepare-release.mjs +270 -270
- package/scripts/probe-arkts-mem-why-run.log +0 -0
- package/scripts/probe-banner-livecard-ir.log +0 -0
- package/scripts/probe-cfwk-ast.stderr.log +0 -0
- package/scripts/probe-cfwk-ast.stdout.log +0 -0
- package/scripts/probe-cfwk-attr-shape.log +0 -0
- package/scripts/probe-cfwk-cfgdump.stderr.log +0 -0
- package/scripts/probe-cfwk-cfgdump.stdout.log +0 -0
- package/scripts/probe-cfwk-cvc.stderr.log +0 -0
- package/scripts/probe-cfwk-cvc.stdout.log +0 -0
- package/scripts/probe-cfwk-diag2.log +0 -0
- package/scripts/probe-cfwk-diag3.log +0 -0
- package/scripts/probe-cfwk-fedbg.stderr.log +0 -0
- package/scripts/probe-cfwk-fedbg.stdout.log +0 -0
- package/scripts/probe-cfwk-fileresult.log +0 -0
- package/scripts/probe-cfwk-fix.stderr.log +0 -0
- package/scripts/probe-cfwk-fix.stdout.log +0 -0
- package/scripts/probe-cfwk-fix2.stderr.log +0 -0
- package/scripts/probe-cfwk-fix2.stdout.log +0 -0
- package/scripts/probe-cfwk-fix3.stderr.log +0 -0
- package/scripts/probe-cfwk-fix3.stdout.log +0 -0
- package/scripts/probe-cfwk-foreach.log +0 -0
- package/scripts/probe-cfwk-getmethod-throw.log +0 -0
- package/scripts/probe-cfwk-hg-extract.log +0 -0
- package/scripts/probe-cfwk-pr1003-noprior.stderr.log +0 -0
- package/scripts/probe-cfwk-pr1003-noprior.stdout.log +0 -0
- package/scripts/probe-cfwk-pr1003.stderr.log +0 -0
- package/scripts/probe-cfwk-pr1003.stdout.log +0 -0
- package/scripts/probe-cfwk-preroot-noprior.stderr.log +0 -0
- package/scripts/probe-cfwk-preroot-noprior.stdout.log +0 -0
- package/scripts/probe-cfwk-preroot-prior.stderr.log +0 -0
- package/scripts/probe-cfwk-preroot-prior.stdout.log +0 -0
- package/scripts/probe-cfwk-preroot-skipstate.stderr.log +0 -0
- package/scripts/probe-cfwk-preroot-skipstate.stdout.log +0 -0
- package/scripts/probe-cfwk-resolve-sim.log +0 -0
- package/scripts/probe-cfwk-tree-shape.log +0 -0
- package/scripts/probe-cfwk-walk-abort.log +0 -0
- package/scripts/probe-cfwk.log +0 -0
- package/scripts/probe-force-index.log +0 -0
- package/scripts/probe-no-force-index.log +0 -0
- package/scripts/probe-samefile-ir.stderr.log +0 -0
- package/scripts/probe-samefile-ir.stdout.log +224 -0
- package/scripts/probe-sdk-vs-project.log +0 -0
- package/scripts/probe-viewtree-downgrade.log +0 -0
- package/dist/arkts/ohos-api-index.d.ts +0 -15
- package/dist/arkts/ohos-api-index.d.ts.map +0 -1
- package/dist/arkts/ohos-api-index.js +0 -190
- package/dist/arkts/ohos-api-index.js.map +0 -1
- package/dist/arkts/ohos-sdk-input.d.ts +0 -36
- package/dist/arkts/ohos-sdk-input.d.ts.map +0 -1
- package/dist/arkts/ohos-sdk-input.js +0 -214
- package/dist/arkts/ohos-sdk-input.js.map +0 -1
- package/dist/extraction/languages/arkts-state-decorators.d.ts +0 -13
- package/dist/extraction/languages/arkts-state-decorators.d.ts.map +0 -1
- package/dist/extraction/languages/arkts-state-decorators.js +0 -26
- package/dist/extraction/languages/arkts-state-decorators.js.map +0 -1
- package/dist/extraction/languages/ohos-api-consumer.d.ts +0 -34
- package/dist/extraction/languages/ohos-api-consumer.d.ts.map +0 -1
- package/dist/extraction/languages/ohos-api-consumer.js +0 -283
- package/dist/extraction/languages/ohos-api-consumer.js.map +0 -1
- package/dist/spec/build/git-scanner.d.ts +0 -93
- package/dist/spec/build/git-scanner.d.ts.map +0 -1
- package/dist/spec/build/git-scanner.js +0 -254
- package/dist/spec/build/git-scanner.js.map +0 -1
- package/dist/spec/git-utils.d.ts +0 -8
- package/dist/spec/git-utils.d.ts.map +0 -1
- package/dist/spec/git-utils.js +0 -14
- package/dist/spec/git-utils.js.map +0 -1
- package/dist/spec/mine/clusterer.d.ts +0 -63
- package/dist/spec/mine/clusterer.d.ts.map +0 -1
- package/dist/spec/mine/clusterer.js +0 -904
- package/dist/spec/mine/clusterer.js.map +0 -1
- package/dist/spec/mine/progress-handler.d.ts +0 -22
- package/dist/spec/mine/progress-handler.d.ts.map +0 -1
- package/dist/spec/mine/progress-handler.js +0 -108
- package/dist/spec/mine/progress-handler.js.map +0 -1
- package/dist/spec/mine/progress.d.ts +0 -23
- package/dist/spec/mine/progress.d.ts.map +0 -1
- package/dist/spec/mine/progress.js +0 -12
- package/dist/spec/mine/progress.js.map +0 -1
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Reproduction harness B — the FAITHFUL opencode scenario.
|
|
3
|
-
//
|
|
4
|
-
// Spawns N real `codegraph serve --mcp --path <repo>` processes (each becomes a
|
|
5
|
-
// proxy that attaches to ONE shared daemon — exactly what opencode does with N
|
|
6
|
-
// subagents), drives clean MCP JSON-RPC over each child's stdio, then fires ONE
|
|
7
|
-
// concurrent wave of codegraph_explore tools/call across all N and measures
|
|
8
|
-
// end-to-end latency + timeouts. This captures transport-flush starvation: a
|
|
9
|
-
// daemon event-loop blocked in synchronous explore compute can neither read the
|
|
10
|
-
// next request nor flush a finished response.
|
|
11
|
-
//
|
|
12
|
-
// Usage: node repro-daemon-clients.mjs <repo> <N=10> [perCallTimeoutMs=60000] [warm=1]
|
|
13
|
-
import { spawn } from 'node:child_process';
|
|
14
|
-
import { performance } from 'node:perf_hooks';
|
|
15
|
-
import { resolve } from 'node:path';
|
|
16
|
-
|
|
17
|
-
const [, , repoRaw, nRaw, timeoutRaw, warmRaw] = process.argv;
|
|
18
|
-
const repo = resolve(repoRaw || '.');
|
|
19
|
-
const N = Number(nRaw) || 10;
|
|
20
|
-
const TIMEOUT_MS = Number(timeoutRaw) || 60000;
|
|
21
|
-
const WARM = warmRaw === undefined ? true : warmRaw !== '0';
|
|
22
|
-
const CLI = resolve('dist/bin/codegraph.js');
|
|
23
|
-
|
|
24
|
-
const QUERIES = [
|
|
25
|
-
'how does the text model handle edits and undo',
|
|
26
|
-
'how does the file service watch for changes on disk',
|
|
27
|
-
'how does the keybinding service resolve a chord to a command',
|
|
28
|
-
'how does the extension host activate an extension',
|
|
29
|
-
'how does the editor render decorations in the viewport',
|
|
30
|
-
'how does the search service stream results to the UI',
|
|
31
|
-
'how does the terminal process manager spawn a shell',
|
|
32
|
-
'how does the configuration service merge user and workspace settings',
|
|
33
|
-
'how does the debug adapter forward breakpoints to the runtime',
|
|
34
|
-
'how does the quick input widget filter its items',
|
|
35
|
-
'how does the notification service queue and show toasts',
|
|
36
|
-
'how does the git extension compute the diff for a file',
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
function makeClient(id) {
|
|
40
|
-
const child = spawn('node', [CLI, 'serve', '--mcp', '--path', repo], {
|
|
41
|
-
env: { ...process.env, CODEGRAPH_TELEMETRY: '0', DO_NOT_TRACK: '1', CODEGRAPH_MCP_LOG_ATTACH: '0' },
|
|
42
|
-
stdio: ['pipe', 'pipe', 'inherit'],
|
|
43
|
-
});
|
|
44
|
-
let buf = '';
|
|
45
|
-
const waiters = new Map(); // id -> resolve
|
|
46
|
-
child.stdout.setEncoding('utf8');
|
|
47
|
-
child.stdout.on('data', (chunk) => {
|
|
48
|
-
buf += chunk;
|
|
49
|
-
let idx;
|
|
50
|
-
while ((idx = buf.indexOf('\n')) !== -1) {
|
|
51
|
-
const line = buf.slice(0, idx).trim();
|
|
52
|
-
buf = buf.slice(idx + 1);
|
|
53
|
-
if (!line) continue;
|
|
54
|
-
let msg; try { msg = JSON.parse(line); } catch { continue; }
|
|
55
|
-
if (msg.id !== undefined && waiters.has(msg.id)) {
|
|
56
|
-
waiters.get(msg.id)(msg);
|
|
57
|
-
waiters.delete(msg.id);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
const send = (obj) => child.stdin.write(JSON.stringify(obj) + '\n');
|
|
62
|
-
const request = (method, params, rpcId, timeoutMs) =>
|
|
63
|
-
new Promise((res) => {
|
|
64
|
-
let timer;
|
|
65
|
-
if (timeoutMs) timer = setTimeout(() => { waiters.delete(rpcId); res({ __timeout: true }); }, timeoutMs);
|
|
66
|
-
waiters.set(rpcId, (m) => { if (timer) clearTimeout(timer); res(m); });
|
|
67
|
-
send({ jsonrpc: '2.0', id: rpcId, method, params });
|
|
68
|
-
});
|
|
69
|
-
return { id, child, send, request };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
73
|
-
|
|
74
|
-
const clients = Array.from({ length: N }, (_, i) => makeClient(i));
|
|
75
|
-
|
|
76
|
-
// Initialize every client (handshake is answered locally by each proxy, instant).
|
|
77
|
-
await Promise.all(clients.map((c) =>
|
|
78
|
-
c.request('initialize', { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'repro', version: '1' } }, `init-${c.id}`, 10000)
|
|
79
|
-
.then(() => c.send({ jsonrpc: '2.0', method: 'initialized' }))
|
|
80
|
-
));
|
|
81
|
-
|
|
82
|
-
// Warm the daemon: one explore through client 0 forces daemon spawn + project
|
|
83
|
-
// open + catch-up gate to complete, so the concurrent wave measures the STEADY
|
|
84
|
-
// state (the user's real scenario after the first call), not cold start.
|
|
85
|
-
if (WARM) {
|
|
86
|
-
process.stderr.write('[repro] warming daemon (first explore triggers spawn+open+catchup)...\n');
|
|
87
|
-
const t0 = performance.now();
|
|
88
|
-
const r = await clients[0].request('tools/call', { name: 'codegraph_explore', arguments: { query: QUERIES[0] } }, 'warm-0', 120000);
|
|
89
|
-
process.stderr.write(`[repro] warm explore took ${Math.round(performance.now() - t0)}ms (timeout=${!!r.__timeout})\n`);
|
|
90
|
-
await sleep(500);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// THE WAVE: fire one explore on every client as simultaneously as possible.
|
|
94
|
-
process.stderr.write(`[repro] firing ${N} concurrent explores...\n`);
|
|
95
|
-
const waveStart = performance.now();
|
|
96
|
-
const results = await Promise.all(clients.map((c, i) => {
|
|
97
|
-
const started = performance.now();
|
|
98
|
-
return c.request('tools/call', { name: 'codegraph_explore', arguments: { query: QUERIES[i % QUERIES.length] } }, `call-${c.id}`, TIMEOUT_MS)
|
|
99
|
-
.then((m) => ({
|
|
100
|
-
id: c.id,
|
|
101
|
-
ms: Math.round(performance.now() - started),
|
|
102
|
-
timedOut: !!m.__timeout,
|
|
103
|
-
ok: !!m.result && !m.result.isError,
|
|
104
|
-
chars: m.result?.content?.[0]?.text?.length ?? 0,
|
|
105
|
-
}));
|
|
106
|
-
}));
|
|
107
|
-
const waveMs = Math.round(performance.now() - waveStart);
|
|
108
|
-
|
|
109
|
-
const lat = results.map((r) => r.ms).sort((a, b) => a - b);
|
|
110
|
-
const timeouts = results.filter((r) => r.timedOut).length;
|
|
111
|
-
const p = (q) => lat[Math.min(lat.length - 1, Math.floor(q * lat.length))];
|
|
112
|
-
|
|
113
|
-
console.log('='.repeat(64));
|
|
114
|
-
console.log(`HARNESS B (real daemon + ${N} proxies) repo=${repo}`);
|
|
115
|
-
console.log(`warm=${WARM} perCallTimeout=${TIMEOUT_MS}ms`);
|
|
116
|
-
console.log('-'.repeat(64));
|
|
117
|
-
console.log(`wave wall-clock: ${waveMs}ms`);
|
|
118
|
-
console.log(`per-call latency min=${lat[0]} p50=${p(0.5)} p90=${p(0.9)} max=${lat[lat.length - 1]} (ms)`);
|
|
119
|
-
console.log(`TIMEOUTS (>${TIMEOUT_MS}ms): ${timeouts} / ${N}`);
|
|
120
|
-
console.log(`completion order (id:ms): ${results.slice().sort((a,b)=>a.ms-b.ms).map(r=>`${r.id}:${r.ms}`).join(' ')}`);
|
|
121
|
-
console.log('='.repeat(64));
|
|
122
|
-
|
|
123
|
-
for (const c of clients) { try { c.child.stdin.end(); c.child.kill('SIGTERM'); } catch {} }
|
|
124
|
-
await sleep(300);
|
|
125
|
-
process.exit(0);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Reproduction harness B — the FAITHFUL opencode scenario.
|
|
3
|
+
//
|
|
4
|
+
// Spawns N real `codegraph serve --mcp --path <repo>` processes (each becomes a
|
|
5
|
+
// proxy that attaches to ONE shared daemon — exactly what opencode does with N
|
|
6
|
+
// subagents), drives clean MCP JSON-RPC over each child's stdio, then fires ONE
|
|
7
|
+
// concurrent wave of codegraph_explore tools/call across all N and measures
|
|
8
|
+
// end-to-end latency + timeouts. This captures transport-flush starvation: a
|
|
9
|
+
// daemon event-loop blocked in synchronous explore compute can neither read the
|
|
10
|
+
// next request nor flush a finished response.
|
|
11
|
+
//
|
|
12
|
+
// Usage: node repro-daemon-clients.mjs <repo> <N=10> [perCallTimeoutMs=60000] [warm=1]
|
|
13
|
+
import { spawn } from 'node:child_process';
|
|
14
|
+
import { performance } from 'node:perf_hooks';
|
|
15
|
+
import { resolve } from 'node:path';
|
|
16
|
+
|
|
17
|
+
const [, , repoRaw, nRaw, timeoutRaw, warmRaw] = process.argv;
|
|
18
|
+
const repo = resolve(repoRaw || '.');
|
|
19
|
+
const N = Number(nRaw) || 10;
|
|
20
|
+
const TIMEOUT_MS = Number(timeoutRaw) || 60000;
|
|
21
|
+
const WARM = warmRaw === undefined ? true : warmRaw !== '0';
|
|
22
|
+
const CLI = resolve('dist/bin/codegraph.js');
|
|
23
|
+
|
|
24
|
+
const QUERIES = [
|
|
25
|
+
'how does the text model handle edits and undo',
|
|
26
|
+
'how does the file service watch for changes on disk',
|
|
27
|
+
'how does the keybinding service resolve a chord to a command',
|
|
28
|
+
'how does the extension host activate an extension',
|
|
29
|
+
'how does the editor render decorations in the viewport',
|
|
30
|
+
'how does the search service stream results to the UI',
|
|
31
|
+
'how does the terminal process manager spawn a shell',
|
|
32
|
+
'how does the configuration service merge user and workspace settings',
|
|
33
|
+
'how does the debug adapter forward breakpoints to the runtime',
|
|
34
|
+
'how does the quick input widget filter its items',
|
|
35
|
+
'how does the notification service queue and show toasts',
|
|
36
|
+
'how does the git extension compute the diff for a file',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
function makeClient(id) {
|
|
40
|
+
const child = spawn('node', [CLI, 'serve', '--mcp', '--path', repo], {
|
|
41
|
+
env: { ...process.env, CODEGRAPH_TELEMETRY: '0', DO_NOT_TRACK: '1', CODEGRAPH_MCP_LOG_ATTACH: '0' },
|
|
42
|
+
stdio: ['pipe', 'pipe', 'inherit'],
|
|
43
|
+
});
|
|
44
|
+
let buf = '';
|
|
45
|
+
const waiters = new Map(); // id -> resolve
|
|
46
|
+
child.stdout.setEncoding('utf8');
|
|
47
|
+
child.stdout.on('data', (chunk) => {
|
|
48
|
+
buf += chunk;
|
|
49
|
+
let idx;
|
|
50
|
+
while ((idx = buf.indexOf('\n')) !== -1) {
|
|
51
|
+
const line = buf.slice(0, idx).trim();
|
|
52
|
+
buf = buf.slice(idx + 1);
|
|
53
|
+
if (!line) continue;
|
|
54
|
+
let msg; try { msg = JSON.parse(line); } catch { continue; }
|
|
55
|
+
if (msg.id !== undefined && waiters.has(msg.id)) {
|
|
56
|
+
waiters.get(msg.id)(msg);
|
|
57
|
+
waiters.delete(msg.id);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const send = (obj) => child.stdin.write(JSON.stringify(obj) + '\n');
|
|
62
|
+
const request = (method, params, rpcId, timeoutMs) =>
|
|
63
|
+
new Promise((res) => {
|
|
64
|
+
let timer;
|
|
65
|
+
if (timeoutMs) timer = setTimeout(() => { waiters.delete(rpcId); res({ __timeout: true }); }, timeoutMs);
|
|
66
|
+
waiters.set(rpcId, (m) => { if (timer) clearTimeout(timer); res(m); });
|
|
67
|
+
send({ jsonrpc: '2.0', id: rpcId, method, params });
|
|
68
|
+
});
|
|
69
|
+
return { id, child, send, request };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
73
|
+
|
|
74
|
+
const clients = Array.from({ length: N }, (_, i) => makeClient(i));
|
|
75
|
+
|
|
76
|
+
// Initialize every client (handshake is answered locally by each proxy, instant).
|
|
77
|
+
await Promise.all(clients.map((c) =>
|
|
78
|
+
c.request('initialize', { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'repro', version: '1' } }, `init-${c.id}`, 10000)
|
|
79
|
+
.then(() => c.send({ jsonrpc: '2.0', method: 'initialized' }))
|
|
80
|
+
));
|
|
81
|
+
|
|
82
|
+
// Warm the daemon: one explore through client 0 forces daemon spawn + project
|
|
83
|
+
// open + catch-up gate to complete, so the concurrent wave measures the STEADY
|
|
84
|
+
// state (the user's real scenario after the first call), not cold start.
|
|
85
|
+
if (WARM) {
|
|
86
|
+
process.stderr.write('[repro] warming daemon (first explore triggers spawn+open+catchup)...\n');
|
|
87
|
+
const t0 = performance.now();
|
|
88
|
+
const r = await clients[0].request('tools/call', { name: 'codegraph_explore', arguments: { query: QUERIES[0] } }, 'warm-0', 120000);
|
|
89
|
+
process.stderr.write(`[repro] warm explore took ${Math.round(performance.now() - t0)}ms (timeout=${!!r.__timeout})\n`);
|
|
90
|
+
await sleep(500);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// THE WAVE: fire one explore on every client as simultaneously as possible.
|
|
94
|
+
process.stderr.write(`[repro] firing ${N} concurrent explores...\n`);
|
|
95
|
+
const waveStart = performance.now();
|
|
96
|
+
const results = await Promise.all(clients.map((c, i) => {
|
|
97
|
+
const started = performance.now();
|
|
98
|
+
return c.request('tools/call', { name: 'codegraph_explore', arguments: { query: QUERIES[i % QUERIES.length] } }, `call-${c.id}`, TIMEOUT_MS)
|
|
99
|
+
.then((m) => ({
|
|
100
|
+
id: c.id,
|
|
101
|
+
ms: Math.round(performance.now() - started),
|
|
102
|
+
timedOut: !!m.__timeout,
|
|
103
|
+
ok: !!m.result && !m.result.isError,
|
|
104
|
+
chars: m.result?.content?.[0]?.text?.length ?? 0,
|
|
105
|
+
}));
|
|
106
|
+
}));
|
|
107
|
+
const waveMs = Math.round(performance.now() - waveStart);
|
|
108
|
+
|
|
109
|
+
const lat = results.map((r) => r.ms).sort((a, b) => a - b);
|
|
110
|
+
const timeouts = results.filter((r) => r.timedOut).length;
|
|
111
|
+
const p = (q) => lat[Math.min(lat.length - 1, Math.floor(q * lat.length))];
|
|
112
|
+
|
|
113
|
+
console.log('='.repeat(64));
|
|
114
|
+
console.log(`HARNESS B (real daemon + ${N} proxies) repo=${repo}`);
|
|
115
|
+
console.log(`warm=${WARM} perCallTimeout=${TIMEOUT_MS}ms`);
|
|
116
|
+
console.log('-'.repeat(64));
|
|
117
|
+
console.log(`wave wall-clock: ${waveMs}ms`);
|
|
118
|
+
console.log(`per-call latency min=${lat[0]} p50=${p(0.5)} p90=${p(0.9)} max=${lat[lat.length - 1]} (ms)`);
|
|
119
|
+
console.log(`TIMEOUTS (>${TIMEOUT_MS}ms): ${timeouts} / ${N}`);
|
|
120
|
+
console.log(`completion order (id:ms): ${results.slice().sort((a,b)=>a.ms-b.ms).map(r=>`${r.id}:${r.ms}`).join(' ')}`);
|
|
121
|
+
console.log('='.repeat(64));
|
|
122
|
+
|
|
123
|
+
for (const c of clients) { try { c.child.stdin.end(); c.child.kill('SIGTERM'); } catch {} }
|
|
124
|
+
await sleep(300);
|
|
125
|
+
process.exit(0);
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Headless Claude Code run against a repo with homegraph MCP, capturing the
|
|
3
|
-
# full stream-json so we can see tool calls + token usage. Complements the
|
|
4
|
-
# interactive itrun.sh: headless gives a clean per-tool breakdown + exact
|
|
5
|
-
# tokens/cost, but defaults to the general-purpose subagent (not Explore).
|
|
6
|
-
# To force the Explore path, ask for it in the prompt.
|
|
7
|
-
#
|
|
8
|
-
# Usage: run-agent.sh <repo-path> <label> "<prompt>"
|
|
9
|
-
# Env: AGENT_EVAL_OUT (default /tmp/agent-eval), CG_BIN (homegraph dist binary)
|
|
10
|
-
set -uo pipefail
|
|
11
|
-
|
|
12
|
-
REPO="$1"; LABEL="$2"; PROMPT="$3"
|
|
13
|
-
CG_BIN="${CG_BIN:-$(command -v homegraph || echo /usr/local/bin/homegraph)}"
|
|
14
|
-
OUT_DIR="${AGENT_EVAL_OUT:-/tmp/agent-eval}"; mkdir -p "$OUT_DIR"
|
|
15
|
-
OUT="$OUT_DIR/run-${LABEL}.jsonl"
|
|
16
|
-
|
|
17
|
-
MCP_CONFIG=$(cat <<JSON
|
|
18
|
-
{"mcpServers":{"homegraph":{"command":"${CG_BIN}","args":["serve","--mcp","--path","${REPO}"]}}}
|
|
19
|
-
JSON
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
echo "→ running [$LABEL] in $REPO"
|
|
23
|
-
cd "$REPO" || exit 1
|
|
24
|
-
|
|
25
|
-
claude -p "$PROMPT" \
|
|
26
|
-
--output-format stream-json --verbose \
|
|
27
|
-
--permission-mode bypassPermissions \
|
|
28
|
-
--model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" \
|
|
29
|
-
--max-budget-usd 2 \
|
|
30
|
-
--strict-mcp-config --mcp-config "$MCP_CONFIG" \
|
|
31
|
-
> "$OUT" 2>"$OUT_DIR/run-${LABEL}.err"
|
|
32
|
-
|
|
33
|
-
echo "exit: $? | wrote $OUT ($(wc -l < "$OUT") lines)"
|
|
34
|
-
node "$(cd "$(dirname "$0")" && pwd)/parse-run.mjs" "$OUT" 2>/dev/null || true
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Headless Claude Code run against a repo with homegraph MCP, capturing the
|
|
3
|
+
# full stream-json so we can see tool calls + token usage. Complements the
|
|
4
|
+
# interactive itrun.sh: headless gives a clean per-tool breakdown + exact
|
|
5
|
+
# tokens/cost, but defaults to the general-purpose subagent (not Explore).
|
|
6
|
+
# To force the Explore path, ask for it in the prompt.
|
|
7
|
+
#
|
|
8
|
+
# Usage: run-agent.sh <repo-path> <label> "<prompt>"
|
|
9
|
+
# Env: AGENT_EVAL_OUT (default /tmp/agent-eval), CG_BIN (homegraph dist binary)
|
|
10
|
+
set -uo pipefail
|
|
11
|
+
|
|
12
|
+
REPO="$1"; LABEL="$2"; PROMPT="$3"
|
|
13
|
+
CG_BIN="${CG_BIN:-$(command -v homegraph || echo /usr/local/bin/homegraph)}"
|
|
14
|
+
OUT_DIR="${AGENT_EVAL_OUT:-/tmp/agent-eval}"; mkdir -p "$OUT_DIR"
|
|
15
|
+
OUT="$OUT_DIR/run-${LABEL}.jsonl"
|
|
16
|
+
|
|
17
|
+
MCP_CONFIG=$(cat <<JSON
|
|
18
|
+
{"mcpServers":{"homegraph":{"command":"${CG_BIN}","args":["serve","--mcp","--path","${REPO}"]}}}
|
|
19
|
+
JSON
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
echo "→ running [$LABEL] in $REPO"
|
|
23
|
+
cd "$REPO" || exit 1
|
|
24
|
+
|
|
25
|
+
claude -p "$PROMPT" \
|
|
26
|
+
--output-format stream-json --verbose \
|
|
27
|
+
--permission-mode bypassPermissions \
|
|
28
|
+
--model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" \
|
|
29
|
+
--max-budget-usd 2 \
|
|
30
|
+
--strict-mcp-config --mcp-config "$MCP_CONFIG" \
|
|
31
|
+
> "$OUT" 2>"$OUT_DIR/run-${LABEL}.err"
|
|
32
|
+
|
|
33
|
+
echo "exit: $? | wrote $OUT ($(wc -l < "$OUT") lines)"
|
|
34
|
+
node "$(cd "$(dirname "$0")" && pwd)/parse-run.mjs" "$OUT" 2>/dev/null || true
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# With/without A/B (and optional interactive) eval for a homegraph version on a
|
|
3
|
-
# repo. Codegraph is the ONLY variable: both arms launch claude with
|
|
4
|
-
# --strict-mcp-config — with = homegraph-only MCP (pointed at $CG_BIN),
|
|
5
|
-
# without = empty MCP. Built-in Read/Grep/Bash stay available in both arms.
|
|
6
|
-
#
|
|
7
|
-
# Usage: run-all.sh <repo-path> "<question>" [headless|tmux|all]
|
|
8
|
-
# Env: CG_BIN homegraph binary (default: command -v homegraph)
|
|
9
|
-
# AGENT_EVAL_OUT output dir (default: /tmp/agent-eval)
|
|
10
|
-
# MODEL / EFFORT claude model/effort (default: sonnet / high — the
|
|
11
|
-
# standing A/B policy; see CLAUDE.md, don't raise)
|
|
12
|
-
set -uo pipefail
|
|
13
|
-
|
|
14
|
-
REPO="${1:?usage: run-all.sh <repo-path> \"<question>\" [headless|tmux|all]}"
|
|
15
|
-
Q="${2:?question required}"
|
|
16
|
-
MODE="${3:-headless}"
|
|
17
|
-
CG_BIN="${CG_BIN:-$(command -v homegraph)}"
|
|
18
|
-
OUT="${AGENT_EVAL_OUT:-/tmp/agent-eval}"
|
|
19
|
-
HARNESS="$(cd "$(dirname "$0")" && pwd)"
|
|
20
|
-
mkdir -p "$OUT"
|
|
21
|
-
|
|
22
|
-
# Neutralize any ambient HomeGraph prompt-hook (~/.claude) in BOTH arms:
|
|
23
|
-
# the hook injects homegraph context into every prompt, which contaminates
|
|
24
|
-
# the without-arm (free structural context) and double-counts the with-arm.
|
|
25
|
-
# The A/B's only variable must be the MCP server wired below.
|
|
26
|
-
export HOMEGRAPH_NO_PROMPT_HOOK=1
|
|
27
|
-
|
|
28
|
-
[ -n "$CG_BIN" ] || { echo "no homegraph binary on PATH (set CG_BIN)"; exit 1; }
|
|
29
|
-
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO — index it first"; exit 1; }
|
|
30
|
-
case "$MODE" in headless|tmux|all) ;; *) echo "mode must be headless|tmux|all (got '$MODE')"; exit 1;; esac
|
|
31
|
-
|
|
32
|
-
# MCP config files (path form avoids inline-JSON quoting through tmux).
|
|
33
|
-
cat > "$OUT/mcp-homegraph.json" <<JSON
|
|
34
|
-
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"]}}}
|
|
35
|
-
JSON
|
|
36
|
-
echo '{"mcpServers":{}}' > "$OUT/mcp-empty.json"
|
|
37
|
-
|
|
38
|
-
echo "###### homegraph: $CG_BIN"
|
|
39
|
-
echo "###### repo: $REPO"
|
|
40
|
-
echo "###### question: $Q"
|
|
41
|
-
echo
|
|
42
|
-
|
|
43
|
-
# Headless arm: claude -p with stream-json -> exact tool sequence + tokens/cost.
|
|
44
|
-
headless() {
|
|
45
|
-
local label="$1" cfg="$2"
|
|
46
|
-
echo "############################## HEADLESS [$label] ##############################"
|
|
47
|
-
( cd "$REPO" && claude -p "$Q" \
|
|
48
|
-
--output-format stream-json --verbose \
|
|
49
|
-
--permission-mode bypassPermissions \
|
|
50
|
-
--model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" \
|
|
51
|
-
--max-budget-usd 4 \
|
|
52
|
-
--strict-mcp-config --mcp-config "$cfg" \
|
|
53
|
-
> "$OUT/run-$label.jsonl" 2>"$OUT/run-$label.err" )
|
|
54
|
-
echo "exit $? -> $OUT/run-$label.jsonl ($(wc -l < "$OUT/run-$label.jsonl" | tr -d ' ') lines)"
|
|
55
|
-
tail -2 "$OUT/run-$label.err" 2>/dev/null
|
|
56
|
-
node "$HARNESS/parse-run.mjs" "$OUT/run-$label.jsonl" 2>&1 || true
|
|
57
|
-
echo
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if [ "$MODE" = headless ] || [ "$MODE" = all ]; then
|
|
61
|
-
headless "headless-with" "$OUT/mcp-homegraph.json"
|
|
62
|
-
headless "headless-without" "$OUT/mcp-empty.json"
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
if [ "$MODE" = tmux ] || [ "$MODE" = all ]; then
|
|
66
|
-
echo "############################## INTERACTIVE [with] ##############################"
|
|
67
|
-
CLAUDE_EXTRA_ARGS="--model ${MODEL:-sonnet} --effort ${EFFORT:-high} --strict-mcp-config --mcp-config $OUT/mcp-homegraph.json" \
|
|
68
|
-
bash "$HARNESS/itrun.sh" "$REPO" "int-with" "$Q" 2>&1 || echo "[itrun WITH failed]"
|
|
69
|
-
echo
|
|
70
|
-
echo "############################## INTERACTIVE [without] ##############################"
|
|
71
|
-
CLAUDE_EXTRA_ARGS="--model ${MODEL:-sonnet} --effort ${EFFORT:-high} --strict-mcp-config --mcp-config $OUT/mcp-empty.json" \
|
|
72
|
-
bash "$HARNESS/itrun.sh" "$REPO" "int-without" "$Q" 2>&1 || echo "[itrun WITHOUT failed]"
|
|
73
|
-
echo
|
|
74
|
-
fi
|
|
75
|
-
echo "############################## RUN-ALL COMPLETE ##############################"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# With/without A/B (and optional interactive) eval for a homegraph version on a
|
|
3
|
+
# repo. Codegraph is the ONLY variable: both arms launch claude with
|
|
4
|
+
# --strict-mcp-config — with = homegraph-only MCP (pointed at $CG_BIN),
|
|
5
|
+
# without = empty MCP. Built-in Read/Grep/Bash stay available in both arms.
|
|
6
|
+
#
|
|
7
|
+
# Usage: run-all.sh <repo-path> "<question>" [headless|tmux|all]
|
|
8
|
+
# Env: CG_BIN homegraph binary (default: command -v homegraph)
|
|
9
|
+
# AGENT_EVAL_OUT output dir (default: /tmp/agent-eval)
|
|
10
|
+
# MODEL / EFFORT claude model/effort (default: sonnet / high — the
|
|
11
|
+
# standing A/B policy; see CLAUDE.md, don't raise)
|
|
12
|
+
set -uo pipefail
|
|
13
|
+
|
|
14
|
+
REPO="${1:?usage: run-all.sh <repo-path> \"<question>\" [headless|tmux|all]}"
|
|
15
|
+
Q="${2:?question required}"
|
|
16
|
+
MODE="${3:-headless}"
|
|
17
|
+
CG_BIN="${CG_BIN:-$(command -v homegraph)}"
|
|
18
|
+
OUT="${AGENT_EVAL_OUT:-/tmp/agent-eval}"
|
|
19
|
+
HARNESS="$(cd "$(dirname "$0")" && pwd)"
|
|
20
|
+
mkdir -p "$OUT"
|
|
21
|
+
|
|
22
|
+
# Neutralize any ambient HomeGraph prompt-hook (~/.claude) in BOTH arms:
|
|
23
|
+
# the hook injects homegraph context into every prompt, which contaminates
|
|
24
|
+
# the without-arm (free structural context) and double-counts the with-arm.
|
|
25
|
+
# The A/B's only variable must be the MCP server wired below.
|
|
26
|
+
export HOMEGRAPH_NO_PROMPT_HOOK=1
|
|
27
|
+
|
|
28
|
+
[ -n "$CG_BIN" ] || { echo "no homegraph binary on PATH (set CG_BIN)"; exit 1; }
|
|
29
|
+
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO — index it first"; exit 1; }
|
|
30
|
+
case "$MODE" in headless|tmux|all) ;; *) echo "mode must be headless|tmux|all (got '$MODE')"; exit 1;; esac
|
|
31
|
+
|
|
32
|
+
# MCP config files (path form avoids inline-JSON quoting through tmux).
|
|
33
|
+
cat > "$OUT/mcp-homegraph.json" <<JSON
|
|
34
|
+
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"]}}}
|
|
35
|
+
JSON
|
|
36
|
+
echo '{"mcpServers":{}}' > "$OUT/mcp-empty.json"
|
|
37
|
+
|
|
38
|
+
echo "###### homegraph: $CG_BIN"
|
|
39
|
+
echo "###### repo: $REPO"
|
|
40
|
+
echo "###### question: $Q"
|
|
41
|
+
echo
|
|
42
|
+
|
|
43
|
+
# Headless arm: claude -p with stream-json -> exact tool sequence + tokens/cost.
|
|
44
|
+
headless() {
|
|
45
|
+
local label="$1" cfg="$2"
|
|
46
|
+
echo "############################## HEADLESS [$label] ##############################"
|
|
47
|
+
( cd "$REPO" && claude -p "$Q" \
|
|
48
|
+
--output-format stream-json --verbose \
|
|
49
|
+
--permission-mode bypassPermissions \
|
|
50
|
+
--model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" \
|
|
51
|
+
--max-budget-usd 4 \
|
|
52
|
+
--strict-mcp-config --mcp-config "$cfg" \
|
|
53
|
+
> "$OUT/run-$label.jsonl" 2>"$OUT/run-$label.err" )
|
|
54
|
+
echo "exit $? -> $OUT/run-$label.jsonl ($(wc -l < "$OUT/run-$label.jsonl" | tr -d ' ') lines)"
|
|
55
|
+
tail -2 "$OUT/run-$label.err" 2>/dev/null
|
|
56
|
+
node "$HARNESS/parse-run.mjs" "$OUT/run-$label.jsonl" 2>&1 || true
|
|
57
|
+
echo
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if [ "$MODE" = headless ] || [ "$MODE" = all ]; then
|
|
61
|
+
headless "headless-with" "$OUT/mcp-homegraph.json"
|
|
62
|
+
headless "headless-without" "$OUT/mcp-empty.json"
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
if [ "$MODE" = tmux ] || [ "$MODE" = all ]; then
|
|
66
|
+
echo "############################## INTERACTIVE [with] ##############################"
|
|
67
|
+
CLAUDE_EXTRA_ARGS="--model ${MODEL:-sonnet} --effort ${EFFORT:-high} --strict-mcp-config --mcp-config $OUT/mcp-homegraph.json" \
|
|
68
|
+
bash "$HARNESS/itrun.sh" "$REPO" "int-with" "$Q" 2>&1 || echo "[itrun WITH failed]"
|
|
69
|
+
echo
|
|
70
|
+
echo "############################## INTERACTIVE [without] ##############################"
|
|
71
|
+
CLAUDE_EXTRA_ARGS="--model ${MODEL:-sonnet} --effort ${EFFORT:-high} --strict-mcp-config --mcp-config $OUT/mcp-empty.json" \
|
|
72
|
+
bash "$HARNESS/itrun.sh" "$REPO" "int-without" "$Q" 2>&1 || echo "[itrun WITHOUT failed]"
|
|
73
|
+
echo
|
|
74
|
+
fi
|
|
75
|
+
echo "############################## RUN-ALL COMPLETE ##############################"
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Tool-surface ablation — run ONE repo+question under ONE arm.
|
|
3
|
-
#
|
|
4
|
-
# Arms vary (exposed homegraph tools, trace-first steering). Tools are trimmed
|
|
5
|
-
# SERVER-SIDE via HOMEGRAPH_MCP_TOOLS in the MCP config's `env` block, so an
|
|
6
|
-
# ablated tool is genuinely absent from ListTools — no deferred-ToolSearch or
|
|
7
|
-
# denied-call confound (which --disallowedTools would introduce). Steering is
|
|
8
|
-
# injected with --append-system-prompt, so no rebuild of the shipped
|
|
9
|
-
# server-instructions is needed to A/B it.
|
|
10
|
-
#
|
|
11
|
-
# A control all tools no steering
|
|
12
|
-
# B steer all tools trace-first
|
|
13
|
-
# C no-explore hide explore trace-first
|
|
14
|
-
# D trace-centric hide explore+context trace-first
|
|
15
|
-
# E control-probe hide explore+context trace-first (caller passes a NON-flow Q)
|
|
16
|
-
#
|
|
17
|
-
# Usage: run-arms.sh <repo-path> "<question>" <A|B|C|D|E> [run-id]
|
|
18
|
-
set -uo pipefail
|
|
19
|
-
REPO="${1:?repo path}"; Q="${2:?question}"; ARM="${3:?arm A-E}"; RID="${4:-1}"
|
|
20
|
-
CG_BIN="${CG_BIN:-$(command -v homegraph)}"
|
|
21
|
-
OUT="${ARMS_OUT:-/tmp/arms}/$(basename "$REPO")"
|
|
22
|
-
mkdir -p "$OUT"
|
|
23
|
-
[ -n "$CG_BIN" ] || { echo "no homegraph binary (set CG_BIN)"; exit 1; }
|
|
24
|
-
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO"; exit 1; }
|
|
25
|
-
|
|
26
|
-
STEER='Flow questions ("how does X reach/become Y", "trace the flow", request to handler, state to render): call homegraph_trace(from,to) FIRST — one call returns the whole path. Use homegraph_context/search only to locate the two endpoint symbols if you do not know them. Do NOT reconstruct the path with repeated search/callers/explore.'
|
|
27
|
-
KEEP_NO_EXPLORE="trace,search,node,context,callers,callees,impact,files,status"
|
|
28
|
-
KEEP_TRACE_CENTRIC="trace,search,node,callers,callees,impact,files,status"
|
|
29
|
-
|
|
30
|
-
case "$ARM" in
|
|
31
|
-
A|G|H|I) TOOLS=""; STEERING="" ;; # no steering; H = body-trace, I = body-trace + destination callees (sufficiency)
|
|
32
|
-
B|F) TOOLS=""; STEERING="$STEER" ;; # F = B's surface, run on the body-inlining trace build
|
|
33
|
-
C) TOOLS="$KEEP_NO_EXPLORE"; STEERING="$STEER" ;;
|
|
34
|
-
D|E) TOOLS="$KEEP_TRACE_CENTRIC"; STEERING="$STEER" ;;
|
|
35
|
-
*) echo "bad arm '$ARM' (want A|B|C|D|E)"; exit 1 ;;
|
|
36
|
-
esac
|
|
37
|
-
|
|
38
|
-
CFG="$OUT/mcp-$ARM.json"
|
|
39
|
-
if [ -n "$TOOLS" ]; then
|
|
40
|
-
cat > "$CFG" <<JSON
|
|
41
|
-
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"],"env":{"HOMEGRAPH_MCP_TOOLS":"$TOOLS"}}}}
|
|
42
|
-
JSON
|
|
43
|
-
else
|
|
44
|
-
cat > "$CFG" <<JSON
|
|
45
|
-
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"]}}}
|
|
46
|
-
JSON
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
LOG="$OUT/$ARM-r$RID.jsonl"; ERR="$OUT/$ARM-r$RID.err"
|
|
50
|
-
ARGS=( -p "$Q" --output-format stream-json --verbose
|
|
51
|
-
--permission-mode bypassPermissions --model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" --max-budget-usd 4
|
|
52
|
-
--strict-mcp-config --mcp-config "$CFG" )
|
|
53
|
-
[ -n "$STEERING" ] && ARGS+=( --append-system-prompt "$STEERING" )
|
|
54
|
-
|
|
55
|
-
( cd "$REPO" && claude "${ARGS[@]}" > "$LOG" 2>"$ERR" )
|
|
56
|
-
echo "[$(basename "$REPO") $ARM r$RID] exit $? -> $LOG ($(wc -l < "$LOG" | tr -d ' ') lines)"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Tool-surface ablation — run ONE repo+question under ONE arm.
|
|
3
|
+
#
|
|
4
|
+
# Arms vary (exposed homegraph tools, trace-first steering). Tools are trimmed
|
|
5
|
+
# SERVER-SIDE via HOMEGRAPH_MCP_TOOLS in the MCP config's `env` block, so an
|
|
6
|
+
# ablated tool is genuinely absent from ListTools — no deferred-ToolSearch or
|
|
7
|
+
# denied-call confound (which --disallowedTools would introduce). Steering is
|
|
8
|
+
# injected with --append-system-prompt, so no rebuild of the shipped
|
|
9
|
+
# server-instructions is needed to A/B it.
|
|
10
|
+
#
|
|
11
|
+
# A control all tools no steering
|
|
12
|
+
# B steer all tools trace-first
|
|
13
|
+
# C no-explore hide explore trace-first
|
|
14
|
+
# D trace-centric hide explore+context trace-first
|
|
15
|
+
# E control-probe hide explore+context trace-first (caller passes a NON-flow Q)
|
|
16
|
+
#
|
|
17
|
+
# Usage: run-arms.sh <repo-path> "<question>" <A|B|C|D|E> [run-id]
|
|
18
|
+
set -uo pipefail
|
|
19
|
+
REPO="${1:?repo path}"; Q="${2:?question}"; ARM="${3:?arm A-E}"; RID="${4:-1}"
|
|
20
|
+
CG_BIN="${CG_BIN:-$(command -v homegraph)}"
|
|
21
|
+
OUT="${ARMS_OUT:-/tmp/arms}/$(basename "$REPO")"
|
|
22
|
+
mkdir -p "$OUT"
|
|
23
|
+
[ -n "$CG_BIN" ] || { echo "no homegraph binary (set CG_BIN)"; exit 1; }
|
|
24
|
+
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO"; exit 1; }
|
|
25
|
+
|
|
26
|
+
STEER='Flow questions ("how does X reach/become Y", "trace the flow", request to handler, state to render): call homegraph_trace(from,to) FIRST — one call returns the whole path. Use homegraph_context/search only to locate the two endpoint symbols if you do not know them. Do NOT reconstruct the path with repeated search/callers/explore.'
|
|
27
|
+
KEEP_NO_EXPLORE="trace,search,node,context,callers,callees,impact,files,status"
|
|
28
|
+
KEEP_TRACE_CENTRIC="trace,search,node,callers,callees,impact,files,status"
|
|
29
|
+
|
|
30
|
+
case "$ARM" in
|
|
31
|
+
A|G|H|I) TOOLS=""; STEERING="" ;; # no steering; H = body-trace, I = body-trace + destination callees (sufficiency)
|
|
32
|
+
B|F) TOOLS=""; STEERING="$STEER" ;; # F = B's surface, run on the body-inlining trace build
|
|
33
|
+
C) TOOLS="$KEEP_NO_EXPLORE"; STEERING="$STEER" ;;
|
|
34
|
+
D|E) TOOLS="$KEEP_TRACE_CENTRIC"; STEERING="$STEER" ;;
|
|
35
|
+
*) echo "bad arm '$ARM' (want A|B|C|D|E)"; exit 1 ;;
|
|
36
|
+
esac
|
|
37
|
+
|
|
38
|
+
CFG="$OUT/mcp-$ARM.json"
|
|
39
|
+
if [ -n "$TOOLS" ]; then
|
|
40
|
+
cat > "$CFG" <<JSON
|
|
41
|
+
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"],"env":{"HOMEGRAPH_MCP_TOOLS":"$TOOLS"}}}}
|
|
42
|
+
JSON
|
|
43
|
+
else
|
|
44
|
+
cat > "$CFG" <<JSON
|
|
45
|
+
{"mcpServers":{"homegraph":{"command":"$CG_BIN","args":["serve","--mcp","--path","$REPO"]}}}
|
|
46
|
+
JSON
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
LOG="$OUT/$ARM-r$RID.jsonl"; ERR="$OUT/$ARM-r$RID.err"
|
|
50
|
+
ARGS=( -p "$Q" --output-format stream-json --verbose
|
|
51
|
+
--permission-mode bypassPermissions --model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" --max-budget-usd 4
|
|
52
|
+
--strict-mcp-config --mcp-config "$CFG" )
|
|
53
|
+
[ -n "$STEERING" ] && ARGS+=( --append-system-prompt "$STEERING" )
|
|
54
|
+
|
|
55
|
+
( cd "$REPO" && claude "${ARGS[@]}" > "$LOG" 2>"$ERR" )
|
|
56
|
+
echo "[$(basename "$REPO") $ARM r$RID] exit $? -> $LOG ($(wc -l < "$LOG" | tr -d ' ') lines)"
|