Skip to content

improvement(provenance): make the incompleteness reason set closed and complete - #6559

Merged
icecrasher321 merged 1 commit into
stagingfrom
provenance-reason-taxonomy
Aug 11, 2026
Merged

improvement(provenance): make the incompleteness reason set closed and complete#6559
icecrasher321 merged 1 commit into
stagingfrom
provenance-reason-taxonomy

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

  • Remove workspace-scope-missing — it has no producer. The !context.workspaceId guard that emitted it disappeared when the copilot table tool's importRowsForModel was rewritten, and every operation now returns early on a missing workspace before provenance import is reachable. Its warn-classification test case constructed the reason itself, so it was asserting on something nothing emits.
  • Give ResolvedSecretTraceProvenanceAccumulator the required reason the registry already has. Its three guards latched anonymously, which matters more here than on the registry: the wire format carries only complete, so the consumer can only ever say source-provenance-incomplete and the guard is unrecoverable. Names the three — file-source-unidentified, workspace-file-provenance-unknown, mcp-tool-execution-timeout. A latch from record() stays silent, since it reflects a bundle whose own registry already reported and subflow aggregation runs it per iteration.
  • Fold the error/warn/by-design split into one reportIncompleteness. It was copied across both registry latches and would have been copied a third time for the accumulator; a copy that can be updated alone lets the same reason be a fault in one place and routine in another.
  • Give the async workflow tool path its own import origin (copilotToolClient.workflowExecution) instead of latching with none, matching the sibling sealed-context path.
  • Close UnrecordedDurableProvenanceCause, which was a free-form string carrying a TSDoc claim that it was always a static literal.

Also fixes a latent miss from #6513: the sweep passed a reason to the accumulator's zero-arg markIncomplete, but nothing caught it — test files are excluded from tsc, and the extra argument was ignored at runtime. That call is now real.

unspecified stays, with corrected docs. It has no production callsite by design, but tests use it as an honest "latched, no guard to name" lever; making them borrow a real reason would read as a claim about which guard tripped.

Type of Change

  • Improvement (cleanup, no behavior change)

Testing

Verified every reason in the union now has at least one producer. bun run type-check clean, bun run lint clean, bun run check:audits — all 24 audits pass (including check:api-validation:strict). 3,140 tests green across the registry, durable-provenance, knowledge, providers, copilot-tools, logs, MCP, and file-manage suites. Two new tests pin the accumulator's naming and its silence on a recorded latch.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…d complete

The reason a resolved-secret registry latched is the only thing that names
which guard tripped, and a refusal surfaces many frames later as one fixed
sentence. Two gaps had opened in that set.

`workspace-scope-missing` no longer has a producer: the `!context.workspaceId`
guard in the copilot table tool went away when `importRowsForModel` was
rewritten, and every operation now returns early on a missing workspace before
provenance import is reachable. The literal and its warn-classification test
case go with it — the test constructed the reason itself, so it asserted on
something nothing emits.

ResolvedSecretTraceProvenanceAccumulator had no reason concept at all, so its
three guards latched anonymously. That matters more there than on the registry:
the wire format carries only `complete`, so the consumer can only ever say
`source-provenance-incomplete`, and the guard is unrecoverable. Give it the
same required `reason` and name all three — a file source with no workspace
identity, a workspace file whose sidecar reads unknown, and an MCP tool that
timed out. A latch from `record()` stays silent, since it reflects a bundle
whose own registry already reported and subflow aggregation runs it per
iteration.

Fold the error/warn/by-design split into one `reportIncompleteness`. It was
copied across both registry latches and would have been copied a third time
here, and a copy that can be updated alone lets one reason be a fault in one
place and routine in another.

Also give the async workflow tool path its own import origin instead of
latching with none, and close `UnrecordedDurableProvenanceCause`, which was a
free-form string carrying a TSDoc claim that it was always a static literal.
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 11, 2026 8:36pm

Request Review

@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Observability and typing cleanup for provenance incompleteness; fail-closed behavior is unchanged and no security-sensitive control flow is altered.

Overview
Makes secret-provenance incompleteness fully named and closed, so every latch can be traced instead of disappearing into anonymous or free-form causes.

ResolvedSecretTraceProvenanceAccumulator.markIncomplete now requires a reason, matching the registry. The three previously anonymous guards are named: file-source-unidentified, workspace-file-provenance-unknown, and mcp-tool-execution-timeout. Only the first guard logs; latches from record() stay silent.

Also removes the dead workspace-scope-missing reason, folds the warn/error/by-design split into a shared reportIncompleteness helper, closes UnrecordedDurableProvenanceCause to a typed union, and attributes the copilot workflow-tool import path with origin copilotToolClient.workflowExecution.

Reviewed by Cursor Bugbot for commit ef686fa. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR closes and completes provenance-reason types while adding actionable diagnostics for accumulator guards.

  • Adds explicit reasons for MCP timeouts and unidentified or unknown file provenance.
  • Centralizes incompleteness log classification and records the first accumulator guard.
  • Removes an unproduced reason and closes the durable-provenance cause union.
  • Attributes asynchronous copilot workflow provenance imports to a stable origin.

Confidence Score: 5/5

The PR appears safe to merge with no concrete correctness, security, or compatibility failures identified.

The reason-set changes cover all current producers, reporting retains existing classification and suppression behavior, and accumulator provenance remains fail-closed while gaining bounded diagnostics.

Important Files Changed

Filename Overview
apps/sim/executor/utils/resolved-secret-trace-registry.ts Centralizes incompleteness reporting, extends the closed reason union, and adds first-guard accumulator diagnostics without changing fail-closed provenance semantics.
apps/sim/app/api/mcp/tools/execute/route.ts Names MCP execution timeouts when they make accumulated provenance incomplete.
apps/sim/app/api/tools/file/manage/route.ts Assigns distinct reasons to unidentified file sources and unknown workspace-file provenance.
apps/sim/lib/copilot/request/tools/client.ts Adds one stable origin to asynchronous workflow provenance import failures and incomplete bundles.
apps/sim/lib/execution/durable-secret-provenance-enforcement.ts Replaces a free-form report cause with a union containing every current production cause.
apps/sim/executor/utils/resolved-secret-trace-registry.test.ts Updates reason classification coverage and verifies first-guard reporting and silent imported-bundle latching.

Reviews (1): Last reviewed commit: "improvement(provenance): make the incomp..." | Re-trigger Greptile

@icecrasher321
icecrasher321 merged commit ae1f62d into staging Aug 11, 2026
29 checks passed
@waleedlatif1
waleedlatif1 deleted the provenance-reason-taxonomy branch August 11, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant