Skip to content

Commit fa9536b

Browse files
committed
fix(provenance): attribute the path-scoped and short-circuit latches too
importProvenanceForValueAtInputPath took only { trusted }, so the five callers that bind a crossing to an input path — the block, loop, parallel and workflow resolvers, and the guardrails route — could not name themselves. Separately, six latches sit beside a tagged import on the path where the import did not run or returned false: a bundle already marked incomplete short-circuits the || before the import, and each catch latches directly. Those reported no origin while their neighbour reported one.
1 parent 11f734c commit fa9536b

10 files changed

Lines changed: 21 additions & 13 deletions

File tree

apps/sim/app/api/guardrails/validate/route.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ describe('POST /api/guardrails/validate', () => {
244244
expect(res.status).toBe(200)
245245
expect(mockImportProvenance).toHaveBeenCalledWith(provenance, 'secret value', ['input'], {
246246
trusted: true,
247+
origin: 'guardrailsRoute.inputProvenance',
247248
})
248249
})
249250

apps/sim/app/api/guardrails/validate/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
267267
provenanceInspection.value,
268268
inputStr,
269269
['input'],
270-
{ trusted: true }
270+
{ trusted: true, origin: 'guardrailsRoute.inputProvenance' }
271271
)
272272
).success
273273
: true

apps/sim/executor/utils/resolved-secret-trace-registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ export class ResolvedSecretTraceRegistry {
11921192
provenance: unknown,
11931193
value: unknown,
11941194
inputPath: ResolvedSecretInputPath | undefined,
1195-
options: { trusted: boolean }
1195+
options: { trusted: boolean; origin?: string }
11961196
): Promise<ImportResolvedSecretTraceProvenanceForValueResult> {
11971197
return this.importProvenanceForValueInternal(provenance, value, {
11981198
...options,

apps/sim/executor/variables/resolvers/block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ export class BlockResolver implements Resolver {
337337
state.resolvedSecretTraceProvenance,
338338
value,
339339
context.inputPath,
340-
{ trusted: true }
340+
{ trusted: true, origin: 'blockResolver.outputCrossing' }
341341
)
342342
if (imported.matched) context.onResolvedSecretReference?.()
343343
return value

apps/sim/executor/variables/resolvers/loop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export class LoopResolver implements Resolver {
283283
provenance,
284284
resolvedValue,
285285
context.inputPath,
286-
{ trusted: true }
286+
{ trusted: true, origin: 'loopResolver.itemCrossing' }
287287
)
288288
if (imported.matched) context.onResolvedSecretReference?.()
289289
return resolvedValue

apps/sim/executor/variables/resolvers/parallel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ export class ParallelResolver implements Resolver {
390390
provenance,
391391
resolvedValue,
392392
context.inputPath,
393-
{ trusted: true }
393+
{ trusted: true, origin: 'parallelResolver.itemCrossing' }
394394
)
395395
if (imported.matched) context.onResolvedSecretReference?.()
396396
return resolvedValue

apps/sim/executor/variables/resolvers/workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class WorkflowResolver implements Resolver {
133133
provenance,
134134
value,
135135
context.inputPath,
136-
{ trusted: true }
136+
{ trusted: true, origin: 'workflowResolver.inputCrossing' }
137137
)
138138
if (imported.matched) context.onResolvedSecretReference?.()
139139
return value

apps/sim/lib/copilot/request/tools/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,16 @@ export async function waitForClientToolCompletion({
107107
trusted: true,
108108
})
109109
if (!imported || !sealedContext.provenance.complete) {
110-
toolRegistry.markIncomplete()
110+
toolRegistry.markIncomplete('source-provenance-incomplete', {
111+
origin: 'copilotToolClient.sealedContext',
112+
})
111113
} else {
112114
content = sealedContent
113115
}
114116
}
115117
}
116118
} catch {
117-
toolRegistry?.markIncomplete()
119+
toolRegistry?.markIncomplete('unspecified', { origin: 'copilotToolClient.sealedContext' })
118120
} finally {
119121
finishPendingActivation?.()
120122
}

apps/sim/lib/copilot/tools/handlers/function-execute.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,14 @@ export async function resolveInputFiles(
533533
origin: 'copilotFunctionExecute.result',
534534
}))
535535
) {
536-
resolvedSecretTraceRegistry.markIncomplete()
536+
resolvedSecretTraceRegistry.markIncomplete('source-provenance-incomplete', {
537+
origin: 'copilotFunctionExecute.result',
538+
})
537539
}
538540
} catch {
539-
resolvedSecretTraceRegistry.markIncomplete()
541+
resolvedSecretTraceRegistry.markIncomplete('source-provenance-incomplete', {
542+
origin: 'copilotFunctionExecute.result',
543+
})
540544
}
541545

542546
const columns = table.schema.columns
@@ -567,9 +571,10 @@ async function importMountedProvenance(
567571
origin: 'copilotFunctionExecute.crossing',
568572
trusted: true,
569573
})
570-
if (!imported) target.markIncomplete()
574+
if (!imported)
575+
target.markIncomplete('unspecified', { origin: 'copilotFunctionExecute.crossing' })
571576
} catch {
572-
target.markIncomplete()
577+
target.markIncomplete('unspecified', { origin: 'copilotFunctionExecute.crossing' })
573578
}
574579
}
575580

apps/sim/lib/logs/execution/trace-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ export async function projectExecutionDataForDisplay(
309309
origin: 'traceStore.exactProvenance',
310310
})
311311
} else {
312-
exactRegistry.markIncomplete()
312+
exactRegistry.markIncomplete('untrusted-provenance', { origin: 'traceStore.exactProvenance' })
313313
}
314314

315315
const [projected] = await projectTraceSpansForSecrets(

0 commit comments

Comments
 (0)