Skip to content

Preserve argv through systemd scope wrappers - #455

Merged
schickling merged 2 commits into
mainfrom
schickling-assistant/2026-09-05-2026-09-05-scope-argv
Sep 5, 2026
Merged

Preserve argv through systemd scope wrappers#455
schickling merged 2 commits into
mainfrom
schickling-assistant/2026-09-05-2026-09-05-scope-argv

Conversation

@schickling-assistant

@schickling-assistant schickling-assistant commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Problem

On Linux, st2 launches managed tasks through systemd-run --user --scope. systemd-run expands 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=no before 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.
  • Linux systemd 260 E2E preserved $HOME, ${UNSET}, and $$; PTY status, descriptors, exit status, outliving-child membership, collection, and cleanup also passed.
  • New decision and experiment records pass strict VRS shape checks.
  • Version-capability tests reject systemd 249 and 252, accept 254 and 257, and reject malformed version output.
  • Rebased onto current main.

Pre-flip deviations

  • Full clippy stops at the unchanged manual_is_multiple_of warning in crates/st2-resource-protocol/src/lib.rs:410. The same package-level command fails identically on pristine current main.
  • Full tests: branch 684 passed, 10 failed, 1 ignored. Pristine current main fails 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=no requires 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

Posted on behalf of @schickling
field value
agent_identity mbp2025.direct.omp.5tek2r48
session mbp2025.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 schickling-assistant changed the title schickling assistant/2026 09 05 2026 09 05 scope argv Preserve argv through systemd scope wrappers Sep 5, 2026
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
schickling-assistant force-pushed the schickling-assistant/2026-09-05-2026-09-05-scope-argv branch from 5768bd6 to 03c2173 Compare September 5, 2026 14:04
@schickling-assistant
schickling-assistant marked this pull request as ready for review September 5, 2026 14:33
@schickling

Copy link
Copy Markdown
Contributor

@codex

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T16:06:49.130842Z 03c2173 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/isolate.rs
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
schickling merged commit 5b26bea into main Sep 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants