Skip to content

Limit source cleanup assertions to the helper temporary checkout #5221

Closed

Description

@devantler

🤖 Generated by the Agentic Engineer

Description

The source-checkout cleanup regression reports a leaked checkout during macOS sandbox validation even when the disposable checkout has been removed. This gives maintainers and agents a false failure when validating otherwise unrelated changes. No hosted CI or production failure is established by this observation.

Steps to Reproduce

At Platform commit 9952428d8f0036444df73ff0c8075380c017180c, run:

go test -count=1 -timeout=30s -run '^TestResolveFoldInputsRemovesItsCheckout$' -v ./scripts/reconcile-talos-kernel-args

The unchanged test fails repeatedly inside the macOS Codex sandbox and passes outside that sandbox at the same revision. The complete package suite also passes on the host.

Expected Behavior

The test proves that every temporary source checkout owned by the helper is removed after successful and failed source reads. Real checkout leaks and cleanup errors remain failures. An unrelated tool cache must not be misclassified as a source checkout.

Actual Behavior

The assertion at main_test.go:699 requires the entire fixture TMPDIR to be empty. A private Go test overlay changed only the failure diagnostic to print directory entries; the sole remaining entry was the regular file xcrun_db, with no ksail-fold-inputs-* checkout present. The source identities had already passed the test's successful-read assertions. Why this cache appears only in the sandbox has not been established.

Environment

macOS arm64; the repository test source is unchanged. This was discovered while auditing the dependency update in #5220 and is independent of its audited-input data.

Acceptance Criteria

  • Reproduce the parent-directory pollution without depending on a particular host or sandbox.
  • Scope cleanup proof to the helper's owned source checkouts, preserving successful-read and failed-read cleanup checks.
  • A deliberately retained owned checkout still fails the test; an unrelated regular tool-cache file does not.
  • Preserve the injected cleanup-error control and fail-closed source-identity behavior.
  • Pass the complete package suite in both the macOS sandbox and the host environment, then verify required CI.

Additional Context

Part of #4979. Size: Small. This is validation reliability work, with no urgent production impact demonstrated; retain it in Backlog for refinement. Full local diagnostics are kept privately.

Activity

  1. added theissue type on Oct 22, 2026
  2. moved this to 📥 Backlog in 🌊 Project Boardon Oct 22, 2026
  3. added a commit that references this issue on Oct 24, 2026
  4. moved this from 📥 Backlog to 👀 In Review in 🌊 Project Boardon Oct 24, 2026
  5. moved this from 👀 In Review to ✅ Done in 🌊 Project Boardon Oct 24, 2026
  6. devantler commented on Oct 24, 2026

    @devantler
    ContributorAuthor

    🤖 Generated by the Agentic Engineer (interactive Claude Code session)

    Implemented in #5285, merged through the merge queue on 2026-10-24 at 18:50 UTC as c488afaa; its merge-group run (deploy included) succeeded and every production Flux layer reports Ready.

    • Reproduced without the sandbox: the cleanup test now plants an unrelated xcrun_db file in its temporary directory. Planted into the old test, that file alone fails it with "temporary source checkout remains after reading 1.2.3: 1 entries".
    • Scoped to the helper's own checkouts: the check now counts only entries carrying the helper's checkout prefix, and asserts the unrelated file is left alone. A new control keeps a checkout on purpose and requires it to be found.
    • Unchanged: the injected cleanup-error test and fail-closed source identities. The complete package suite passes on the host and in hosted CI.
    • Not run: the Codex macOS sandbox itself; the planted file is what that sandbox leaves, so the condition is now exercised on every host.

    The test now flags only a real leaked checkout, not files other tools leave behind.

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

    No labels
    No labels

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions