@nexus-cortex/core 4.108.9 → 4.108.10

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.
@@ -43,7 +43,7 @@ import { renderResumeMemoryPrompt, buildRebuildInstructions, resolveCheckpointBa
43
43
  import { resolveCortexStateDir, cortexStatePath } from '../utils/stateDir.js';
44
44
  import { collectWorkspaceDelta, detectCheckCommand, runCheck, resolveJudgeGroundingConfig } from '../training/judgeEvidence.js';
45
45
  import { resolveMentorRoleConfig, describeMentorWire, describeMentorDelivery, mentorSurfaceTimeoutMs } from '../training/mentorRole.js';
46
- import { resolveOuterToolDeadlineMs } from './outerToolTimeout.js';
46
+ import { resolveOuterToolDeadlineMs, resolveOuterToolTimeoutFloorMs } from './outerToolTimeout.js';
47
47
  import { resolveSubAgentTimeoutMs } from './subAgentTimeout.js';
48
48
  import { resolveTurnDeadlineMs, timeBudgetState, timeBudgetWarnNudge } from './timeBudget.js';
49
49
  import { readStagedDoctrine, applyCuratedDoctrine, runOrientForStaging, withTimeout } from './doctrineCuration.js';
@@ -1596,6 +1596,7 @@ export class CortexOrchestrator {
1596
1596
  }
1597
1597
  const MAX_TOOL_ITERATIONS = loopDefaults.maxToolIterations;
1598
1598
  const TOOL_TIMEOUT_MS = loopDefaults.toolTimeoutMs;
1599
+ const OUTER_TOOL_TIMEOUT_FLOOR_MS = loopDefaults.outerToolTimeoutFloorMs;
1599
1600
  const MAX_CONSECUTIVE_ERRORS = loopDefaults.maxConsecutiveErrors;
1600
1601
  const MAX_LOOP_REPETITIONS = loopDefaults.maxLoopRepetitions;
1601
1602
  const TOOL_BUDGET_SOFT = loopDefaults.toolBudgetSoft; // R29b brake
@@ -2333,7 +2334,7 @@ export class CortexOrchestrator {
2333
2334
  const abortController = new AbortController();
2334
2335
  // D-A (2026-09-04): outer cap must sit ABOVE the model's REQUESTED Bash timeout, not a static
2335
2336
  // ~150s, or a legit `Bash({ timeout: 250000 })` is killed before ShellTool's own promote-at-deadline.
2336
- const outerDeadlineMs = resolveOuterToolDeadlineMs(toolUseBlocks, TOOL_TIMEOUT_MS, OUTER_TIMEOUT_GRACE_MS, this.subAgentBlockTimeoutMs);
2337
+ const outerDeadlineMs = resolveOuterToolDeadlineMs(toolUseBlocks, TOOL_TIMEOUT_MS, OUTER_TIMEOUT_GRACE_MS, this.subAgentBlockTimeoutMs, OUTER_TOOL_TIMEOUT_FLOOR_MS);
2337
2338
  const timeoutId = setTimeout(() => {
2338
2339
  console.warn(`[Orchestrator Phase 2.5] Tool execution timeout after ${outerDeadlineMs}ms`);
2339
2340
  abortController.abort();
@@ -3792,6 +3793,7 @@ export class CortexOrchestrator {
3792
3793
  const MAX_CONSECUTIVE_ERRORS = loopDefaults.maxConsecutiveErrors;
3793
3794
  const MAX_LOOP_REPETITIONS = loopDefaults.maxLoopRepetitions;
3794
3795
  const TOOL_TIMEOUT_MS = loopDefaults.toolTimeoutMs;
3796
+ const OUTER_TOOL_TIMEOUT_FLOOR_MS = loopDefaults.outerToolTimeoutFloorMs;
3795
3797
  const TOOL_BUDGET_SOFT = loopDefaults.toolBudgetSoft; // R29b brake
3796
3798
  // R64: TOOL_BUDGET_SOFT <= 0 disables the budget-pressure system entirely
3797
3799
  // (no reminders, no force-synthesis cap). Runaway protection then rests on
@@ -4140,7 +4142,7 @@ export class CortexOrchestrator {
4140
4142
  // see the non-stream site: ShellTool's promote-at-deadline must win the race; 4.90.1)
4141
4143
  const abortController = new AbortController();
4142
4144
  // D-A (2026-09-04): outer cap sits above the requested Bash timeout (see the non-stream site).
4143
- const outerDeadlineMs = resolveOuterToolDeadlineMs(toolUseBlocks, TOOL_TIMEOUT_MS, OUTER_TIMEOUT_GRACE_MS, this.subAgentBlockTimeoutMs);
4145
+ const outerDeadlineMs = resolveOuterToolDeadlineMs(toolUseBlocks, TOOL_TIMEOUT_MS, OUTER_TIMEOUT_GRACE_MS, this.subAgentBlockTimeoutMs, OUTER_TOOL_TIMEOUT_FLOOR_MS);
4144
4146
  const timeoutId = setTimeout(() => {
4145
4147
  if (this.config.debug) {
4146
4148
  console.warn(`[Orchestrator Streaming] Tool execution timeout after ${outerDeadlineMs}ms`);
@@ -5138,6 +5140,8 @@ export class CortexOrchestrator {
5138
5140
  // coercion silently replaced an explicit 0 with 15.
5139
5141
  toolBudgetSoft: Number.isFinite(softRaw) && softRaw >= 0 ? softRaw : 400,
5140
5142
  toolTimeoutMs: this.config.loopControl?.toolTimeoutMs ?? 120000,
5143
+ // CORTEX_OUTER_TOOL_TIMEOUT_MS: floor for the outer per-batch abort (0 = no floor, byte-identical).
5144
+ outerToolTimeoutFloorMs: resolveOuterToolTimeoutFloorMs(),
5141
5145
  maxLoopRepetitions: this.config.loopControl?.maxLoopRepetitions ?? 5,
5142
5146
  // #2 wall-clock deadline: opt-in (0 = disabled), env CORTEX_TURN_DEADLINE_MS is the fallback.
5143
5147
  turnDeadlineMs: resolveTurnDeadlineMs(this.config.loopControl?.turnDeadlineMs),