Repository navigation
Conversation
`migrate-state --copy-active-state` published the rewritten legacy active-state file over the target path unconditionally, while the runtime copy next to it skips existing files. Re-running a migration (for example `--all-goals` after more legacy Goals appeared, or any retry after the target Goal had been worked) silently replaced the live target Todos with the stale legacy copy: completed Todos reopened and Todos added since the first copy were lost, with no backup and no warning in the preview. Check every target before the first copy and fail closed when an existing target differs from the bytes the migration would publish. An identical rerun and an in-place rewrite of the same file stay idempotent, and the conflict is raised in preview as well as execute so nothing is partially written. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: duang777 <duangjl007@gmail.com>
Duang777
requested review from
huangruiteng,
loopx-agent and
songoow
as code owners
November 13, 2026 09:46
This branch has not been deployed
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.
Goal And Delivered Outcome
copy_active_state_filesinloopx/state_migration.pypublished the rewritten legacy active-state file over the target path unconditionally, while the runtime copy next to it skips existing files.migrate_legacy_state(..., execute=True)reportedcopied: Trueand rolled the target back to the stale legacy copy, with no backup or preview warning. After: preview and execute both raiseValueError: migrated active state already exists with different content, and the target file and registry bytes are unchanged. An identical rerun and an in-place rewrite of the same file still work. Every target is checked before the first copy, so a conflict leaves no partial write. Rows:regression_parity,unit.mainat7bb1b01.Author Declaration
Implemented against
copy_active_state_filesinloopx/state_migration.pytests/test_state_migration.py::test_repeated_migration_does_not_overwrite_diverged_target_active_state--goal-id-mapdoes not validate new ids as path segments.Scope And Continuation
--forcepath to overwrite a diverged target deliberately.Validation
0199f6fcdc8fa43939b2d94202ef4a0b22eddf62for the diff; local runs used a working tree whose touched files were blob-identical tomain7bb1b01before the change.regression_paritypassedDID NOT RAISE) and passes with the fix.unitpassedtests/test_state_migration.pyplus the botmux file, 25 passed;ruff checkclean.unitfailedtest_state_migration_authority_shadow.pyandtest_shadow_writer_boundaries.pyhad 5 failures with and without this change on the stale local tree; not re-run onmain.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).none.Signed-off-bytrailer (git commit -s).🤖 Generated with Claude Code