Repository navigation
fix: include retained evidence in merged reports - #1153
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Linked previous-only evidence is omitted, and partially overlapping sections still duplicate report text.
Review effort: Balanced
Findings: 2
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): |
| 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] |
There was a problem hiding this comment.
💡 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): |
There was a problem hiding this comment.
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 👍 / 👎.
| source_fields = { | ||
| "Root Cause": ("rootCause", "root_cause"), | ||
| "Validation": ("validation",), | ||
| "Dataflow": ("attackPath",), | ||
| "Reachability": ("attackPath",), |
There was a problem hiding this comment.
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 👍 / 👎.
| context[field] = { | ||
| **finding[field], | ||
| **(retained if isinstance(retained, dict) else {}), | ||
| } |
There was a problem hiding this comment.
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 👍 / 👎.
| key = (heading, tuple(details)) | ||
| if key in seen or not any(field in original for field in source_fields[heading]): | ||
| continue | ||
| seen.add(key) |
There was a problem hiding this comment.
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 👍 / 👎.
4766892 to
44e6158
Compare
98677d2 to
022f16b
Compare
faizan-oai
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
| for field in ("severity", "confidence"): | ||
| retained = original.get(field) | ||
| context[field] = { | ||
| **finding[field], | ||
| **(retained if isinstance(retained, dict) else {}), | ||
| } |
There was a problem hiding this comment.
[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.
022f16b to
f3fcd7d
Compare
44e6158 to
a299e98
Compare
alandelong-oai
left a comment
There was a problem hiding this comment.
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.
f3fcd7d to
e8adf46
Compare
a299e98 to
34928b2
Compare
alandelong-oai
left a comment
There was a problem hiding this comment.
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.
d2f24f3 to
ceaa71a
Compare
alandelong-oai
left a comment
There was a problem hiding this comment.
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.
0f6d79f to
9936a85
Compare
ceaa71a to
84f2889
Compare
alandelong-oai
left a comment
There was a problem hiding this comment.
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.
84f2889 to
db5196e
Compare
alandelong-oai
left a comment
There was a problem hiding this comment.
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.
d8fdc41
into
mdangelo/codex/pr939-split-29-finding-sources

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
previousFindings; retain distinct historical summaries alongside the canonical summary.Testing
Local checks for the implementation:
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