Repository navigation
fix(runtime-host): recover failed workspace Skill deletion #6009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Astro-Han
merged 3 commits into
apache:main
from
garvit-arora:fix/5987-windows-skill-delete-recovery
Oct 16, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,6 +109,7 @@ export type SkillCatalogTransactionFailpoint = | |
| | 'after_managed_handoff_transaction_sync_before_skills_sync' | ||
| | 'after_managed_handoff' | ||
| | 'after_delete_rename_before_directory_sync' | ||
| | 'before_delete_rename' | ||
| | 'after_delete_skills_directory_sync_before_transaction_sync' | ||
| | 'after_gc_handoff_rename_before_directory_sync' | ||
| | 'after_gc_handoff' | ||
|
|
@@ -213,7 +214,7 @@ export class SkillCatalogTransactionWriter { | |
| await removePreIntentTransaction(prepared.transactions, directory); | ||
| continue; | ||
| } | ||
| await replayTransaction(prepared, transaction); | ||
| await replayTransaction(prepared, transaction, this.#failpoint, true); | ||
| } | ||
| }); | ||
| } | ||
|
|
@@ -357,6 +358,7 @@ async function replayTransaction( | |
| root: PreparedRoot, | ||
| transaction: PreparedTransaction, | ||
| failpoint?: (point: SkillCatalogTransactionFailpoint) => void, | ||
| recovering = false, | ||
| ): Promise<void> { | ||
| await verifyTransactionEntries(transaction); | ||
| switch (transaction.intent.kind) { | ||
|
|
@@ -367,7 +369,7 @@ async function replayTransaction( | |
| await replayReplace(root, transaction, failpoint); | ||
| return; | ||
| case 'delete-workspace': | ||
| await replayDelete(root, transaction, failpoint); | ||
| await replayDelete(root, transaction, failpoint, recovering); | ||
| return; | ||
| } | ||
| } | ||
|
|
@@ -585,6 +587,7 @@ async function replayDelete( | |
| root: PreparedRoot, | ||
| transaction: PreparedTransaction, | ||
| failpoint?: (point: SkillCatalogTransactionFailpoint) => void, | ||
| recovering = false, | ||
| ): Promise<void> { | ||
| const intent = transaction.intent as DeleteIntent; | ||
| const target = join(root.skills, intent.skillId); | ||
|
|
@@ -602,7 +605,20 @@ async function replayDelete( | |
| } | ||
| const targetReal = await requireContainedDirectory(root.skills, target); | ||
| await verifyTreeManifest(targetReal, intent.expected); | ||
| await rename(targetReal, tombstone); | ||
| try { | ||
| failpoint?.('before_delete_rename'); | ||
| await rename(targetReal, tombstone); | ||
| } catch (error) { | ||
| if (recovering && !(await safeLstat(tombstone))) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: This cancels the user's deletion on any rename error during recovery, including transient ones, and nothing records that it happened. Consider emitting a diagnostic when an intent is cancelled, and keeping the rename errno as |
||
| const unchangedTarget = await safeLstat(target); | ||
| if (unchangedTarget?.isDirectory() && !unchangedTarget.isSymbolicLink()) { | ||
| await verifyTreeManifest(target, intent.expected); | ||
| await finishTransaction(root.transactions, transaction.directory, failpoint); | ||
| return; | ||
| } | ||
| } | ||
| throw error; | ||
| } | ||
| failpoint?.('after_delete_rename_before_directory_sync'); | ||
| await syncDirectory(root.skills); | ||
| failpoint?.('after_delete_skills_directory_sync_before_transaction_sync'); | ||
|
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2:
scripts/ci-workflow-policy.test.mjslines 946-947 still assert# tests 93and# pass 93against this workflow, so the requiredtestjob fails. Bump those assertions to 94 together with this change.