fix(wizard): no borrar workflows hermanos tras un merge CAS a mitad de un avance - #263
Draft
cursor[bot] wants to merge 2 commits into
Draft
fix(wizard): no borrar workflows hermanos tras un merge CAS a mitad de un avance#263cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
…en() Pin the collection that still holds the running workflow before execute() yields. Switching folders mid-step no longer drops the finished checkpoint on the source workspace or writes it into the destination. Co-authored-by: ignaciodelcano+dcl <ignaciodelcano+dcl@gmail.com>
Pinning persist to the pre-open collection reused that snapshot for every checkpoint in the same advance. A conflict retry only patched its revision, so the next persist cloned the pre-merge list and dropped workflows the merge had just adopted. Co-authored-by: ignaciodelcano+dcl <ignaciodelcano+dcl@gmail.com>
PR Review — Loreframe StudioRisk: low Automated review from Findings
Changed files
CONTRIBUTING checklist
Posted by the repo PR review workflow. Re-runs on each push to the PR. |
Code healthQuality score: 55.5/100Higher is better. The score is a trend dashboard; the independent ratchet below remains the CI gate.
Change vs PR base: +0.0 points.
Markdown, JSON catalogs and tests are out of this table. Only Most complex functions
Trend vs baseline
Warnings
Ratchet passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen ejecutivo
Qué cambia
Tras un conflicto CAS a mitad de un
advance(), el runtime del Wizard adopta los workflows remotos en la colección viva del owner en vez de reutilizar el snapshot anterior al merge.Para qué sirve
El pin de persistencia de #258 reutilizaba esa colección en todos los checkpoints del mismo avance. Un retry CAS solo parcheaba
revision, así que el siguiente persist clonaba la lista previa al merge y borraba workflows que otra pestaña acababa de añadir.Impacto para el usuario
Un workflow de varios pasos que choca con un guardado concurrente ya no puede borrar checkpoints hermanos del mismo workspace.
Riesgo
Estado
Summary
#258 pins persist to
{workspace, collection, openSequence}beforeexecute()yields so a folder switch cannot retarget the checkpoint. That pin is reused for every persist in the same advance. On CAS conflict,persist()merged into a clonedcandidateand only copiedrevisionback ontoowner.collection.The next persist in the loop cloned the pre-merge owner (now with a matching revision) and saved it without the sibling workflows the merge had just written. Concrete trigger: another tab inserts a workflow and bumps the revision while step 1 of a two-step advance is executing; step 1's persist merges correctly, step 2's persist wipes the sibling.
adoptPersistMerge()now copies remote-only (or newer remote) workflows into the live owner collection and keeps the in-memory objectsadvanceUnlockedis mutating. Destination isolation afteropen()is unchanged.This branch also contains the persist-after-
open()pin from #258. If #258 merges first, only the CAS adopt commit remains here.Overview
execute()is in flight.completedwith bothoutputRefs.Detailed changes
Backend
No backend changes.
UI and Wizard
persist()adopts the merged snapshot into the pinned owner collection after a CAS retry.this.collectionis only rebound to that owner when the runtime still owns the open target.Data, provenance and compatibility
No migration. Workspace isolation after
open()is unchanged.Files and ownership
ui/src/features/agent/wizardWorkflowRuntime.ts— adopt merged siblings into the pinned owner.ui/tests/wizardWorkflowRuntime.test.mjs— inject a sibling mid-execute and assert it survives the next persist.Validation
Date (UTC): 2026-09-08
Base SHA: 2072943
Head SHA: 0840eef
Validation scope: focused
python3 scripts/verify_clean_repo.py— PASSpython -m compileall -q app/services app/launch.py scripts— N/A (UI-only)Focused Python tests: N/A (UI-only)
cd ui && npm run i18n:check— not required (no catalog changes)UI tests:
npx tsx --tsconfig tsconfig.app.json --import ./tests/setupI18n.ts --test tests/wizardWorkflowRuntime.test.mjs tests/wizardConversationPersistence.test.mjs tests/rhythmic3dWorkflow.test.mjs— 35/35 passnpx eslint src/features/agent/wizardWorkflowRuntime.ts tests/wizardWorkflowRuntime.test.mjs --max-warnings=0— passcd ui && npm run build— not run (logic-only runtime change)git diff --check— cleanE2E/smoke checks: N/A (unit-reproduced CAS overwrite; no UI surface change)
Code quality
main: pending CICI and review
CI of this HEAD: pending
Cursor/Bugbot of this HEAD: pending
Independent agent review of this HEAD: pending
Human merge click (operational, not code review): pending
Reviewed at current HEAD
Earlier review; HEAD has changed since (stale)
Pending
Unavailable
Coste de la tarea
Notes and limitations
saveWizardWorkflows.updatedAt.Follow-up work
open()lost checkpoint.Checklist