Skip to content

feat: add support for forwarding the entire env - #425

Merged
ethanpailes merged 1 commit into
masterfrom
add-forward-all-env
Sep 10, 2026
Merged

ethanpailes merged 1 commit into
masterfrom
add-forward-all-env

Conversation

@ethanpailes

Copy link
Copy Markdown
Contributor

Issue Link

#241

AI Policy Ack

Ack

This PR was:

  • mostly or completely vibe coded
  • mostly or completely meat coded
  • bit of both

Description

This patch extends the forward_env config option so that you can write

forward_env = true

in addition to setting up a fixed list of variables to forward. With this setting enabled, all variables present in the shell that shpool attach was launched from will be forwarded.

Additionally, you can put

forward_env = false

to completely disable env var forwarding. Currently, we have a small handful of variables that we forward by default, so this new false setting allows users to fully prevent them being forwarded if they so desire.

Fixes #241

@ethanpailes
ethanpailes force-pushed the add-forward-all-env branch 2 times, most recently from 5f24f49 to bd69589 Compare September 2, 2026 21:09
Comment thread libshpool/src/attach.rs Outdated
.filter(|(var, _)| local_env_keys.contains(var.as_str()))
.collect(),
};
info!(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

even though this is just the keys, maybe it'd be better to make this debug verbosity? I'm not sure how sensitive that is or not, tbh.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point, switched to debug.

Comment thread libshpool/src/attach.rs Outdated
let forward_env = self.config_manager.get().forward_env.clone();
let mut local_env_keys = vec!["TERM", "DISPLAY", "LANG", "SSH_AUTH_SOCK"];
if let Some(fenv) = &forward_env {
let mut local_env_keys = HashSet::with_capacity(4);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: I think you could move the default keys and the full env implementations into the local_env match below and it'd be a little cleaner.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point, switched.

This patch extends the forward_env config option so that
you can write

```
forward_env = true
```

in addition to setting up a fixed list of variables to forward.
With this setting enabled, all variables present in the shell
that `shpool attach` was launched from will be forwarded.

Additionally, you can put

```
forward_env = false
```

to completely disable env var forwarding. Currently, we have a
small handful of variables that we forward by default, so this new
false setting allows users to fully prevent them being forwarded
if they so desire.

Fixes #241
@ethanpailes
ethanpailes merged commit 72cad93 into master Sep 10, 2026
12 checks passed
@ethanpailes
ethanpailes deleted the add-forward-all-env branch September 10, 2026 20:34
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.

Feature request: Inherit CWD and runtime environment

2 participants