feat(mdm): configurable install dir + persistent stderr logs#88
Merged
ashishkurmi merged 1 commit intoMay 21, 2026
Merged
Conversation
1c0f781 to
59a3747
Compare
There was a problem hiding this comment.
Pull request overview
This PR centralizes “agent install directory” resolution and adds persistent on-disk stderr logging (with rotation) so diagnostic logs survive runs where telemetry can’t be sent.
Changes:
- Introduces
internal/pathsto resolve the base install directory from CLI/env/config with a legacy fallback. - Adds
internal/progress/filelogto tee stderr toagent.error.log(and rotatesagent.log/agent.error.logat startup). - Updates launchd/systemd/schtasks installers to bake
STEPSECURITY_HOMEso scheduled invocations use the same install directory.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/telemetry/logcapture.go | Documents stderr-capture nesting behavior with the new file tee. |
| internal/systemd/systemd.go | Uses paths.Home() for log dir and injects STEPSECURITY_HOME into the unit. |
| internal/schtasks/schtasks.go | Uses paths.Home() and injects STEPSECURITY_HOME into the scheduled task command. |
| internal/schtasks/schtasks_test.go | Updates tests for new schtasks argument shape and log dir resolution path. |
| internal/progress/filelog/filelog.go | Implements stderr tee-to-file + best-effort rotation + eligibility checks. |
| internal/progress/filelog/filelog_test.go | Adds unit tests for teeing, rotation, skip behavior, and idempotent Stop. |
| internal/paths/paths.go | Adds install-dir resolution (CLI override/env/config/legacy). |
| internal/paths/paths_test.go | Adds tests for precedence and override behavior. |
| internal/launchd/launchd.go | Uses paths.Home() for LaunchAgent logs and injects STEPSECURITY_HOME into plist. |
| internal/config/config.go | Adds install_dir persistence and legacy-dir helpers. |
| internal/config/config_test.go | Adds JSON round-trip test for install_dir. |
| internal/cli/cli.go | Adds --install-dir parsing (including explicit empty to disable file logging). |
| internal/cli/cli_test.go | Adds coverage for --install-dir parsing and hooks acceptance. |
| internal/aiagents/cli/errlog.go | Routes hook error log location through paths.Home(). |
| cmd/stepsecurity-dev-machine-guard/main.go | Installs filelog capture early, rotates logs, and warns about legacy leftovers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
59a3747 to
a839a7b
Compare
ashishkurmi
approved these changes
May 21, 2026
8 tasks
ashishkurmi
added a commit
to ashishkurmi/dev-machine-guard
that referenced
this pull request
May 21, 2026
Replaces the removed v1.11.2 release. v1.11.2 was pulled because it did not support auto-update; v1.11.3 carries the same content plus a Sigstore signing fix and the configurable install-dir / persistent stderr-log support from step-security#88. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Type of change
Testing
./stepsecurity-dev-machine-guard --verbose./stepsecurity-dev-machine-guard --json | python3 -m json.toolmake lintmake testRelated Issues