fix(agent): restore active-task routing and active-mode validation observation
Memind CI / Test, build, and release guards (push) Successful in 5m23s
Memind CI / Test, build, and release guards (push) Successful in 5m23s
Keep correction follow-ups on Agent using session transcript and active task context, and let Page Data validation reach Orchestrator when mode is active instead of requiring shadowEngine. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -28,6 +28,19 @@ async function recordValidationWithRetry(engine, runId, observation) {
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveValidationEngineSelection(selection) {
|
||||
if (selection.shadowEngine === WORKFLOW_ENGINE.LANGGRAPH) {
|
||||
return selection;
|
||||
}
|
||||
if (
|
||||
selection.engine === WORKFLOW_ENGINE.LANGGRAPH
|
||||
&& ['active', 'canary', 'shadow'].includes(String(selection.mode ?? ''))
|
||||
) {
|
||||
return selection;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function createWorkflowShadowObserver({
|
||||
configService,
|
||||
serviceToken = process.env.MEMIND_ORCHESTRATOR_SERVICE_TOKEN,
|
||||
@@ -66,6 +79,34 @@ export function createWorkflowShadowObserver({
|
||||
};
|
||||
}
|
||||
|
||||
async function selectValidationEngine({
|
||||
runId,
|
||||
requestId,
|
||||
userId,
|
||||
workflowName,
|
||||
}) {
|
||||
const selection = await configService.selectEngine({
|
||||
runId,
|
||||
requestId,
|
||||
userId,
|
||||
workflowName,
|
||||
});
|
||||
if (!resolveValidationEngineSelection(selection)) {
|
||||
return { selection, engine: null };
|
||||
}
|
||||
const state = await configService.getRuntimeState();
|
||||
return {
|
||||
selection,
|
||||
engine: createRemoteWorkflowEngine({
|
||||
id: WORKFLOW_ENGINE.LANGGRAPH,
|
||||
baseUrl: state.config.serviceUrl,
|
||||
serviceToken,
|
||||
timeoutMs: state.config.requestTimeoutMs,
|
||||
fetchImpl,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
async function observeWorkflowRun({
|
||||
runId,
|
||||
requestId,
|
||||
@@ -152,7 +193,7 @@ export function createWorkflowShadowObserver({
|
||||
workflowName = 'code-run-v1',
|
||||
observation,
|
||||
} = {}) {
|
||||
const { selection, engine } = await selectShadowEngine({
|
||||
const { selection, engine } = await selectValidationEngine({
|
||||
runId,
|
||||
requestId,
|
||||
userId,
|
||||
@@ -187,5 +228,6 @@ export function createWorkflowShadowObserver({
|
||||
|
||||
export const workflowShadowObserverInternals = {
|
||||
recordValidationWithRetry,
|
||||
resolveValidationEngineSelection,
|
||||
safeError,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user