fix(coding-agent): make apply_patch aborts atomic - #1670
Open
asdfqwerzxcc wants to merge 5 commits into
Open
asdfqwerzxcc wants to merge 5 commits into
asdfqwerzxcc wants to merge 5 commits into
Conversation
Ultraworked with [omo](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
Ultraworked with [omo](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
Fixes code-yeongyu/oh-my-openagent#8246. Ultraworked with [omo](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
Ultraworked with [omo](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
Ultraworked with [omo](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
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\n\nMake registered multi-file
apply_patchcancellation transactional. The tool now holds canonical mutation queues across byte-exact rollback, and its awaited result hook prevents the generic abort result from becoming observable before cleanup finishes.\n\nThis fixes the native Senpi implementation behind oh-my-openagent #8246.\n\n## Changes\n\n- reserve all canonical mutation paths together, deduplicating case and symlink aliases\n- split per-operation patch I/O from result orchestration and add raw-byte/symlink snapshots for cancellation rollback\n- forward the tool AbortSignal and keep an extension-instance execution registry untiltool_resultconsumes settlement\n- preserve successful patches and the existing non-abort structured partial-failure contract\n- document the fork behavior and add a release note\n\n## QA & Evidence\n\n- Issue regression: 3/3 pass after reproducing 3/3 RED failures on upstream (issue-8246-apply-patch-atomic-abort.test.ts)\n- Focused neighbors: 26/26 pass across rollback, partial-failure, backport, and queue tests\n- Broader apply-patch set: 77 pass, 8 skip; 2 Windows/tmppermission-parser failures reproduce unchanged on clean upstream92db3be54\n- Static/build: changed-file Biome pass; root TypeScript no-emit pass; full build exit 0; changelog gate pass\n- Manual source driver: abort rollback is byte-identical, pre-aborted input makes no mutation, and a successful three-file patch applies every operation\n- Isolated Senpi QA: common self-check 10/10, CLI smoke 8/8, narrow mock-loop 4/4; real auth unchanged\n- Artifact:local-ignore/qa-evidence/20260913-apply-patch-atomic-abort/README.mdin the task worktree (ignored by repository policy)\n\n## Risks & Residuals\n\n- Rollback is process-local; process termination or power loss cannot be recovered by an in-memory journal.\n- Rollback preserves file bytes, existence, and symlink targets. It does not restore timestamps or ACL metadata.\n- Repository-wide Windows suites have pre-existing path, release-script, and native-prebuild fixture failures; none references a changed path. GitHub CI is authoritative for the supported matrix.\n- The local gate-review agent remained non-terminal in two bounded attempts, so no local reviewer approval is claimed; GitHub CI and repository review remain required.\n\n## Related Issues\n\n- Fixes https://github.com/code-yeongyu/oh-my-openagent/issues/8246\nSummary by cubic
Fixes cancelled
apply_patchruns leaving partial edits by rolling back every affected file before the abort result is published (#8246). Direct calls without anAbortSignalkeep the existing partial-failure behavior.Transactional aborts
Queue reservations
withFileMutationQueues()to reserve every canonical path in a multi-file transaction at once.Written for commit 1883816. Summary will update on new commits.