Skip to content

setup-devkit-toolchain env forward corrupts GITHUB_ENV via shellHook stdout banner #1189

Closed

Description

@c-vigo

Description

1.4.0-rc2 consumer validation (org-config PR vig-os/org-config#54, sync-issues-action PR vig-os/sync-issues-action#143) fails on every direnv-mode host CI job at "Set up devkit toolchain":

Forwarded 31 dev-shell shellHook env var(s) to GITHUB_ENV.
##[error]Unable to process file command 'env' successfully.
##[error]Invalid format 'devcontainer dev environment loaded (nix)'

Root cause

The #1180 shellHook env forwarding captures the dev-shell environment via

nix develop --profile ... --command env -0 > "$RUNNER_TEMP/devkit-devshell-env"

i.e. it redirects the whole stdout of nix develop into the dump file. But the devkit-scaffolded flake shellHook echoes a banner to stdout (echo "devcontainer dev environment loaded (nix)"), which lands before the env -0 output in the same stream. The first NUL-delimited record becomes <banner>\n<FIRST_VAR>=<value>; since the host dump has no banner, the record is classified "changed" and forwarded, writing a heredoc whose name line contains the bare banner text — which GitHub's env file-command processor rejects, failing the job.

Both the banner and the action are devkit-managed, so every direnv-mode consumer on 1.4.0 breaks and cannot fix it locally. rc2's own smoke test missed it because the smoke-test consumer is container-mode (the direnv preamble never runs).

Fix

  1. Dump the environment to a file inside the dev-shell command instead of capturing stdout: nix develop ... --command bash -c 'env -0 > "$1"' _ "$RUNNER_TEMP/devkit-devshell-env" — banner stdout stays on the job log, the dump stays clean.
  2. Defense in depth: skip records whose name is not a valid env identifier (^[A-Za-z_][A-Za-z0-9_]*$) so a corrupted record can never reach GITHUB_ENV again.

TDD: extend tests/test_setup_toolchain_env.py — make the stub nix emit the banner on stdout like the real flake does; assert the banner never reaches GITHUB_ENV and the first env record survives intact.

Fix targets release/1.4.0 per the RC-validation runbook (like #1187); rc3 follows.

Impact

Blocks 1.4.0 — all three Wave-1 consumer validation PRs are red on this.

Activity

  1. added
    bug
    priority:blocking
    area:ci
    area:workspace
    effort:small
    semver:patch
    on Jul 17, 2026
  2. c-vigo commented on Jul 20, 2026

    @c-vigo
    ContributorAuthor

    Fixed via PR #1190 (merged into release/1.4.0 @b533ef98): env dump written to a file inside the shell command + non-identifier record names skipped, so shellHook stdout banners can no longer corrupt GITHUB_ENV. Live-proven on rc3 (all three Wave-1 direnv lanes: rc2 "Forwarded 31" incl. corrupted record → rc3 "Forwarded 30", zero errors) and every rc since; shipped in 1.4.0. The systemic gap this exposed is tracked in #1194.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ciarea:workspacebugeffort:smallpriority:blockingsemver:patch

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions