Skip to content

execute_bash tool should be able to inherent current env vars #243

Closed

Description

@xingyaoww

Right now, if we do:

export A=A

and then start a new execute_bash tool and try to echo $A, it won't print anything since we start a new branch tmux/subprocess session independent of the current shell.

We should make sure "env" is inherited

Activity

  1. added
    openhands
    on Sep 13, 2025
  2. openhands-ai commented on Sep 13, 2025

    @openhands-ai

    I'm on it! xingyaoww can track my progress at all-hands.dev

    🔴 Solvability: HARD

    This issue appears to be completely empty with no title or description provided, making it impossible to understand what problem needs to be solved. The lack of any contextual information, technical details, or problem description creates significant barriers to resolution.

    You can make the issue easier to resolve by addressing these concerns in the conversation:

    • Provide a clear title and detailed description of the problem you're experiencing
    • Include specific error messages, code snippets, or examples that demonstrate the issue
    • Add information about your environment, setup, and steps to reproduce the problem

  3. added a commit that references this issue on Sep 13, 2025
    94bab8b
  4. openhands-ai commented on Sep 13, 2025

    @openhands-ai

    Summary

    I have successfully fixed issue #243 - "execute_bash tool should be able to inherit current env vars".

    ✅ Request Completion Checklist:

    🔧 Changes Made:

    Code Changes (concise and targeted):

    • TmuxTerminal fix: Added env = os.environ.copy() and passed environment=env to new_session() and new_window() calls (3 lines of actual changes)
    • Test coverage: Added test_environment_variable_inheritance_from_parent() to verify the fix works for both terminal types

    Root Cause: TmuxTerminal wasn't passing environment variables to tmux session creation, while SubprocessTerminal already worked correctly.

    🎯 Result:

    Now when you export A=A in the parent process and use the execute_bash tool with echo $A, the environment variable will be correctly inherited and displayed in both tmux and subprocess terminal backends.

    PR Ready for Review: #245

    View full conversation

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

    openhands

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions