Preserve argv through systemd scope wrappers - #455
Merged
schickling merged 2 commits intoSep 5, 2026
Conversation
agent-identity: mbp2025.direct.omp.5tek2r48 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.0.11 agent-runtime: OMP 18.0.11 tooling-profile: dotfiles@4cc7b25
schickling-assistant
force-pushed
the
schickling-assistant/2026-09-05-2026-09-05-scope-argv
branch
from
September 5, 2026 14:04
5768bd6 to
03c2173
Compare
schickling-assistant
marked this pull request as ready for review
September 5, 2026 14:33
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03c2173391
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
agent-identity: mbp2025.direct.omp.5tek2r48 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.0.11 agent-runtime: OMP 18.0.11 tooling-profile: dotfiles@4cc7b25
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.
Problem
On Linux, st2 launches managed tasks through
systemd-run --user --scope.systemd-runexpands dollar-bearing arguments by default, so caller-owned argv is not opaque: a literal$HOME:${UNSET}:$$changes before it reaches the task.Goal
Preserve every task program and argument byte-for-byte. Retain scope isolation, PTY/I/O inheritance, exit propagation, outliving-child membership, and collection when systemd supports opaque argv.
Decisions
Use systemd’s native
--expand-environment=nobefore the command separator on systemd 254 or newer. Older systemd versions degrade to the existing detached launch with a warning instead of passing an unsupported option or changing caller-owned argv. Do not add shell quoting, st2-specific escaping, or deterministic scope names. Detached platforms, including macOS, retain the existing direct program/argv pass-through.Verification
nix develop --command cargo test --lib isolate::tests::wrap_ -- --nocapture— 2 passed.$HOME,${UNSET}, and$$; PTY status, descriptors, exit status, outliving-child membership, collection, and cleanup also passed.main.Pre-flip deviations
manual_is_multiple_ofwarning incrates/st2-resource-protocol/src/lib.rs:410. The same package-level command fails identically on pristine currentmain.mainfails the same 10 macOS path/resync tests (677 passed, 10 failed, 1 ignored).Complexity
No new abstraction or dependency. One wrapper option and mode-injected unit tests.
Concerns
--expand-environment=norequires systemd 254 or newer. Older Linux installations launch in degraded detached mode without cgroup isolation and emit a warning. macOS is unaffected because it already uses direct pass-through.Friction & bottlenecks
The repository-wide clippy/test gates have reproducible pristine-main deviations listed above. Focused behavior tests and live Linux E2E evidence are green.
Follow-ups
None for argv transparency.
References
docs/vrs/.decisions/0016-systemd-scope-wrappers-disable-environment-expansion.mdPosted on behalf of @schickling
agent_identitysessionagent_personaagent_supervisoragent_toolagent_tool_versionagent_runtimetooling_profile