Repository navigation
refactor: separate old worker draft handling - #1155
mldangelo-oai merged 2 commits into
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
Pre-index checkpoint recovery regresses, and the extracted worker reconciliation lacks direct regression coverage.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Separates legacy Deep Scan worker draft handling from ordinary scan drafts.
Changes:
- Extracts worker draft parsing, checkpointing, and reconciliation.
- Routes worker, reducer, and validation paths through the extracted module.
- Preserves candidate evidence and resolved coverage state.
| File | Description |
|---|---|
artifact-worker-scan-draft.ts |
Adds legacy worker draft protocol implementation. |
artifact-validation.ts |
Uses worker-specific draft helpers. |
artifact-deep-reducer.ts |
Uses worker checkpoint and parsing helpers. |
compact-artifact-tools.ts |
Routes worker draft writes to the new module. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (context.layout !== "worker") { | ||
| const marker = await artifactDestination( | ||
| context, | ||
| ["checkpoints", "pending", name], | ||
| "scan checkpoint marker", | ||
| ); | ||
| await replaceArtifactText(marker, ""); | ||
| } | ||
| const destination = await artifactDestination( | ||
| context, | ||
| ["checkpoints", name], | ||
| "scan checkpoint", | ||
| ); |
| if (input.complete === false) { | ||
| const final = sources.find((source) => source.complete !== false); | ||
| if (final) { | ||
| result = structuredClone(final); | ||
| sources.push(input as SemanticScan); | ||
| } | ||
| } | ||
| const resolvedSurfaces = resolvedCoverageSurfaceIds(result.coverage, sources); |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f342f7afe
ℹ️ 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".
| Array.isArray(item.surfaceIds) && | ||
| item.surfaceIds.length > 0 && | ||
| item.surfaceIds.every( | ||
| (id) => typeof id === "string" && resolvedSurfaces.has(id), | ||
| ) |
There was a problem hiding this comment.
Preserve deferred work on already-resolved surfaces
When an earlier checkpoint contains a generic deferred item whose surfaceIds reference a surface already marked reported or no_issue_found, and a later draft repeats that surface but omits the deferred item, this predicate treats the surface as resolved and silently discards the outstanding work. Deferred work is independent of surface disposition—a reported surface may still require additional review—so omission can incorrectly change coverage to complete and hide unfinished analysis. Only infer resolution from an actual transition out of needs_follow_up or another explicit resolution signal.
AGENTS.md reference: AGENTS.md:L42-L43
Useful? React with 👍 / 👎.
| function findingCandidateId(finding: JsonObject): string | undefined { | ||
| return [ | ||
| isObject(finding.provenance) ? finding.provenance.candidateId : undefined, | ||
| isObject(finding.extensions) ? finding.extensions.candidateId : undefined, | ||
| ].find((id): id is string => typeof id === "string" && id.trim().length > 0); |
There was a problem hiding this comment.
Retain legacy report IDs when matching worker candidates
On retries or resumptions of older Deep workers, a finding may lack candidateId and carry only extensions.reportId or extensions.ledgerRowId; the compatibility projection in scripts/finalize_scan_contract.py:2524-2529 still treats both as fallback candidate identities. Restricting this helper to candidateId prevents sameSavedFinding and deferred reconciliation from associating such a finding with its saved candidate, so a refinement can duplicate the prior finding or leave an already-reported candidate deferred instead of transferring its evidence. Preserve the previous fallback order for these legacy identifiers.
AGENTS.md reference: AGENTS.md:L42-L43
Useful? React with 👍 / 👎.
| import { | ||
| recordCodexSecurityWorkerScanDraft, | ||
| type ScanDraftInput, | ||
| } from "../artifact-worker-scan-draft.js"; |
There was a problem hiding this comment.
Exercise the split worker implementation in reconciliation tests
These imports move the production worker tool to artifact-worker-scan-draft.ts, but tests/test_artifact_scan_draft.mjs:23-40 still bundles artifact-scan-draft.ts and invokes its old duplicate recordCodexSecurityWorkerScanDraft. The compact-server test only checks validation and a first empty write, so the extensive retry, archived-checkpoint, and evidence-reconciliation cases now exercise an implementation that production workers no longer call. Point those worker cases at the split module so behavioral changes here are actually covered.
Useful? React with 👍 / 👎.
8f342f7 to
da5f664
Compare
6bd22a2 to
76aa937
Compare
alandelong-oai
left a comment
There was a problem hiding this comment.
Reviewed the worker draft split at da5f6642f517be8f6bbd461975d669b62b3a2a1e with three independent passes and root verification. Approval is withheld for two reproduced P2 regressions:
- Unresolved work can disappear from an already resolved surface. With an unchanged
no_issue_foundsurface and an independent deferred review, the old module retains partial coverage; the split module drops the review and reports complete coverage. - Legacy candidate identifiers no longer reconcile. For each of
extensions.reportIdandextensions.ledgerRowId, the old module associates the reported finding with its saved candidate and transfers the evidence; the split module leaves the candidate deferred.
All four existing MCP test files pass. I also redirected the existing worker regression cases to the split module in a disposable harness. They pass after adjusting the one old expectation that discarded late incomplete evidence; the checked-in suite still exercises the old implementation, as noted in the existing coverage comments. No repository files were changed.
76aa937 to
c469e17
Compare
da5f664 to
304afa5
Compare
alandelong-oai
left a comment
There was a problem hiding this comment.
Reconciled the unchanged patch and prior three-pass review against this exact restacked head.
The touched files and patch are unchanged, so the prior worker identity/deferred-coverage findings remain at this own head. The old worker implementation is removed later by #1169; that removal is not an own-head fix for this PR.
Approval remains withheld. This review distinguishes the PR's own head from fixes verified later in the stack; it does not duplicate existing inline findings.
c469e17 to
976f84b
Compare
304afa5 to
78c764d
Compare
There was a problem hiding this comment.
Re-reviewed the real PR diff at 78c764dc6ce25dcf11041aa9603a6dcf63610130. 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.
The touched files and patch are unchanged, so the prior worker identity/deferred-coverage findings remain at this own head. The old worker implementation is removed later by #1169; that removal is not an own-head fix for this PR.
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. Latest workflow runs for this unchanged head were verified successful at 2026-10-02 01:26 UTC. Earlier failed or canceled job records are superseded; this CI status correction does not alter the review decision.
976f84b to
6d44799
Compare
071ccdf to
99ad9d7
Compare
6d44799 to
6490f01
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 99ad9d77fab5.
The legacy worker now recognizes reportId and ledgerRowId, and resolves deferred coverage only after an actual transition from needs_follow_up. The own-head worker identity and reducer tests pass, including eight identity/recovery cases. Both prior holds are fixed before the later worker removal.
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.
6490f01 to
fbdec7f
Compare
99ad9d7 to
5560aef
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 5560aef89306.
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.
fbdec7f to
c612e66
Compare
5560aef to
6852a44
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 6852a44ba247.
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.
Consolidate approved Deep Scan changes into the parent topic branch.
585cf4b
into
mdangelo/codex/pr939-split-31-saved-drafts


Part 32 of 46. Previous: #1154 · Next: #1156 · Stack index
Summary
Move Deep Scan worker and reducer draft handling into a separate module before changing ordinary scan draft updates.
Changes
Testing
Eight production-worker identity/evidence cases, the complete legacy draft script and the reducer retry regression passed at their owning boundaries.
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
The legacy worker runner still uses these helpers at this stage, so this changes active reconciliation behavior as well as moving code. The later plugin switch and cleanup retire this protocol.
Public disclosure review