Repository navigation
fix: scaffold refresh under the status lock, atomic per file, one log line per transition - #377
Merged
Merged
Conversation
… line per transition refreshScaffold overwrote framework files with copyFile outside any lock, so a completion re-reading the pipeline inside the status lock could see a half-written or replaced one; a template file that could not be read failed the refresh partway; every run appended a THREAD_LOG line. The refresh now holds the status lock, reads every packaged file before writing any, writes each through atomicWriteFile, and logs each version transition once; both surfaces say whether a line was appended. Closes #356 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Merged
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.
Summary
Closes #356. Verified on
main:refreshScaffoldtakes no lock, writes withcopyFile, and appends a THREAD_LOG line unconditionally (the new lock test and the third-run dedupe assertion fail there).workflow/status.yaml.lock— the oneupdateStatusAtomicallytakes), so a completion cannot re-read a pipeline this is rewriting.atomicWriteFile. A failure between two files still leaves a partial refresh — documented; re-running completes it, the copy being idempotent.unversioned → 0.25.0once, a same-version restore0.25.0 → 0.25.0once, repeats add nothing.RefreshScaffoldResult.threadLogEntryAppendedtells both surfaces which happened; Pi's feedback line and the MCP structured content say so.Test plan
tests/refresh-scaffold.test.mjs: a refresh started while the lock is held writes nothing until it is released, then restores; the second run logs its (new) transition, the third adds no line; no.tmpfiles remain.npm run build+npm test— 925 pass.🤖 Generated with Claude Code