Skip to content

feat(review): persist provider-neutral execution provenance - #182

Open
gutierrezje wants to merge 1 commit into
mainfrom
feature/106-review-provenance
Open

gutierrezje wants to merge 1 commit into
mainfrom
feature/106-review-provenance

Conversation

@gutierrezje

@gutierrezje gutierrezje commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

What

Closes #106.

Reviews now retain provider-neutral execution provenance in SQLite and JSON: observed runtime/model identity, native correlation IDs, policy, prompt/configuration/context hashes, validation attempts, reported usage, and failure classification. Unavailable facts remain unknown. The existing operation, reviewer role, and optional cohort ID remain the identity anchors.

How

  • Define a typed evidence contract and translate Codex, OpenCode, and Cursor SDK metadata into it. Strip undeclared provider payload fields before journal persistence.
  • Persist snapshots on the existing execution row so failed, cancelled, and timed-out runs retain observations received before termination.
  • Extend the single unreleased migration 8 with evidence_json. Preserve published migrations 1–7 and historical execution records. Add evidence to the existing JSON projection without changing its required telemetry fields.
  • Document comparison inputs, observational metadata, and backend-specific limits in docs/review-provenance.md.

Start with src/review/execution-evidence.ts, then the execution journal/repository and JSON mapper; adapter changes supply the observations.

Why

A requested model name and a successful report cannot establish whether two reviews used comparable inputs, policies, runtimes, or retry paths. Local provenance makes those differences inspectable without storing raw prompts, credentials, account data, or provider responses in the evidence envelope. Native IDs are correlation fields, not conversation-resumption handles.

Evidence

  • pnpm run lint and pnpm exec tsc --noEmit: passed.
  • GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=commit.gpgsign GIT_CONFIG_VALUE_0=false pnpm run test: 1,123 passed, 7 skipped across 89 passing test files. Includes privacy stripping, JSON projection, durable roundtrips, failure/cancellation/timeout snapshots, and migration compatibility. The prior isolated Codex process-teardown failure passed on rerun and in the final full suite.
  • Fresh build and live synthetic staged reviews through node dist/cli.js review --staged --depth shallow --format json: Codex gpt-5.6-luna on CLI 0.154.0 and OpenCode opencode-go/deepseek-v4-flash on runtime 1.18.29 both passed. Every evidence field matched the durable SQLite record; report creation, unchanged repository state, and child/server teardown passed. OpenCode reported zero usage counters; preservation is verified, metering accuracy is not claimed.
  • Built-CLI schema 7→8 upgrade preserved linked reviews, executions, findings, and historical dispositions. A public finding disposition created only its intended event. Foreign-key and integrity checks passed. An incompatible schema-8 checksum was rejected without mutation.
  • Structural quality review completed. Cursor evidence is covered by worker/protocol tests; a live Cursor SDK run was not performed.

Review status and migration risk

The automatic post-commit review failed before provider work because the installed reviewer supports schema 7 and the existing development database uses schema 8. The new binary also correctly rejects that database's earlier schema-8 checksum. Existing user state was preserved. Full-branch model-review coverage and a current-head readiness verdict remain pending; this PR does not claim merge acceptance.

Schema 8 is still unreleased (latest published package: 0.5.2, schema 7). Earlier development databases with a different schema-8 checksum require an explicit backup/recovery decision; they are not silently rewritten. Hosted checks will run on the published head.

No hosted analytics, credential/account management, conversation resumption, or model-quality ranking is added.


Note

Medium Risk
Touches all review backends, SQLite execution persistence, and the JSON export contract, though changes are additive with sanitization and broad test coverage.

Overview
Adds durable, provider-neutral execution provenance so reviews can be compared on inputs and runtime facts, not just requested model names.

A new typed evidence contract captures runtime/adapter identity, policy, prompt and pipeline hashes (rules, config, schema, context manifest), native correlation IDs, structured-output attempts, usage, and failure categories—with unknown fields left explicit and secrets/raw prompts stripped before persistence. Codex, OpenCode, and Cursor adapters stream snapshots through onProvenance; the review journal writes them to evidence_json on the existing execution row (including failed, cancelled, and timed-out runs). Terminal executions promote to provenance schema v5 when evidence is present; JSON output adds an optional execution.evidence block without changing the required telemetry wire shape. Migration 8 gains evidence_json alongside readiness coverage; older rows keep null evidence. README and docs/review-provenance.md document comparison semantics and per-backend limits.

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

@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c73f8609-39ef-4524-bc9b-f7092e695268


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7c68705. Configure here.

Comment thread src/cursor/executor.ts
"Cursor reasoning overrides are not supported. Omit --reasoning, select Cursor with `diffowl backend cursor`, then clear its local override with `diffowl reasoning --reset`, and remove deprecated reasoning.effort from .diffowl.yml.",
);
}
const evidence = createUnknownReviewRuntimeEvidence();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor early exits skip provenance

Medium Severity

Already-aborted reviews and unsupported reasoning overrides throw before evidence is created or onProvenance runs, so the journal never records cursor-sdk identity or a cancelled/protocol failureCategory. Codex and OpenCode publish a snapshot first; Cursor only classifies failures inside the later try/catch.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7c68705. Configure here.

Comment thread src/opencode/executor.ts
if (error instanceof ReviewTimeoutError) return "timed-out";
if (error instanceof SchemaValidationError) return "validation";
return "unknown";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenCode misclassifies known failures

Medium Severity

classifyFailure only maps cancellation, timeout, and SchemaValidationError. OpenCode already detects quota or rate-limit exhaustion and rejects with a generic Error, so those runs persist failureCategory: "unknown" instead of quota. Other adapter-identified session failures collapse the same way.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7c68705. Configure here.

This branch has not been deployed

No deployments
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.

Persist provider-neutral review provenance and cohort identity

1 participant