Repository navigation
fix(media): roll back partial generated batches - #119292
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 2:11 PM ET / 18:11 UTC. ClawSweeper reviewWhat this changesThe PR makes generated image, music, and video batches delete files already persisted by the batch if a later save fails. Merge readinessKeep open for explicit maintainer handling: the rollback design is correct and sufficiently proven, but this protected PR remains behind main with an unfinished and a failed normal CI check in the supplied exact-head status. Priority: P2 Review scores
Verification
How this fits togetherGenerated-media tools convert provider buffers into managed media files before returning tool results to an agent. The new batch owner decides whether those writes become a complete result or are removed after a terminal persistence failure. flowchart LR
Provider[Generated media provider] --> Tools[Image music and video tools]
Tools --> Batch[Batch persistence owner]
Batch --> Store[Managed media store]
Store --> Decision{All saves succeed?}
Decision -->|Yes| Result[Tool media result]
Decision -->|No| Rollback[Delete batch files]
Rollback --> Error[Original persistence error]
Decision needed
Why: The patch is technically sound, but the protected maintainer label requires an explicit human merge decision after the branch and CI state are current. Before merge
Agent review detailsSecurityNone. PR surfaceSource +91, Tests +254. Total +345 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: 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 one shared generated-media batch transaction at the tool layer, retain the media store’s guarded delete primitive, and merge only after the refreshed exact head is fully validated. Do we have a high-confidence way to reproduce the issue? Yes. Current main directly exposes the failure path through concurrent image/music writes and uncompensated sequential video writes; the PR supplies focused boundary cases, though this read-only review did not execute them. Is this the best way to solve the issue? Yes. A single generated-media batch owner is the narrowest maintainable fix because it owns the provider-batch-to-tool-result boundary while reusing the media store’s existing guarded cleanup contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7a0a4c5f2a3b. 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
History |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Land-ready proof for
Production delta is +125/-34 for the shared ownership boundary; tests are +254/-0. No protocol, config, provider, schema, delivery, or successful-result contract changed. No proof gap remains. |
|
Merged via squash.
|
Punchcard-Session: crisp-lantern-orchard-nv * origin/main: (46 commits) perf(agents): reuse provider policy manifest registry (#119305) fix(media): roll back partial generated batches (#119292) fix(gateway): steer matching embedded turns (#119287) fix(telegram): correlate deliveries to explicit topics fix(plugins): preserve install index state across failures (#119228) test: trim redundant control ui coverage (#119286) test: cover missing config method in memory settings fix: gate curated config controls by method test: cover read-only admin method gates fix: keep config drafts on their gateway fix: reset agent skill filters with config patch refactor: reuse chat error state helper test: avoid unbound identity request assertion refactor: isolate clawhub skill search fix: guard delayed config actions across reconnects fix: preserve workshop revisions across session navigation refactor: isolate workshop revision handoff test: advertise skill action methods in ui e2e fix: fail stale workshop revision sends fix: bind revision handoffs to gateway snapshots ...
* fix(media): roll back partial generated batches * test(media): prove generated batch rollback on disk
…fecycle-20260804 * origin/main: perf(agents): reuse provider policy manifest registry (openclaw#119305) fix(media): roll back partial generated batches (openclaw#119292)
Closes #119284
What Problem This Solves
When one generated item in an image, music, or video batch failed to persist, files already saved by the same batch were left in the managed media store even though the tool returned an error and no result referenced them. Concurrent image/music saves could be worse:
Promise.allreturned the first rejection while another filesystem write was still running, allowing a late orphan to appear after failure was already reported.Root Cause
Each tool owned its own save loop but none owned batch commit/rollback semantics:
Promise.all, which rejects before sibling writes settle;Current-main reproduction at
1cf1af4aed3dedb010a885fcc9dc652f6d6d93d2added one boundary case per tool. All three failed while the other 125 tests passed.What Changed
deleteMediaBuffer, best-effort cleanup cannot mask the original persistence error, and successful result ordering is preserved.No protocol, configuration, provider, storage schema, background-task, delivery, or successful-result contract changes.
Observed Behavior
The fixed tests prove:
saveMediaBufferwrites resolve and contain the expected bytes before failure, thenresolveMediaBufferPathrejects after rollback;Evidence
Exact head:
4140df297a113d167e3cdbe74d5db1954d74fa63.generated-media-batch-persistence.test.tspassed 2/2 cases using an isolatedOPENCLAW_STATE_DIR; each case read the persisted bytes from the canonical resolved path before failure and observed the canonical resolver's missing-file error after rollback.openclaw-live-updater.test.tsand a cron Vitest process that stopped emitting output after its assertions passed; both exact failed jobs passed their single reruns.tbx_01kz6tt1adjkk19ny8e0kyf5nt, https://github.com/openclaw/openclaw/actions/runs/30930890368: core production/test types, lint, formatting, dead exports, plugin boundaries, media guards, and import cycles passed.tbx_01kz6vewf9mvqb7w129hx3t393, https://github.com/openclaw/openclaw/actions/runs/30931787346: full dist, declarations, Plugin SDK export gate, Control UI production build, and performance guard passed.git diff --checkand targeted oxfmt/oxlint passed.Repair Doctrine Summary
Release-note context: generated image, music, and video batches no longer leave managed-media files behind when a later item fails to save.
AI-assisted: yes.