Daily Edition Sources +4

A Sandbox Isn’t Finished Until the Repository Says So

Mastra Factory is making one understated agent-system choice explicit: before a session workspace is scrubbed, pooled, or destroyed, the repository can say how its own worktree should be put away.

A rough cream-paper diagram shows a project repository teardown card running before a scrub-worktree card, then branching to pool or destroy and cache invalidation, with a red caveat stamp that a failed hook is not proof of cleanup.
Diagram Punkcleanup belongs to the repository before a sandbox can be reclaimed.
repo mastra-ai/mastra evidence
4 source signals 1 repo commit c7a5020
Evidence: commit c7a5020 / August 16, 2026 / Daily Edition
Open Edition Evidence below

In mastra-ai/mastra commit #21564, Mastra Factory added a place for a linked repository to say how its own worktree should be put away before the generic reset begins. That matters because “clean up the sandbox” is deceptively broad: a generated project might need to stop a local service, remove a tool-specific cache, or undo a checkout arrangement before its workspace can be scrubbed, pooled, or destroyed.

The commit’s co-author record credits Mastra Code (openai/gpt-5.6-sol). That is public evidence that a coding agent participated; it is not a claim that an agent designed or wrote every part. The sharper engineering receipt is in the code. The new retirement coordinator serializes competing retirement requests for the same session, loads the linked repository’s command, and then keeps the rest of the cleanup path accountable to the session rather than to a hopeful shell script.

A hook gets a place in the recovery sequence

For a remote sandbox, Factory attempts the repository teardown, scrubs the released workspace, returns the sandbox to its repository-scoped pool, and invalidates cached session state. For a local sandbox, the hook runs before destruction. The accompanying tests make that order concrete: teardown must precede the git scrub, pooling, and invalidation; two simultaneous retirement requests must not run the hook twice.

That order is why this is more than another configuration field. It turns a project’s cleanup knowledge into a lifecycle boundary that the orchestrator can call from terminal work, explicit deletion, and destructive project cleanup. It also extends the earlier Factory pool-and-scrub work in a specific direction: the system already knew how to reclaim a workspace; now the linked repository gets a chance to leave it in a state the generic scrub understands.

A failed hook is a warning, not a clean bill of health

The test suite prevents the easy but wrong headline. In one case the teardown command exits with an error; Factory logs the failure and still scrubs, clears the session binding, and pools the remote sandbox. That is a sensible recovery choice—one broken project script should not leave a resource stranded forever—but it means the hook is best-effort. It does not certify that every project-specific trace is gone, and it does not make an arbitrary shell command safe.

Transferable building skill: make cleanup two contracts, not one

Builders can borrow the shape without copying Factory. Let the repository own its domain cleanup, but pair it with an independent platform postcondition: scrub or destroy the workspace, clear the session binding, and make duplicate retirement harmless. Test the order, the failed-hook path, the unavailable-machine path, and the concurrency path. A cleanup command can be useful; only those follow-on invariants make it safe to reclaim the resource.

These are main-branch implementation and test receipts, not proof of a shipped release, provider-wide reliability, or hardened isolation. The next signal worth watching is public integration coverage that runs a real configured teardown through a provider interruption and then proves that the next repository claim begins without stale state or credentials.

Evidence Trail

Receipts below the story

The article above is the public narrative. This section keeps the source trail and limits on the same page.

Edition
DateAugust 16, 2026
LaneDaily Edition
Confidence78%
Sources4
Reposmastra-ai/mastra

Primary Evidence

  • Public coding-agent use proof — Mastra Factory commit #21564
    • Shows: the public change that adds per-repository worktree teardown during Factory session cleanup and credits Mastra Code (openai/gpt-5.6-sol) as a co-author. The attribution establishes coding-agent participation in this public change, not a line-by-line account of authorship or review.
  • Inspected GitHub repository — Factory session retirement coordinator
    • Shows: a session-id-serialized retirement path that loads a project repository’s configured teardown command, attempts it before remote release or local destruction, then invalidates the workspace cache and optionally removes the session row. It also shows that teardown errors are logged while retirement continues.
  • Engineering receipt — Factory retirement tests
    • Shows: focused tests for teardown before scrub, pooling, and invalidation; continued cleanup after a failing teardown; local destruction order; unavailable-sandbox handling; and at-most-once teardown for duplicate retirement requests.
  • Lifecycle helper — worktree teardown contract
    • Shows: the helper runs the configured command from the session worktree with a bounded timeout and leaves the caller responsible for reporting failures while continuing scrub, pooling or destruction, invalidation, and deletion.

Evidence Limits

  • These are public main-branch implementation and test receipts. They do not establish a shipped release, any customer’s configured teardown command, real-provider reliability, cost savings, broad adoption, or security certification.
  • A repository-owned shell command is not itself proof of safe cleanup. The next meaningful public evidence would be release or integration coverage that exercises a configured teardown through an interrupted provider, a malformed command, and a reused worktree without leaving stale state or credentials behind.
Letters & Corrections

Send a note to the desk

Corrections, missing context, or a follow-up lead.