run workspace teardown after a runtime restart - #3154
Open
thedhruvhegde wants to merge 1 commit into
Open
Conversation
Contributor
Greptile SummaryThis PR makes workspace teardown survive runtime restarts by using the durable workspace path and
Confidence Score: 5/5The PR appears safe to merge, with the restart teardown path and its durable idempotence behavior implemented consistently. No actionable failure remains: durable state reaches deactivation, teardown runs through the existing lifecycle runner, and the activation marker is cleared through the serialized persistence path.
|
| Filename | Overview |
|---|---|
| packages/core/src/runtimes/workspace-registry/node/activation.ts | Extends deactivation to recover durable activation state after restart and clears the marker after one teardown attempt. |
| packages/core/src/runtimes/workspace-registry/node/runtime.ts | Supplies durable workspace state to deactivation and records mutation time independently from the nullable activation timestamp. |
| packages/core/src/runtimes/workspace-registry/node/api/activation.contract.test.ts | Verifies teardown executes once after recreating the runtime and remains a no-op on repeated deactivation. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Deactivate workspace] --> B{In-memory activation exists?}
B -->|Yes| C[Abort and await background scripts]
B -->|No| D{Durable lastActivatedAt is set?}
D -->|No| E[Return no-op]
D -->|Yes| F[Use durable workspace path]
C --> G[Resolve lifecycle configuration]
F --> G
G --> H[Run time-boxed teardown]
H --> I[Publish inactive state]
I --> J[Clear durable lastActivatedAt]
J --> K[Kill workspace sessions]
Reviews (1): Last reviewed commit: "run workspace teardown after a runtime r..." | Re-trigger Greptile
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
archive/delete only ran the
.emdash.jsonteardown script while the workspace was still in the in-memory activation map. after an app restart that map is empty, so archived then deleted tasks skipped teardown and leaked simulators / other setup resources.deactivate now runs teardown once whenever
lastActivatedAtis set, then clears it so a second deactivate stays a no-op.closes #2886
test plan
pnpm --dir packages/core exec vitest run src/runtimes/workspace-registry/node/api/activation.contract.test.ts