fix(agent-core-v2): let session archive proceed after a failed resume - #3139
Merged
sailist merged 1 commit intoAug 20, 2026
Merged
Conversation
A failed resume is cached by SessionManager and rethrown from whenResumeSettled, so archiving a session whose workspace is gone failed with the stale resume error even though cold archive only rewrites session metadata. Swallow the settle failure: still wait for an in-flight resume before the live/cold classification, but fall through to the cold metadata path after a failed one.
🦋 Changeset detectedLatest commit: ceaa3e6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Related Issue
None — the problem is explained below (no tracking issue exists yet).
Problem
Archiving a session can fail with the error of an earlier, unrelated resume attempt: after a session's workspace is unregistered and its directory deleted, opening the session fails with
workspace root ... does not exist, and every subsequent:archivecall for that session fails with the same error (40409) until the server restarts.Root cause: a failed resume is cached by
SessionManagerand rethrown bywhenResumeSettled.setSessionArchivedawaits that settle before classifying the session as live or cold, so the stale resume error aborts the archive before it ever reaches the cold path — even though cold archive only rewrites session metadata in the home directory and never touches the workspace.What changed
setSessionArchivedstill waits for an in-flight resume to settle (required for a correct live/cold classification) but no longer rethrows a historical resume failure: a failed resume leaves no live handle, so falling through to the cold metadata path is the correct behavior. Live sessions are unaffected and still go through the full lifecycle chain (agents drain, scope disposal, events).:archive.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.