Skip to content

Generator: a hard-killed generate leaves <path>.<guid>.tmp files that no later run removes #413

Open

Description

@Blind-Striker

What

The generation writer's ownership-first write (#412, GEN-E8 Task 2) writes every file as a temp file plus rename, using StagedWrite.InstallAsync. The temp file is named <path>.<guid>.tmp and sits next to its target. An exception runs the finally, which deletes the temp file. A hard kill (SIGKILL, power loss, an OOM kill) skips the finally and leaves the temp file behind.

Why it matters

Nothing removes such a file later: each run writes a temp file with a new GUID name. .gitignore:108 hides it, so stray files pile up unseen under src/OpenCode.Sdk/. They are invisible to git status and to generate --verify. That is harmless to correctness, because the next run still repairs every owned path, but it is unbounded litter in the source tree.

Proposed fix

At the start of a write, after validation and before step 2, delete every *.tmp file next to an owned path whose name matches the writer's <owned path>.<guid>.tmp shape. The writer owns those names and nothing else creates them. Add a test row: a stray A.cs.<guid>.tmp from a killed run is gone after the next run, and an unrelated *.tmp is untouched.

Found at the coordinator's and the lead's review of #412 (2026-10-17). It is a small follow-up for the U7 sweep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions