Skip to content

fix: include retained evidence in merged reports - #1153

Merged
mldangelo-oai merged 1 commit into
mdangelo/codex/pr939-split-29-finding-sourcesfrom
mdangelo/codex/pr939-split-30-report-evidence
Oct 4, 2026
Merged

mldangelo-oai merged 1 commit into
mdangelo/codex/pr939-split-29-finding-sourcesfrom
mdangelo/codex/pr939-split-30-report-evidence

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Part 30 of 46. Previous: #1152 · Next: #1154 · Stack index

Summary

Include distinct summaries, root-cause, validation, dataflow, reachability, and severity details retained from source findings and earlier versions. Label the contributions so readers can follow their origin, including when the current finding links to a separate writeup.

Changes

  • Walk retained source/history records in stable order and deduplicate identical rendered detail sections and remediation paragraphs.
  • Render previous-version evidence even when a linked finding has only previousFindings; retain distinct historical summaries alongside the canonical summary.
  • Keep partial historical assessments with their own recorded fields, so current severity rationale or conditions are not attributed to an earlier source.

Testing

Local checks for the implementation:

  • Report projection tests: 71 passed. The linked previous-only and retained-summary assertions fail against the prior source.

Checks against the complete stack passed: SDK and MCP typechecks, formatting, Ruff, the SDK build, portable plugin compatibility and its tests, focused recovery/accounting tests, and local-artifact package smoke using exact cached dependencies. The package check was not a clean registry install. See this PR’s Checks tab for CI results for its current commit.

Risk and rollout

Rendered Markdown gains source labels and additional evidence sections. Finding IDs and evidence paths stay the same. Linked writeups with retained history also render that history inline; source sections can still repeat shared prose when their complete details differ.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai
mldangelo-oai requested a balanced review from Copilot October 1, 2026 06:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-04T17:35:15.680931Z db5196e Draft marked ready
🔒 Security Review ⚠️ Failed 2026-10-04T17:35:19.303189Z db5196e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Linked previous-only evidence is omitted, and partially overlapping sections still duplicate report text.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Extends report projection to include retained evidence from merged and historical findings while reducing duplicate remediation text.

Changes:

  • Renders retained root-cause, validation, dataflow, reachability, severity, and remediation details.
  • Adds coverage for deduplication, partial assessments, malformed history, and cycles.
File Description
plugins/​codex-security/​scripts/​report_projection.py Projects retained evidence into reports.
plugins/​codex-security/​tests/​test_report_projection.py Expands retained-evidence regression coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

"Reachability": ("attackPath",),
"Severity": ("severity", "attackPath"),
}
for source_id, original in retained_findings(finding):
Comment on lines +817 to +823
for heading, details in _finding_detail_sections(context).items():
key = (heading, tuple(details))
if key in seen or not any(field in original for field in source_fields[heading]):
continue
seen.add(key)
lines.extend(
["", f"#### {heading}", "", f"Source {_text(source_id, 'finding')}:", "", *details]

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4766892f17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"Reachability": ("attackPath",),
"Severity": ("severity", "attackPath"),
}
for source_id, original in retained_findings(finding):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Render retained history when a write-up is linked

When a finding has a writeup and only provenance.previousFindings, build_report_markdown selects _linked_finding_section, so this new retained-evidence loop never runs; that section preserves historical remediation only and drops prior root-cause, validation, attack-path, and severity evidence. Recovery and composition can produce this shape, so previous-history findings must also use the composed renderer or the final report silently loses retained evidence.

Useful? React with 👍 / 👎.

Comment on lines +799 to +803
source_fields = {
"Root Cause": ("rootCause", "root_cause"),
"Validation": ("validation",),
"Dataflow": ("attackPath",),
"Reachability": ("attackPath",),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve distinct retained summaries

For a composed finding whose child or earlier version contains unique information only in its required summary, that information is still discarded: _finding_detail_sections does not return a Summary section and this source-field map has no summary entry. Since the canonical merged summary can omit source-specific proof—the failure this change is meant to recover—distinct retained summaries should be deduplicated and rendered alongside the other source details.

Useful? React with 👍 / 👎.

Comment on lines +813 to +816
context[field] = {
**finding[field],
**(retained if isinstance(retained, dict) else {}),
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat invalid retained severity levels as absent

When an older retained payload has severity.level set to null, a list, or another non-string value, this shallow merge overwrites the valid canonical level and emits a second **Unknown** assessment, potentially paired with the canonical rationale and change conditions. Retained bodies are intentionally loosely typed and the added tests exercise these values, so an invalid retained level should not override the canonical level or generate a fabricated assessment.

Useful? React with 👍 / 👎.

Comment on lines +818 to +821
key = (heading, tuple(details))
if key in seen or not any(field in original for field in source_fields[heading]):
continue
seen.add(key)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Deduplicate retained evidence within each section

When a retained section overlaps the canonical section but adds one detail—for example, the same validation summary and assertion plus one new assertion—the tuple comparison treats the whole section as distinct and prints all shared text again under the source heading. This makes repeated evidence look like separate corroboration and can substantially duplicate merged reports; compare and render the individual details contributed by the source rather than deduplicating only exact whole-section matches.

Useful? React with 👍 / 👎.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-30-report-evidence branch from 4766892 to 44e6158 Compare October 1, 2026 07:25
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-29-finding-sources branch from 98677d2 to 022f16b Compare October 1, 2026 07:25
@mldangelo-oai mldangelo-oai changed the title fix: include retained source evidence in merged reports fix: include retained evidence in merged reports Oct 1, 2026

@faizan-oai faizan-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed retained evidence rendering at 44e6158. Report/projection coverage passes on the integrated stack, and this head has successful CI. No new issue found in this increment.

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the retained-evidence renderer at 44e61586a1a08ebf08ac862c7a7c051763a629c3 with three independent passes and root verification. Approval is withheld for the new historical-assessment attribution bug below. This also explains the existing invalid historical level concern: an unknown level is combined with current assessment text.

All 68 report-projection tests pass. Exact base/head probes reproduce the new attribution bug and repeated overlapping section text. Missing linked-only history, retained summaries, and confidence-only evidence were also reproduced, but those omissions already exist in the base and are not reported as newly introduced regressions. Overlapping text duplication is a lower-priority report-quality issue already covered by the existing comments.

Comment on lines +811 to +816
for field in ("severity", "confidence"):
retained = original.get(field)
context[field] = {
**finding[field],
**(retained if isinstance(retained, dict) else {}),
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] Do not attribute current assessment text to historical sources

This merge copies the current rationale and change conditions into a partial historical assessment. With current severity {level: "high", rationale: "Current remote path warrants high severity."} and retained severity {level: "low"}, the generated source-labelled section says **Low** — Current remote path warrants high severity. The historical source never supplied that rationale. I reproduced this at the exact head; the base does not emit the invented assessment. Use neutral missing-evidence defaults for absent historical text, and preserve only explicitly supplied historical rationale/change conditions. The same whole-object merge affects confidence-derived validation fallbacks.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-29-finding-sources branch from 022f16b to f3fcd7d Compare October 1, 2026 23:44
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-30-report-evidence branch from 44e6158 to a299e98 Compare October 1, 2026 23:44

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Three independent re-review passes and root reconciliation are complete for this restacked head.

The historical-assessment probe no longer attributes the current severity rationale to a partial historical entry. Remaining text duplication is low priority.

Approval is for this change. Integrated-tip validation passed 1,357 SDK tests (31 skipped), 105 MCP tests (2 skipped), portable checks, types/builds and installed-package smoke. Other stack findings and known CI fixture failures still prevent the stack from being mergeable.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-29-finding-sources branch from f3fcd7d to e8adf46 Compare October 2, 2026 00:36
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-30-report-evidence branch from a299e98 to 34928b2 Compare October 2, 2026 00:36

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed the real PR diff at 34928b2fd46d813333fb7f0ad1ffa109b06f1631. The patch is unchanged from the prior three-pass review. I reconciled the inherited changes in touched files and retained the prior verified findings and tests.

No serious outstanding finding identified in this patch; prior conclusions remain consistent with the unchanged change or the current re-review.

Validation across touched paths at branch tip 06e75cfe: 1,356 SDK tests, 867 Python tests plus 100 subtests, and 108 MCP tests passed; builds, types, portable checks and installed-package checks passed. These are integration checks at the branch tip, not a claim that every intermediate PR or its CI is clean.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-30-report-evidence branch 2 times, most recently from d2f24f3 to ceaa71a Compare October 2, 2026 01:56

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Retained the three independent passes for the identical patch and reconciled inherited touched-file changes at ceaa71a3a1f8.

No actionable introduced finding survives the independent reviews and root reconciliation of this exact patch, touched-file changes, and current integration checks.

Current tip 355ec321 passed 75 report-projection tests, portable source checks, SDK build:ci and plugin build. The immediately preceding tip fec36f1d passed 1,360 SDK tests, 873 Python tests plus 100 subtests, 109 MCP tests, builds/types and the clean 600-entry installed-package check. Only report_projection.py and its test changed between those tips; SDK/MCP runtime files are byte-identical. Both descend from main 008a8b4d. These are integration checks, separate from own-head probes. No native Windows local run.

No serious outstanding finding introduced by this PR. Code review approval does not establish CI or merge readiness.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-29-finding-sources branch from 0f6d79f to 9936a85 Compare October 2, 2026 02:47
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-30-report-evidence branch from ceaa71a to 84f2889 Compare October 2, 2026 02:47

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Retained the three independent passes for the verified identical patch and reconciled inherited touched-file changes at 84f2889ade99.

No actionable introduced finding survives the independent reviews and root reconciliation of this exact patch and inherited changes in touched files.

Integrated tip 6ef8cbb8, based on 008a8b4d, passed 1,388 SDK tests, 879 Python tests plus 100 subtests, 109 MCP tests, portable checks, builds and the clean 600-entry installed-package check. These are branch-tip integration checks, separate from own-head probes; no local Windows execution was performed.

No serious outstanding finding introduced by this PR. Code approval is separate from CI and merge readiness.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-30-report-evidence branch from 84f2889 to db5196e Compare October 2, 2026 03:52

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Retained three prior independent passes for the verified identical patch and reconciled inherited touched-file changes at db5196e844ed.

No actionable introduced finding survives the independent reviews and root reconciliation of this exact patch and inherited changes in touched files.

Branch tip 3e0083d9, based on 008a8b4d, passed 1,392 SDK tests, 881 Python tests plus 100 subtests, 109 MCP tests, builds, portable source checks and the 600-entry installed-package check. These are tip checks, separate from own-head probes. No local Windows run was performed. The tip excludes the dependency update merged separately in #1184; combined validation remains outstanding.

No serious outstanding finding introduced by this PR. Code approval is separate from CI and merge readiness.

@mldangelo-oai
mldangelo-oai marked this pull request as ready for review October 4, 2026 17:34
@mldangelo-oai
mldangelo-oai merged commit d8fdc41 into mdangelo/codex/pr939-split-29-finding-sources Oct 4, 2026
46 checks passed
@mldangelo-oai
mldangelo-oai deleted the mdangelo/codex/pr939-split-30-report-evidence branch October 4, 2026 17:34
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.

5 participants