fix: make project deletion tolerant of stale session state#2628
Closed
tamish560 wants to merge 2 commits into
Closed
fix: make project deletion tolerant of stale session state#2628tamish560 wants to merge 2 commits into
tamish560 wants to merge 2 commits into
Conversation
Author
|
Closing this in favor of #2599 by @AgentWrapper which addresses the same issue (#2598). Should have checked for existing PRs before opening this one. |
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.
What
Makes project deletion (
DELETE /api/v1/projects/{id}) robust to stale, legacy, or inconsistent session state by making session teardown errors non-fatal during project removal.Why
When a project has stale sessions (locked worktrees, archived project refs, missing runtime handles, etc.),
TeardownProjectreturns an error and the entireRemovecall fails withINTERNAL_ERROR. The project stays registered and the user has no recovery path from the UI.The issue (#2598) explicitly says: "local project removal must be robust to stale, legacy, partially missing, or otherwise inconsistent AO-managed state. If the user asks to remove a local project registration, AO should work around bad session/worktree/runtime records and complete the unregister flow wherever it can do so without deleting unpurged session state."
Closes #2598
How
Changed
Service.Removeinbackend/internal/service/project/service.goto ignore the error fromm.sessions.TeardownProject(ctx, id)instead of propagating it. The project is still archived (soft-deleted) regardless of whether session teardown succeeded.This means:
Testing
Updated
TestManager_RemoveDoesNotArchiveWhenTeardownFailstoTestManager_RemoveToleratesTeardownFailure. The test now verifies that:Run:
cd backend && go test ./internal/service/project/...