Skip to content

[BUG] stale-file cleanup reports dependency key as deletion location #3026

Open

Description

Describe the bug

The stale-file cleanup diagnostic presents a dependency key as though it were the filesystem location from which files were deleted:

f"Cleaned {count} stale {noun} from {dep_key}"

For an absolute local-path dependency, the displayed path identifies the source package even though cleanup occurs under the deployment root. A before/after inventory confirms that the source remains unchanged.

To Reproduce

  1. Create a local-path package containing a skill and an ignored generated file.
  2. Install it globally with --target agent-skills.
  3. Uninstall it by its _local/<name> key.
  4. Observe output such as:
Cleaned 6 stale files from /absolute/path/to/source

The source tree remains unchanged; /absolute/path/to/source is the dependency identifier passed as dep_key, not the deletion location.

Expected behavior

The diagnostic should not describe a dependency identifier as a deletion location. It can report the package relationship directly:

Cleaned 6 stale deployed files for _local/source

If a location is reported, it should be derived from the actual deleted targets rather than dep_key.

Environment (please complete the following information):

  • OS: macOS
  • Python Version: 3.14.7
  • APM Version: 0.31.0 installed with Homebrew
  • VSCode Version (if relevant): Not applicable

Logs

The relevant output is included in the reproduction above.

Additional context

Both CommandLogger.stale_cleanup implementations format dep_key after from, and generic install-cleanup and manifest-reconciliation paths call those methods.

Activity

  1. changed the title [-][BUG] uninstall cleans files inside a local dependency source checkout[/-] [+][BUG] uninstall reports local dependency source as stale-file cleanup location[/+] on Sep 18, 2026
  2. changed the title [-][BUG] uninstall reports local dependency source as stale-file cleanup location[/-] [+][BUG] stale-file cleanup reports dependency key as deletion location[/+] on Sep 18, 2026
  3. sergio-sisternes-epam commented on Sep 20, 2026

    @sergio-sisternes-epam
    Collaborator

    Thanks for the reproduction. Both CommandLogger.stale_cleanup implementations format dep_key after from in src/apm_cli/core/command_logger.py. For an absolute local-path dependency that key is the source package path, so uninstall can print Cleaned N stale files from /absolute/path/to/source even though cleanup runs under the deployment root and the source tree is unchanged.

    This is an advisory recommendation only. It is not scope approval, assignment, or a release target. Please wait for a responsible maintainer to record bounded scope and a review contact on this issue before any implementation.

    Suggested direction if a maintainer accepts:

    • Treat dep_key as a package relationship, for example Cleaned 6 stale deployed files for _local/<name>.
    • If a location is reported, derive it from the files actually deleted under the deployment root, never from dep_key.
    • Do not change cleanup path resolution or the deletion safety gates as part of this wording fix.

    Proposed classification: type/bug, area/cli.

    Next step for maintainers: review the reproduction and, if the project can support the fix, post the human scope record from CONTRIBUTING.md.


    Generated by autopilot-issue-triage-worker. This comment is AI-generated and may contain errors.

  4. added
    triage/recommendedAutomated advice completed; not human scope approval.
    type/bugSomething does not work as documented.
    area/cliCLI command surface, flags, help text (cross-cutting).
    status/acceptedHuman scope approval; verify the issue's approval record and review contact before work.
    help wantedMaintainer invitation to contribute; check human scope approval, review contact and existing claims.
    on Sep 20, 2026
  5. sergio-sisternes-epam commented on Sep 20, 2026

    @sergio-sisternes-epam
    Collaborator

    Thank you Dave Mead (@DaveMeadAdjust) for the report.

    This issue is ready to be fixed. It is now in our status/accepted queue. Happy if anyone of the community want to pick it up and deliver it.

  6. adity982 commented on Sep 20, 2026

    @adity982

    I plan to update the stale-cleanup diagnostic so it describes dep_key as the affected dependency rather than a deletion location, with focused tests for both logger renderers and no cleanup-path behavior changes.

  7. Dansatch commented on Sep 30, 2026

    @Dansatch

    Hi ADITYA (@adity982) , are you still working on this? I noticed there hasn’t been a branch or PR update since your comment. If you’re no longer working on it, I’d be happy to pick it up.

  8. danielmeppiel commented on Oct 2, 2026

    @danielmeppiel
    Collaborator

    Decision: approve
    Area: project
    Scope: Clarify stale-file cleanup wording in both logger renderers so dependency keys identify the affected dependency rather than a deletion location; complete the bounded change in PR #3120 with regression and command-level coverage and directly related documentation.
    Done when: Both logger renderers report the affected dependency accurately; executed regression and command-level coverage verifies the wording and preserves existing cleanup behavior; directly related documentation reflects the change.
    Out of scope: Changes to cleanup paths, deletion behavior, dependency resolution, or unrelated logging behavior. This approval does not authorize merge, policy waivers, or release targeting.
    Review contact: Daniel Meppiel (@danielmeppiel)

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

Metadata

Metadata

Labels

area/cliCLI command surface, flags, help text (cross-cutting).help wantedMaintainer invitation to contribute; check human scope approval, review contact and existing claims.status/acceptedHuman scope approval; verify the issue's approval record and review contact before work.triage/recommendedAutomated advice completed; not human scope approval.type/bugSomething does not work as documented.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions