aboutsummaryrefslogtreecommitdiff
path: root/modules/core/core-bundle.js
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-09-29 19:03:27 +0200
committerAgando <roduccomm@gmail.com>2026-09-29 19:03:27 +0200
commit06874424c2bdc1103fa37ea65d87587425c3ceb3 (patch)
treeece2807ec211caa8e98c4d7f4f206d7a4fec4b6c /modules/core/core-bundle.js
parent7b9dd97689db400f2408ed50b04857d7d73d83e5 (diff)
fix: sequential safe-tool execution — parallel fan-out corrupted print-capture attribution + shadow diff pairing
Diffstat (limited to 'modules/core/core-bundle.js')
-rw-r--r--modules/core/core-bundle.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/core/core-bundle.js b/modules/core/core-bundle.js
index 6127f36..dd86773 100644
--- a/modules/core/core-bundle.js
+++ b/modules/core/core-bundle.js
@@ -9432,8 +9432,11 @@ buildSystemPrompt() {
let pendingText = res.message?.content || null;
const destructiveTools = res.tool_calls.filter(tc => this.isDestructive(tc.function.name, tc.function.arguments));
const safeTools = res.tool_calls.filter(tc => !this.isDestructive(tc.function.name, tc.function.arguments));
- // Execute non-destructive tools in parallel (independent read-only operations)
- const safeResults = await Promise.all(safeTools.map(async (tc) => {
+ // Execute non-destructive tools SEQUENTIALLY — parallel fan-out corrupts
+ // print-capture attribution, shadow-VFS snapshot/diff pairing, and telemetry
+ // under interleaved awaits. Inference latency dominates anyway.
+ const safeResults = [];
+ for (const tc of safeTools) {
const fn = tc.function;
const t0 = Date.now();
const toolResult = await this.runTool(fn.name, fn.arguments);
@@ -9454,8 +9457,8 @@ buildSystemPrompt() {
const sm = this.terminal.moduleManager.modules['ServerMonitorModule'];
if (sm && sm.logToolCall) sm.logToolCall(fn.name, (t1 * 1000) || 1, this._isToolError(toolResult));
if (this._debugPanelEnabled) this._updateDebugPanel();
- return { fn, toolResult, t1 };
- }));
+ safeResults.push({ fn, toolResult, t1 });
+ }
for (const { fn, toolResult, t1 } of safeResults) {
this.terminal.print(`🔧 Tool: ${fn.name}(${typeof fn.arguments === 'string' ? fn.arguments : JSON.stringify(fn.arguments)})`, 'info');
// Memory graph: record tool call + file access