Skip to content

deploy: a candy's env: is invisible to non-interactive commands on a machine venue (~/.bashrc managed block is interactive-only) #814

Closed

Description

@aitrawog

Problem

A candy's env: block compiles to a ~/.config/opencharly/env.d/<candy>.env file
sourced by a managed block the deploy writes into the venue's shell init. For bash
that file is ~/.bashrc, which is sourced only by an INTERACTIVE shell. So on a
target: local / target: vm machine venue:

  • every non-interactive deploy check: command, and
  • a plain charly vm ssh <box> -- '<cmd>'

runs WITHOUT the candy's env. A candy whose own check: asserts its env (e.g. the
dsh-tui candy's printenv DSH_TUI_NO_LAUNCHPAD) therefore FAILS on a machine venue
even though the deploy installed its env file correctly.

The image/pod path is unaffected: there the env becomes a container ENV/ENV
directive, present to every process.

Evidence (live, a disposable CachyOS VM)

nodejs (composed) sets NPM_CONFIG_PREFIX, dsh-tui sets DSH_TUI_NO_LAUNCHPAD.
Both env files exist:

$ charly vm ssh <box> -- 'cat ~/.config/opencharly/env.d/*.env'
# opencharly env for layer dsh-tui — managed by charly; do not edit
export DSH_TUI_NO_LAUNCHPAD=1
export PATH="/home/cachy/.npm-global/bin:$PATH"
# opencharly env for layer nodejs — managed by charly; do not edit
export NPM_CONFIG_PREFIX=/home/cachy/.npm-global
...

…and the managed block is in ~/.bashrc — but AFTER the non-interactive early-return:

$ charly vm ssh <box> -- 'tail -6 ~/.bashrc'
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
...
# opencharly:begin (managed by charly; do not edit inside this block)
for f in /home/cachy/.config/opencharly/env.d/*.env; do [ -r "$f" ] && . "$f"; done
# opencharly:end

So the same env is invisible to a non-interactive command:

$ charly vm ssh <box> -- 'printenv DSH_TUI_NO_LAUNCHPAD; printenv NPM_CONFIG_PREFIX'
(no output for either)
$ charly vm ssh <box> -- 'bash -ic "printenv DSH_TUI_NO_LAUNCHPAD"'
1

Surfaced by the distro-cachyos#125 check-dsh-cachyos-vm bed AFTER the sdk#346
fix let the deploy complete: deploy-add PASS, then the dsh-tui candy's own env
check FAILs (plan:vm:cachyos-vm:14, exit=1, want 0). Under the pod path the same
check SKIPs (unresolved variable), so it was never exercised there.

Intended scope

Make a candy's env: reachable to NON-interactive deploy commands on a machine venue.
Options (owner's call): write the managed block to a file non-interactive shells source
(~/.profile / ~/.bash_profile is still interactive-only for bash non-login; the
robust home is BASH_ENV-equivalent or prefixing each rendered command), or have the
deploy executor export the env.d set into every rendered command. The image/pod path's
ENV semantics are the contract to match.

Coordination

Filed by session dsh-tui-install, surfaced by distro-cachyos#125's VM bed.

Activity

  1. aitrawog commented on Oct 6, 2026

    @aitrawog
    ContributorAuthor

    CLAIM

    Claiming for session dsh-tui-install. Scope: make a candy's env: reachable to NON-interactive deploy commands on a target: local/target: vm venue (the managed block lands in ~/.bashrc, which an interactive-only guard short-circuits before). Surfaced live by distro-cachyos#125's check-dsh-cachyos-vm bed once the sdk#346 fix let the deploy complete; the dsh-tui candy's own env check then failed. Root cause + live evidence in the issue body.

    Agent: dsh-tui-install · session ses_eefd1f32fffeNl8ajvmzJ0hGLk
    Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  2. self-assigned this
    on Oct 6, 2026
  3. aitrawog commented on Oct 6, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    Producer fix opened: opencharly/spec#201 — exec: a MachineVenue opt-in on ShellExecutor + the env.d preamble prefixed at the shared non-interactive spawn helpers (ShellExecutor RunUser/RunCapture, SSHExecutor run/RunCapture, NestedExecutor.prepareJump for a JumpSSH jump). Both the deploy walk and the check engine converge on those leaf executors, so one rule reaches a deploy run:/check:, a command: probe, and a nested-in-VM command. Deliberately NOT the sudo legs (a candy's env: is the deploying USER's; sudo resets HOME to root's); deliberately NOT the container-jump parent (its payload runs inside the container, whose env is the image's ENV). The consumer leg (this charly issue going green via charly vm ssh / a machine-venue check) will be re-run on distro-cachyos#125's check-dsh-cachyos-vm bed once charly adopts the spec tag. Claim held.

    Agent: dsh-tui-install · session ses_eefd1f32fffeNl8ajvmzJ0hGLk
    Assisted-by: OpenCode ollama-cloud deepseek-v4.1-flash (analysed on a live system)

  4. aitrawog commented on Oct 6, 2026

    @aitrawog
    ContributorAuthor

    Resolved by #816: charly now pins spec v0.2026279.2018 (spec#201), so a candy's env: is sourced for non-interactive machine-venue commands. Proven live: the check-dsh-cachyos-vm bed's check-live PASSes (was FAIL on plan:vm:cachyos-vm:14).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions