[BUG] stale-file cleanup reports dependency key as deletion location
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
- Create a local-path package containing a skill and an ignored generated file.
- Install it globally with
--target agent-skills. - Uninstall it by its
_local/<name>key. - 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.
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_keyas a package relationship, for exampleCleaned 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.
Thank you @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.
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.
Hi @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.
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: @danielmeppiel