Complete PostgreSQL-backed rescue coverage while retaining archived shared-branch landing proof. - Preserve merge details when archiving and restoring tasks for branch-group promotion. - Migrate remaining quarantine tests and mocks to PostgreSQL-aware boundaries. - Remove rescued tests from the engine quarantine configuration and ledger. Files changed: .changeset/fn-8258-pg-quarantine.md | 7 +++ .../core/src/task-store/archive-lifecycle-2.ts | 1 + packages/core/src/task-store/remaining-ops-6.ts | 8 ++- packages/core/src/task-store/serialization.ts | 1 + .../__tests__/agent-tools-intake-column.test.ts | 26 ++++------ .../agent-workflow-tools-exposure.test.ts | 18 +++---- .../engine/src/__tests__/executor-task-done-invariant.test.ts | 33 ++++++------ .../engine/src/__tests__/executor-test-helpers.ts | 7 +++ .../src/__tests__/group-merge-coordinator.test.ts | 43 ++++++++++------ .../hybrid-executor-multi-node-routing.test.ts | 5 ++ .../mission-factory-parity.integration.test.ts | 2 +- .../engine/src/__tests__/routine-runner.test.ts | 56 +++++++++++++-------- .../self-healing-meta-archive-guards.test.ts | 28 +++++------ .../src/__tests__/triage-token-usage.test.ts | 58 +++++----------------- .../__tests__/workflow-graph-task-runner.test.ts | 16 +++--- packages/engine/src/hybrid-executor-gate.ts | 8 ++- packages/engine/vitest.config.ts | 12 +---- scripts/lib/test-quarantine.json | 52 +------------------ 18 files changed, 165 insertions(+), 216 deletions(-) Fusion-Task-Id: FN-8258 Fusion-Task-Lineage: 121c2b52-ad50-4475-b925-7a36ecfaf28b Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
import type { CentralCore } from "@fusion/core";
|
|
|
|
export interface HybridExecutorGateDecision {
|
|
enabled: boolean;
|
|
reason: string;
|
|
}
|
|
|
|
function parseEnvOverride(value: string | undefined): HybridExecutorGateDecision | null {
|
|
if (value === "1") {
|
|
return { enabled: true, reason: "env-override" };
|
|
}
|
|
|
|
if (value === "0") {
|
|
return { enabled: false, reason: "env-override" };
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
export async function shouldUseHybridExecutor(centralCore: CentralCore): Promise<HybridExecutorGateDecision> {
|
|
const envOverride = parseEnvOverride(process.env.FUSION_HYBRID_EXECUTOR);
|
|
if (envOverride) {
|
|
return envOverride;
|
|
}
|
|
|
|
try {
|
|
const nodes = await centralCore.listNodes();
|
|
/*
|
|
FNXC:HybridExecutorRouting 2026-07-18-01:35:
|
|
Local project registrations may create more than one local node record. HybridExecutor
|
|
only adds value when a remote node is routable, so node count must not enable duplicate
|
|
local runtimes for a local-only multi-project installation.
|
|
*/
|
|
if (nodes.some((node) => node.type === "remote")) {
|
|
return { enabled: true, reason: "multi-node" };
|
|
}
|
|
|
|
// Local-only single-node: HybridExecutor's value is cross-node routing.
|
|
// ProjectEngineManager already handles N local projects with one
|
|
// InProcessRuntime per project; running HybridExecutor in parallel just
|
|
// creates a second InProcessRuntime per project, duplicating self-healing
|
|
// recovery and adding ~7s to cold start. Skip until a remote node is
|
|
// registered (set FUSION_HYBRID_EXECUTOR=1 to force-enable).
|
|
return { enabled: false, reason: "single-node-local-only" };
|
|
} catch {
|
|
return { enabled: false, reason: "central-unavailable" };
|
|
}
|
|
}
|