Skip to content

fix(config): keep a workspace's user_data script as written - #1780

Merged
edenreich merged 1 commit into
mainfrom
fix/keep-user-data-as-written
Nov 9, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/keep-user-data-as-written

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

A kubernetes workspace's user_data reached the pod with every shell variable blanked. The daemon ran os.ExpandEnv over the whole daemon.yaml text before parsing it, so "$OPENTASK_DIR" in the script became "" and the desktop's default user data failed at boot with install: '': chmod failed, putting the computer in a restart loop. There was no way to escape it either, as os.ExpandEnv turns $$X into X.

Sidecar files now expand ${VAR} references after parsing, value by value, and skip user_data, whose $VARS belong to the shell that runs it.

Changes

  • cmd/runtime/config.go: readYAMLMap parses into a yaml.Node and expandEnvValues expands every scalar except a user_data value. An unquoted scalar takes the type of its expanded value, so port: ${PORT} is still a number, also through the fixups that re-marshal their file. An expanded value can no longer add YAML structure. An empty file still reads as nil.
  • cmd/runtime/isolation_test.go: TestWorkspaceUserDataKeepsItsShellVariables (fails before this change) and TestExpandedUnquotedValueKeepsItsType.
  • docs/daemon.md: user_data is the one value whose $VAR references are never expanded.

Follow-up to #1777.

The daemon expanded ${VAR} references across the whole daemon.yaml text,
so the $VARS of a user_data script were replaced with the daemon's empty
environment and the computer ran a broken script at boot. Sidecar values
now expand after parsing, every value except user_data, and an unquoted
value still takes the type of what it expands to.
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 9, 2026
@edenreich
edenreich marked this pull request as ready for review November 9, 2026 19:38
@edenreich
edenreich requested a review from a team as a code owner November 9, 2026 19:38
@edenreich
edenreich merged commit d03f437 into main Nov 9, 2026
1 check passed
@edenreich
edenreich deleted the fix/keep-user-data-as-written branch November 9, 2026 20:01
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.251.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 9, 2026
@edenreich edenreich moved this from Todo to Done in 2026 Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant