Skip to content

fix(knowledge): retain model input provenance - #6540

Merged
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/knowledge-model-provenance
Aug 11, 2026
Merged

fix(knowledge): retain model input provenance#6540
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/knowledge-model-provenance

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • retain the authenticated private model-input provenance envelope through internal Knowledge Search contract parsing
  • add regression coverage spanning transport envelope creation, Zod boundary parsing, and Knowledge provenance verification

Type of Change

  • Bug fix

Testing

  • 17 focused transport, contract, and Knowledge provenance tests passing
  • Sim type-check passing
  • Lint and all 24 CI audits passing

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)

@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 11:35am

Request Review

@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes secret provenance handling on the internal knowledge search path; scope is narrow (schema + tests) and aligns with existing provenance contracts, but incorrect parsing could still affect safe projection of secrets in model inputs.

Overview
Fixes a bug where internal Knowledge Search request parsing dropped the optional private model-input provenance envelope, so downstream provenance verification could fail even when the executor sent a valid payload.

internalKnowledgeSearchBodySchema now accepts an optional RESOLVED_SECRET_PROVENANCE_FIELD validated with resolvedSecretTraceProvenanceSchema, matching how other internal route contracts handle secret trace metadata.

Regression tests cover Zod boundary parsing (envelope survives parse) and Knowledge provenance prep after the contract has parsed the body.

Reviewed by Cursor Bugbot for commit fff44fc. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR fixes internal Knowledge Search parsing so authenticated private model-input provenance survives contract validation and reaches downstream provenance verification.

  • Adds the resolved-secret provenance envelope to the internal Knowledge Search request schema.
  • Adds focused coverage for schema retention and parsed-envelope verification.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The internal schema now preserves the established provenance envelope, and the added tests cover both Zod retention and downstream authenticated provenance preparation without changing authorization or secret-exposure boundaries.

Important Files Changed

Filename Overview
apps/sim/lib/api/contracts/knowledge/search.ts Extends the internal request schema with the established optional resolved-secret provenance envelope while leaving the public search shape unchanged.
apps/sim/lib/api/contracts/knowledge/search.test.ts Adds direct regression coverage proving that contract parsing retains the private provenance field.
apps/sim/lib/knowledge/model-input-provenance.test.ts Adds coverage showing that a contract-parsed authenticated envelope initializes a complete provenance registry.

Sequence Diagram

sequenceDiagram
  participant Tool as Internal workflow tool
  participant Transport as Request transport
  participant Contract as Knowledge request contract
  participant Provenance as Provenance verifier
  participant Search as Knowledge search
  Tool->>Transport: Search body + resolved-secret registry
  Transport->>Contract: Header + provenance envelope
  Contract->>Contract: Parse and retain envelope
  Contract->>Provenance: Parsed body and authenticated header
  Provenance->>Search: Verified provenance registry
Loading

Reviews (1): Last reviewed commit: "fix(knowledge): retain model input prove..." | Re-trigger Greptile

@TheodoreSpeaks
TheodoreSpeaks merged commit ff378fa into staging Aug 11, 2026
30 checks passed
@TheodoreSpeaks
TheodoreSpeaks deleted the fix/knowledge-model-provenance branch August 11, 2026 15:57
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