fix(FN-834): fix branch prefix drift, add merger branch guard, and fix test OOM

- Fix resolveBaseBranch to use stored branch name and consistent fusion/ prefix
  for both explicit deps and blockedBy paths (was using kb/ for blockedBy)
- Add main branch checkout verification in merger before squash merge to prevent
  feature code from landing on wrong branch lineage
- Align all branch prefix references from stale kb/ to fusion/ across executor,
  merger, store, and routes
- Fix executor test OOM by mocking merger fully, adding fake timers to retry
  tests, and switching vitest pool to vmThreads
- Update all test assertions to use fusion/ branch prefix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-04 11:11:59 -07:00
parent d1da9721a1
commit 357086ab61
26 changed files with 1985 additions and 236 deletions

View File

@@ -26,6 +26,8 @@ import {
export interface AgentResult {
session: AgentSession;
/** Path to the persisted session file (undefined for in-memory sessions). */
sessionFile?: string;
}
export interface PromptableSession extends AgentSession {
@@ -77,6 +79,10 @@ export interface AgentOptions {
fallbackModelId?: string;
/** Default thinking effort level (e.g. "medium", "high"). When provided, sets the session's thinking level after creation. */
defaultThinkingLevel?: string;
/** Optional pre-configured SessionManager. When provided, the agent session
* uses this instead of creating an in-memory session. Pass a file-based
* SessionManager to enable session persistence and pause/resume. */
sessionManager?: SessionManager;
}
function resolveConfiguredModel(
@@ -228,6 +234,8 @@ export async function createKbAgent(options: AgentOptions): Promise<AgentResult>
});
await resourceLoader.reload();
const sessionManager = options.sessionManager ?? SessionManager.inMemory();
const createSessionWithModel = async (modelOverride?: typeof selectedModel) => {
return createAgentSession({
cwd: options.cwd,
@@ -236,7 +244,7 @@ export async function createKbAgent(options: AgentOptions): Promise<AgentResult>
resourceLoader,
tools,
customTools: options.customTools,
sessionManager: SessionManager.inMemory(),
sessionManager,
settingsManager,
...(modelOverride ? { model: modelOverride } : {}),
});
@@ -336,5 +344,5 @@ export async function createKbAgent(options: AgentOptions): Promise<AgentResult>
}
});
return { session: promptableSession };
return { session: promptableSession, sessionFile: promptableSession.sessionFile };
}