-
Couldn't load subscription status.
- Fork 36
Support env variable in pod_spec_kwargs #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for environment variable substitution in pod_spec_kwargs for the Kubernetes terminal using Jinja2 templating. The changes also refactor environment variable handling by moving OS environment variable inclusion from the base Terminal class to the LocalTerminal subclass, and add default environment variables (PATH, KUBECONFIG) to the Kubernetes terminal.
Key changes:
- Environment variable templating in
pod_spec_kwargsusing Jinja2 - Refactored
include_os_env_varsparameter to only apply toLocalTerminal - Added default PATH and KUBECONFIG environment variables to
KubernetesTerminal
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/gym/terminals/test_kubernetes.py | Updated tests to validate environment variables and added new test for pod spec templating |
| pyproject.toml | Added isort and black to dev dependencies |
| debug_gym/gym/terminals/terminal.py | Removed include_os_env_vars parameter and os import from base Terminal class |
| debug_gym/gym/terminals/shell_session.py | Fixed command list building to prevent double shell expansion |
| debug_gym/gym/terminals/local.py | Added include_os_env_vars parameter handling specific to LocalTerminal |
| debug_gym/gym/terminals/kubernetes.py | Added Jinja2 templating for pod specs, default env vars, kube_context support, and updated labels |
| debug_gym/gym/terminals/docker.py | Removed include_os_env_vars parameter |
| debug_gym/gym/terminals/init.py | Removed docker-only parameter check for local terminal |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Add logic to set environment variables for kubectl discovery
…] keeping the command string intact
* Refactor terminal classes to allow include_os_env_vars param only for local terminal * Removed include_os_env_vars from kubernetes terminal * Set include_os_env_vars to True by default in LocalTerminal * Initialize env_vars in LocalTerminal constructor to ensure it defaults to an empty dictionary.
4fadc22 to
efd5a18
Compare
* Support env variable in pod_spec_kwargs * Ensure kubectl binaries are discoverable Add logic to set environment variables for kubectl discovery * update test_kubernetes * Refactor ShellSession to split shell_command, then add ["-c", command] keeping the command string intact * Pass Kubernetes service environment variables to support in-cluster kubectl access * Add isort and black to development dependencies * black and isort * Terminal env vars (#256) * Refactor terminal classes to allow include_os_env_vars param only for local terminal * Removed include_os_env_vars from kubernetes terminal * Set include_os_env_vars to True by default in LocalTerminal * Initialize env_vars in LocalTerminal constructor to ensure it defaults to an empty dictionary. * Removed redundant environment variable handling for in-cluster Kubernetes access * Simply logic * Set default base image --------- Co-authored-by: Alessandro Sordoni <alessandro.sordoni@gmail.com> Co-authored-by: Xingdi (Eric) Yuan <xingdi-eric-yuan@users.noreply.github.com> Co-authored-by: Matheus Pereira <matpereira@microsoft.com>
* Refactor tokenization methods to accept messages as input * Update README.md Co-authored-by: Marc-Alexandre Côté <marc.cote.19@gmail.com> * Update debug_gym/llms/openai.py Co-authored-by: Marc-Alexandre Côté <marc.cote.19@gmail.com> * Specify base images for mini-nightmare and aider (#255) * specify base image for mini nightmare * switch to debug-gym:aider image * remove default image * passing base image * test workspace * formatting issues * Simplify configs. Fix issue with overwriting entrypoints. --------- Co-authored-by: Marc-Alexandre Côté <marc.cote.19@gmail.com> * Support env variable in pod_spec_kwargs (#248) * Support env variable in pod_spec_kwargs * Ensure kubectl binaries are discoverable Add logic to set environment variables for kubectl discovery * update test_kubernetes * Refactor ShellSession to split shell_command, then add ["-c", command] keeping the command string intact * Pass Kubernetes service environment variables to support in-cluster kubectl access * Add isort and black to development dependencies * black and isort * Terminal env vars (#256) * Refactor terminal classes to allow include_os_env_vars param only for local terminal * Removed include_os_env_vars from kubernetes terminal * Set include_os_env_vars to True by default in LocalTerminal * Initialize env_vars in LocalTerminal constructor to ensure it defaults to an empty dictionary. * Removed redundant environment variable handling for in-cluster Kubernetes access * Simply logic * Set default base image --------- Co-authored-by: Alessandro Sordoni <alessandro.sordoni@gmail.com> Co-authored-by: Xingdi (Eric) Yuan <xingdi-eric-yuan@users.noreply.github.com> Co-authored-by: Matheus Pereira <matpereira@microsoft.com> * Move trim utils to llms * Remove message normalization from HuggingFaceLLM * Adjust message truncation logic and update test assertion for token counts --------- Co-authored-by: Marc-Alexandre Côté <marc.cote.19@gmail.com> Co-authored-by: Chinmay Singh <chsingh@microsoft.com> Co-authored-by: Alessandro Sordoni <alessandro.sordoni@gmail.com> Co-authored-by: Xingdi (Eric) Yuan <xingdi-eric-yuan@users.noreply.github.com>
* hf llm * minor * Update test_huggingface.py * Update huggingface.py * test w real tokenizer * Update test_huggingface.py * Add apply_chat_template and enable_thinking options to LLMConfig and OpenAILLM * Update llms tests * Add apply_chat_template and cache tokenizer for HuggingFaceLLM * Refactor imports in agents and llms modules * Refactor tokenization methods to accept messages as input (#258) * Refactor tokenization methods to accept messages as input * Update README.md Co-authored-by: Marc-Alexandre Côté <marc.cote.19@gmail.com> * Update debug_gym/llms/openai.py Co-authored-by: Marc-Alexandre Côté <marc.cote.19@gmail.com> * Specify base images for mini-nightmare and aider (#255) * specify base image for mini nightmare * switch to debug-gym:aider image * remove default image * passing base image * test workspace * formatting issues * Simplify configs. Fix issue with overwriting entrypoints. --------- Co-authored-by: Marc-Alexandre Côté <marc.cote.19@gmail.com> * Support env variable in pod_spec_kwargs (#248) * Support env variable in pod_spec_kwargs * Ensure kubectl binaries are discoverable Add logic to set environment variables for kubectl discovery * update test_kubernetes * Refactor ShellSession to split shell_command, then add ["-c", command] keeping the command string intact * Pass Kubernetes service environment variables to support in-cluster kubectl access * Add isort and black to development dependencies * black and isort * Terminal env vars (#256) * Refactor terminal classes to allow include_os_env_vars param only for local terminal * Removed include_os_env_vars from kubernetes terminal * Set include_os_env_vars to True by default in LocalTerminal * Initialize env_vars in LocalTerminal constructor to ensure it defaults to an empty dictionary. * Removed redundant environment variable handling for in-cluster Kubernetes access * Simply logic * Set default base image --------- Co-authored-by: Alessandro Sordoni <alessandro.sordoni@gmail.com> Co-authored-by: Xingdi (Eric) Yuan <xingdi-eric-yuan@users.noreply.github.com> Co-authored-by: Matheus Pereira <matpereira@microsoft.com> * Move trim utils to llms * Remove message normalization from HuggingFaceLLM * Adjust message truncation logic and update test assertion for token counts --------- Co-authored-by: Marc-Alexandre Côté <marc.cote.19@gmail.com> Co-authored-by: Chinmay Singh <chsingh@microsoft.com> Co-authored-by: Alessandro Sordoni <alessandro.sordoni@gmail.com> Co-authored-by: Xingdi (Eric) Yuan <xingdi-eric-yuan@users.noreply.github.com> --------- Co-authored-by: Matheus Pereira <matpereira@microsoft.com> Co-authored-by: Marc-Alexandre Côté <marc.cote.19@gmail.com> Co-authored-by: Chinmay Singh <chsingh@microsoft.com> Co-authored-by: Alessandro Sordoni <alessandro.sordoni@gmail.com>
No description provided.