fix: delete unpublished package zip on publish failure - #3622
Conversation
Non-npm-pack publishes stored a legacy zip before version and reuse checks. A duplicate version or insert failure left the new Convex blob unreferenced. Store the zip only when insert is about to own it, and delete it if insert fails. Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
@SebTardif is attempting to deploy a commit to the OpenClaw Foundation Team on Vercel. A member of the Team first needs to authorize it. |
|
Codex review: needs real behavior proof before merge. Reviewed September 11, 2026, 10:08 AM ET / 14:08 UTC (Revision 2). ClawSweeper reviewWhat this changesDefers package ZIP storage until release insertion, deletes the newly created ZIP when insertion fails, and adds two regression tests. Merge readiness⛔ Blocked before merge - 3 items remain Keep open: current main and v0.23.3 retain the early ZIP write. This is a useful, focused repair with no blocking code findings, but the previous real-Convex proof requirement remains unmet. Priority: P2 Review scores
Verification
How this fits togetherClawHub’s package publishing backend accepts authenticated uploads and creates release records linked to downloadable artifacts. This change manages the generated ZIP between validation and release insertion. flowchart TD
A[Authenticated package upload] --> B[Validate package and check existing release]
B --> C[Reject or reuse existing result]
B --> D[Store generated ZIP if needed]
D --> E[Insert release]
E --> F[Retain ZIP for downloads]
E --> G[On insertion failure delete new ZIP]
Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep generated-ZIP cleanup at the release-insertion boundary, preserving caller-owned artifacts and ZIPs attached to successful releases. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main stores a ZIP before staged duplicate rejection and has no cleanup for that unowned blob. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes, for the rejected-publish scope: deferring storage and wrapping insertion addresses the owning layer directly. HTTP-only cleanup would miss direct publish actions, and pending-release cleanup cannot find a ZIP never attached to a release. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cbfee7343ddc. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
What Problem This Solves
Fixes an issue where users publishing a non-npm-pack package would leave an unreferenced Convex zip in storage when the version already existed or release insert failed. Authenticated
packages.publishReleaseand GitHub Actions publish both hit this path whenartifact.kindis notnpm-pack.The zip is stored only for the release row. A duplicate-version reject or insert failure never attached it, and
discardPendingPackagePublicationInternalonly deletes blobs already on a pending release.Why This Change Was Made
Store the legacy zip immediately before
insertReleaseInternal, after version and reuse checks. If insert throws, delete that new id. npm-pack publishes and caller-suppliedartifact.storageIdare unchanged. This is not the multipartpackagesV1cleanup in #3613.User Impact
Failed package publishes no longer leave orphan zip blobs in Convex storage. Successful publishes still attach the zip to the new release.
Evidence
Live
bunrun ofpublishPackageForTrustedPublisherInternalagainst this branch.Duplicate-version reject: no
storage.store. Insert failure:storethendeleteofstorage:legacy-zip. Leftover ids: none.On unfixed main the duplicate-version path stores
storage:legacy-zipand never deletes it.Real behavior proof
fix/package-publish-legacy-zip-cleanuponorigin/maind3bde70e, livebuncallingpublishPackageForTrustedPublisherInternalwith a blocked attempt and with a throwing insert mutation.bun /tmp/proof-f010-legacy-zip.mtsfrom the patched worktree (proof helper not committed).storage:legacy-zipthen deletes that same id. The version-exists error is rethrown.Summary
Same cleanup class as #3612, #3613, and #3614, but in
publishPackageImplrather than multipart parse, GitHub import, or skill-card attach.The store landed in #3090 (
85a3fde608) on 2026-07-24.Tracker
Ref #3677
That issue stays open if this PR is closed without landing on main.