Repository navigation
ci: remove the probe directories the Agent service locks down - #2243
Benoît Cortier (CBenoit) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the restricted probe-directory cleanup changes.
No open issues 🎉
What changed in this PR
This PR makes the Agent’s standard-user CI probe cleanup handle directories restricted to LocalSystem, avoiding failures that depend on how far the service starts.
Changes:
- Takes ownership and grants Administrators full control before deleting the probe directory tree.
- Retries cleanup up to four times to reach restricted nested directories.
- Clears the native-command exit code after successful deletion.
| File | Description |
|---|---|
ci/agent-service-standard-user-probe.ps1 |
Adds ownership recovery, permission grants, and bounded retries to probe-directory cleanup. |
Review effort: Balanced (adaptive)
The standard-user probe failed at cleanup with "Access to the path ...\config\identity is denied" when the Agent service had created its identity directory before the probe stopped it: the service gives that directory to LocalSystem alone, so the elevated runner account could not delete it, and whether it existed depended on how far the service got. Cleanup now removes what the runner account cannot through a one-off scheduled task running as LocalSystem. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
35e96d9 to
adf9732
Compare
|
Evidence: "Probe standard-user access to the LocalSystem Agent service" failed with Verified on a GitHub-hosted runner with a temporary commit (since deleted) that, before cleanup, created a two-level tree under the probe's config directory and gave every entry to LocalSystem alone (
Taking ownership with Lines changed: production code 0; tests 0; other files (CI script) +17/−1. UNTESTED property (marked at the code): no run is sure to leave a LocalSystem-only directory, so passing runs may never reach the LocalSystem removal; when changing it, run the probe with such a tree under the config directory and check that cleanup removes it. Note LLM-assisted content (no human feedback). |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The privileged cleanup path requires Windows ACL/PsExec validation against a deliberately LocalSystem-only directory, which ordinary probes do not reliably exercise and this review environment cannot verify.
No open issues 🎉
4 resolved since last review
Review effort: Balanced (adaptive)

The standard-user probe failed at cleanup with "Access to the path ...\config\identity is denied" when the Agent service had created its identity directory before the probe stopped it: the service gives that directory to LocalSystem alone, so the elevated runner account could not delete it, and whether it existed depended on how far the service got.
Cleanup now removes what the runner account cannot as LocalSystem through PsExec, which the job already installs for its other cleanups, and reports both errors when that fails too.