feat(sdk): publish findings through durable concurrent batches - #453
feat(sdk): publish findings through durable concurrent batches#453kmbroai wants to merge 45 commits into
Conversation
soyeon-oai
left a comment
There was a problem hiding this comment.
Reviewed the exact PR delta and exercised the stacked CLI against a real synthetic Linear publication. I found three durability/verification issues.
| const eventFailure = eventFailed.get(issue.findingId); | ||
| if ( | ||
| saved === undefined && | ||
| !observed.has(issue.findingId) && |
There was a problem hiding this comment.
[P1] Do not let a model-authored failure override a verified successful tool event. In a live synthetic E2E, the runtime observed and displayed a created Linear issue, but the handoff writer then failed and emitted a failure record; observed blocked this salvage path, so the CLI returned created: 0, persisted no association, deleted the handoff, and left the real issue remote. A retry would duplicate it. Prefer the exact-argument completed tool receipt, or retain recovery state and report an indeterminate outcome.
There was a problem hiding this comment.
This was reproduced in my e2e.
# Conflicts: # sdk/typescript/tests-ts/publish.test.ts
# Conflicts: # sdk/typescript/src/publish.ts # sdk/typescript/tests-ts/publish.test.ts
| ); | ||
| continue; | ||
| } | ||
| if (observed.has(issue.findingId)) { |
There was a problem hiding this comment.
[P1] Preserve both successful issue IDs when duplicate handoffs are detected.
Found during E2E review:
completed issues: SYNTH-DUPLICATE-A, SYNTH-DUPLICATE-B
CLI: created=0, failed=1 | SQLite associations=0 | recovery handoffs=0
Detecting duplicates is correct, but discarding both IDs and deleting the handoff makes already-created issues unrecoverable. Persist the verified IDs or retain the handoff and report an indeterminate outcome.
| handoffResults.created, | ||
| ); | ||
| try { | ||
| result.created = await ( |
There was a problem hiding this comment.
[P2] Prevent concurrent publications from overwriting successful receipts.
Found during E2E review:
concurrent publication A: success
concurrent publication B: success
SQLite associations=2 | issues in the shared scan receipt=1
Fresh issues on republish are documented; silently losing one successful run from the scan-keyed receipt is the defect. Serialize same-scan publication or write attempt-scoped receipts.
| environment, | ||
| ); | ||
| options.signal?.throwIfAborted(); | ||
| const handoff = await createPublicationHandoff(prepared, environment); |
There was a problem hiding this comment.
[P2] Remove source-bearing handoffs when the publisher cannot start.
Found during E2E review with a missing CODEX_CLI_PATH:
CLI exit=2 | spawned processes=0 | remote mutations=0
retained publication.json=1447 bytes | finding description=1011 bytes
The startup rejection bypasses cleanup, leaving finding details and source locations on disk despite no recoverable remote operation. Delete pre-mutation handoffs on startup failure.
# Conflicts: # sdk/typescript/src/publish.ts # sdk/typescript/tests-ts/publish.test.ts
# Conflicts: # sdk/typescript/scripts/check-package.mjs
# Conflicts: # sdk/typescript/scripts/check-package.mjs
The base branch was changed.

Summary
Publish prepared security findings in bounded concurrent batches and derive final results from validated durable records stored in local scan history.
Changes
Testing
Risk and rollout
Public disclosure review