Skip to content

fix(insights): ground publication decisions in cited evidence - #778

Merged
izadoesdev merged 4 commits into
stagingfrom
codex/claim-evidence
Sep 9, 2026
Merged

fix(insights): ground publication decisions in cited evidence#778
izadoesdev merged 4 commits into
stagingfrom
codex/claim-evidence

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Sep 9, 2026

Copy link
Copy Markdown
Member

Problem and behavior

Investigations could decide to publish before organizing their evidence, lose facts while repairing citations, and turn an inconclusive saved recovery check into an unsupported new repair. This change pairs each claim with its sources and aligns the finish schema with the evidence-first publication policy.

Scheduled goal/funnel checks and explicit Apply verification replies now perform one exact native analytics read with zero model calls. Code validates the returned subject, definition, population, full UTC window, sample and threshold; it reports passed, failed or inconclusive without inventing a cause or repair. Future windows preserve an open case and the saved check until midnight UTC after the inclusive end. Free-form human replies still reach the agent with their context. Inconclusive checks alone cannot justify a new manual repair; independently inspected implementation evidence is required. Native read inputs, results and failures are correlated in production logs.

Retention evidence supplies the measured identity percentage beside its original counts. The dashboard uses “Conclusion” for a closed outcome, which can be inconclusive. Stored contracts remain compatible; no database migration.

Evaluation and review

  • Four earlier candidates ran 236 fresh synthetic model investigations. Faster-but-worse variants were rejected. The previous green-CI, Greptile-reviewed head was held after semantic audit found a false manual repair.
  • The final native check path passes 12 executions across six scenarios with network/model access denied. In eight matched scenarios, verification model turns drop from 18 to zero. Native stub latency is not a production database latency estimate.
  • All 44 unaffected candidate traces replay through the prior and current frozen agents with identical model requests, outcomes and errors. Replays are regression evidence, not new model-quality runs.
  • Eight fresh alternating before/after human-reply model runs passed their checks and full output audit. Both arms were correct; one candidate run made an extra lookup, so this is preservation evidence, not a general reply-quality gain. The recorded unsupported repair is separately rejected by a regression test even after its structured check is dropped.
  • Root lint, all 33 typecheck tasks, 638 Insights tests (six live-only tests skipped), 26 shared tests and all 27 root pre-push test tasks pass; fresh full CI is required before merge. Independent review found and fixed premature future-check closure and missing production read telemetry. Fresh Greptile review must cover the final commit, with all PR comments/threads resolved.

Known limits: this is synthetic evidence, not proof the service warrants its subscription price. General investigation outputs can still omit low-identity caveats or currency controls, publish undersampled requested cohorts, and reject valid abbreviated dates during numeric grounding. These are retained findings, not reported as solved. Production source LoC increases to remove model work; no LoC reduction is claimed.

Scope and overlap

One investigation evidence/verification slice based on current staging; no PR dependency. Draft #751 overlaps agent.ts and SPEC.md by filename and will need to reconcile those surfaces independently. AI-assisted maintainer implementation, manually reviewed with observable input/tool/output audits.

@unkey-deploy

unkey-deploy Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Unkey Deploy

Name Status Preview Inspect Updated (UTC)
links (preview) Ready Visit Preview Inspect Sep 9, 2026 8:01pm

@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
dashboard Ready Ready Preview Sep 9, 2026 8:02pm UTC
databuddy-status Ready Ready Preview Sep 9, 2026 8:02pm UTC
documentation Ready Ready Preview Sep 9, 2026 8:02pm UTC

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ec1f90fe-ba12-40f6-911c-d9b7451f588d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@izadoesdev izadoesdev changed the title fix(insights): keep evidence claims with their sources fix(insights): ground publication decisions in cited evidence Sep 9, 2026
@izadoesdev
izadoesdev marked this pull request as ready for review September 9, 2026 18:14
@izadoesdev

Copy link
Copy Markdown
Member Author

@greptileai Please review the complete current diff at 9235c19, including claim/source normalization, publication guidance, coverage formatting, and unchanged runtime guards. This is an explicit request for review of the final code head; fresh heldout semantic evaluation remains a separate merge gate.

@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR grounds investigation publication decisions in claim-bound citations and replaces scheduled or explicit Apply recovery checks with deterministic native analytics verification.

  • Couples each evidence claim directly to its contributing sources before publication is selected.
  • Validates saved goal and funnel checks against the exact subject, definition, population, UTC window, sample requirement, and threshold.
  • Preserves unfinished verification windows through the watch lifecycle while keeping inconclusive outcomes private.
  • Retains free-form replies for agent investigation and adds correlated diagnostics for native reads.
  • Adds retention identity coverage and changes resolved dashboard copy from “Verified” to “Conclusion.”

Confidence Score: 5/5

The PR appears safe to merge with no actionable new defects identified.

The deterministic verification path validates exact measurement metadata and thresholds, preserves future checks as watches, keeps inconclusive outcomes private, and prevents unsupported repairs; claim-bound citations remain compatible with the stored text outcome.

Important Files Changed

Filename Overview
apps/insights/src/agent.ts Adds claim-bound finish evidence and a deterministic, validated native verification path with cancellation and telemetry.
apps/insights/src/resume.ts Marks only the shared Apply reply template as explicit verification intent while preserving free-form reply handling.
packages/shared/src/insights.ts Exports the evidence-reference schema and centralizes the Apply verification reply template.
packages/rpc/src/routers/insights.ts Uses the shared Apply reply template when queuing post-action verification.
apps/insights/src/native-verification.test.ts Covers deterministic verdicts, lifecycle persistence, read failures, cancellation, telemetry, and model bypass.
apps/insights/src/measurement-plan.ts Adds measured identity coverage percentages alongside retention source counts.
apps/dashboard/app/(main)/insights/[id]/page.tsx Relabels resolved outcomes as conclusions so inconclusive closure is not presented as verified recovery.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Scheduled recheck or reply] --> B{Explicit Apply verification or no human request?}
    B -- No --> C[Investigation agent]
    C --> D[Claim-bound evidence and sources]
    D --> E[Validate publication decision]
    B -- Yes --> F[Load saved goal or funnel check]
    F --> G[One native analytics read]
    G --> H[Validate subject, definition, population, window, sample, threshold]
    H --> I{Window finished?}
    I -- No --> J[Keep case open as watch]
    I -- Yes --> K[Passed, failed, or inconclusive conclusion]
    K --> L[Resolve without creating a new repair]
Loading

Reviews (2): Last reviewed commit: "fix(insights): verify saved recovery che..." | Re-trigger Greptile

@izadoesdev
izadoesdev marked this pull request as draft September 9, 2026 18:52
@izadoesdev

Copy link
Copy Markdown
Member Author

Holding merge after the final semantic audit despite green CI and code review. The candidate improved common-checker passes (48/52 vs 38/52) and reduced model turns (106 vs 127), but one population-mismatch verification invented an unsupported manual repair after dropping its rejected structured check. I am replacing model-authored saved-check conclusions with native exact-read verification and deterministic output, then rerunning the affected cases before requesting fresh review. Original runs and failures remain preserved.

@izadoesdev

Copy link
Copy Markdown
Member Author

@greptileai Please review final head 065a527. The previous reviewed head was deliberately held after output audit found an unsupported verification repair. This revision adds deterministic scheduled/Apply checks, preserves future checks through the watch lifecycle, retains free-form human replies, records native read diagnostics, and rejects unsupported manual repairs from inconclusive checks. Please review the complete current diff, especially the agent/resume/persistence boundary and shared Apply reply template. All comments and review threads must be addressed before merge.

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