fix(FN-2148): use hash cache-busting and fix store teardown

- Switch PluginLoader bypass-cache imports from a query string to a hash fragment for reload-safe module differentiation
- Update inline documentation to reflect hash-based cache busting semantics in Node ESM imports
- Close AgentStore in the affected agent-store test afterEach hook to ensure cleanup alongside TaskStore teardown
This commit is contained in:
Fusion
2026-04-19 06:08:50 -07:00
committed by gsxdsm
parent 52b2d2c2f1
commit a70ff39e31
2 changed files with 4 additions and 3 deletions

View File

@@ -1508,6 +1508,7 @@ describe("AgentStore", () => {
}); });
afterEach(() => { afterEach(() => {
store.close();
taskStore.close(); taskStore.close();
}); });

View File

@@ -269,9 +269,9 @@ export class PluginLoader extends EventEmitter<{
// Dynamic import - use cache-busting for reload scenarios // Dynamic import - use cache-busting for reload scenarios
let mod: unknown; let mod: unknown;
if (bypassCache) { if (bypassCache) {
// Use cache-busting with timestamp for ESM modules // Use a hash fragment for cache differentiation without affecting path resolution
// This ensures Node.js re-imports the module even if it has it cached // Node treats each distinct URL as a fresh import while resolving the same file path
const bustedPath = `${path}?reload=${Date.now()}`; const bustedPath = `${path}#${Date.now()}`;
mod = await import(bustedPath); mod = await import(bustedPath);
} else { } else {
mod = await import(path); mod = await import(path);