Skip to content

Conversation

@MarcCote
Copy link
Collaborator

@MarcCote MarcCote commented Oct 3, 2025

No description provided.

@matheper matheper requested a review from Copilot October 21, 2025 16:54
Copy link
Contributor

Copilot AI left a 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_kwargs using Jinja2
  • Refactored include_os_env_vars parameter to only apply to LocalTerminal
  • 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.

MarcCote and others added 10 commits October 21, 2025 11:50
Add logic to set environment variables for kubectl discovery
* 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.
@MarcCote MarcCote force-pushed the kubernetes_yaml_variable branch from 4fadc22 to efd5a18 Compare October 21, 2025 18:50
@MarcCote MarcCote merged commit ef44c9d into main Oct 22, 2025
10 checks passed
@MarcCote MarcCote deleted the kubernetes_yaml_variable branch October 22, 2025 00:35
matheper added a commit that referenced this pull request Oct 22, 2025
* 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>
matheper added a commit that referenced this pull request Oct 23, 2025
* 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>
xingdi-eric-yuan added a commit that referenced this pull request Oct 24, 2025
* 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>
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.

5 participants