mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #327] [MERGED] fix(snapshot): retain template workspace during startup recording #348
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#348
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/327
Author: @MisaKokoro
Created: 9/29/2026
Status: ✅ Merged
Merged: 9/30/2026
Merged by: @yingdi-shan
Base:
main← Head:fix/posix-startup-pack-workspace-lifetime📝 Commits (1)
4476d6bfix(snapshot): retain template workspace during startup recording📊 Changes
2 files changed (+59 additions, -9 deletions)
View changed files
📝
src/snapshot/startup_pack.rs(+2 -2)📝
src/template/builder.rs(+57 -7)📄 Description
What
Retain the template build workspace while detached startup-pack recording and
repository attachment are still running.
This change:
TemplateBuildContext.workspacein anArc<TempDir>;StartupRecording::spawn_with_capture_lease();lease; and
workspace owner has been dropped.
The
StartupRecording.keep_alivedocumentation is also updated to describethe template workspace lease.
Why
POSIX snapshot publication can finish before startup-pack recording.
Previously, template builds created the recording with a unit
keep_alive:When
TemplateBuilder::execute_and_publish()returned,TemplateBuildContext.workspacewas dropped and its temporary directory wasdeleted. A recorder that was still running then failed while creating
memory-startup.trace.tmp:The recording returned
None, so the POSIX continuation did not creatememory-startup.packor attachcommitted.memory_startupto the catalogrecord.
Related issue
Closes #326
Scope and non-goals
Included:
Not included:
Design and behavior changes
The template workspace is converted into an
Arc<TempDir>after templateexecution succeeds:
StartupRecording::spawn_with_capture_lease()clones the lease into therecorder task and stores another lease in
StartupRecording.keep_alive.This preserves the existing asynchronous publication behavior:
manifest; and
If publication fails or its future is cancelled, the recorder task still owns
its lease until its cleanup path finishes.
Compatibility and operations
memory-startup.packandcommitted.memory_startupformats are unchanged.lifetime bug but does not require data migration.
Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
Skipped checks and reasons:
make test-unit: not run; focused unit and lifecycle tests were run instead.aenv pull: not run as part of the automated validation.services/is unchanged.Risks and reviewer notes
The main operational effect is that a template build's temporary workspace may
remain on disk until startup recording and manifest attachment finish, rather
than being deleted immediately when synchronous publication returns. This is
the intended lifetime and is bounded by the existing recorder and continuation
cleanup paths.
Publication remains non-blocking.
The most important review points are:
src/template/builder.rs: creation and propagation of the workspace lease;src/template/builder.rs: regression test for delayed trace writes;src/snapshot/startup_pack.rs: updatedkeep_aliveownership documentation.The implementation reuses the existing capture-lease mechanism already used by
ordinary sandbox capture instead of introducing a second lifecycle mechanism.
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.