fix(mindspace): fail closed on invalid page data delivery

This commit is contained in:
john
2026-07-14 19:40:47 +08:00
parent 192548b0b9
commit 72fd88219c
6 changed files with 114 additions and 11 deletions
+8 -1
View File
@@ -817,12 +817,19 @@ export function createAgentRunGateway({
let deliverables = null;
if (requiresPageDeliverable || typeof validateRunDeliverables === 'function') {
const latest = await getRunById(runId);
// `[]` is a strict allowlist meaning no workspace page may be examined.
// Static page runs commonly have no Page Data artifact list, so use
// `null` to discover the current run's newly synced workspace output.
const workspaceRelativePaths = Array.isArray(deliveryResult?.pageDataRelativePaths)
&& deliveryResult.pageDataRelativePaths.length > 0
? deliveryResult.pageDataRelativePaths
: null;
deliverables = await prepareAndDetectSessionDeliverables({
pool,
userId: row.user_id,
sessionId,
runStartedAtMs: latest?.started_at ?? row.started_at ?? null,
workspaceRelativePaths: deliveryResult?.pageDataRelativePaths ?? [],
workspaceRelativePaths,
});
if (requiresPageDeliverable && deliverables.pageCount < 1) {
const error = new Error(