feat: add orchestrator shadow observability
This commit is contained in:
@@ -342,6 +342,7 @@ export function createAgentRunGateway({
|
||||
function dispatchShadowObservation(input) {
|
||||
if (typeof observeWorkflowRun !== 'function' || input.toolMode !== 'code') return;
|
||||
setImmediate(() => {
|
||||
const observationStartedAt = nowMs();
|
||||
void Promise.resolve()
|
||||
.then(() => observeWorkflowRun(input))
|
||||
.then(async (result) => {
|
||||
@@ -352,6 +353,9 @@ export function createAgentRunGateway({
|
||||
configVersion: result.configVersion ?? null,
|
||||
status: result.shadowRun?.status ?? null,
|
||||
phase: result.shadowRun?.phase ?? null,
|
||||
taskType: result.shadowRun?.plan?.taskType ?? input.taskType ?? null,
|
||||
executorAdapter: result.shadowRun?.plan?.executorAdapter ?? null,
|
||||
latencyMs: Math.max(0, nowMs() - observationStartedAt),
|
||||
});
|
||||
})
|
||||
.catch(async (error) => {
|
||||
@@ -362,6 +366,7 @@ export function createAgentRunGateway({
|
||||
await appendEvent(input.runId, 'workflow_shadow_failed', {
|
||||
code: String(error?.code ?? 'WORKFLOW_SHADOW_FAILED').slice(0, 128),
|
||||
message: String(error instanceof Error ? error.message : error).slice(0, 1000),
|
||||
latencyMs: Math.max(0, nowMs() - observationStartedAt),
|
||||
}).catch((appendError) => {
|
||||
console.warn(
|
||||
'[AgentRun] workflow shadow failure event skipped:',
|
||||
|
||||
Reference in New Issue
Block a user