Skip to content

fix(scripts): use PYTHON_HISTORY instead of unsupported PYTHONHISTFILE#1774

Merged
ericksoa merged 3 commits intoNVIDIA:mainfrom
latenighthackathon:fix/python-history-envvar
Apr 15, 2026
Merged

fix(scripts): use PYTHON_HISTORY instead of unsupported PYTHONHISTFILE#1774
ericksoa merged 3 commits intoNVIDIA:mainfrom
latenighthackathon:fix/python-history-envvar

Conversation

@latenighthackathon
Copy link
Copy Markdown
Contributor

@latenighthackathon latenighthackathon commented Apr 11, 2026

Summary

Replace PYTHONHISTFILE with PYTHON_HISTORY in the sandbox environment variable redirects.

Problem

nemoclaw-start.sh sets PYTHONHISTFILE=/tmp/.python_history to redirect the Python REPL history file to /tmp/. However, PYTHONHISTFILE is not a recognized CPython environment variable. Python 3.13+ uses PYTHON_HISTORY for this purpose, and earlier versions have no environment variable control at all. The current setting is silently ignored.

Fix

One-line change: PYTHONHISTFILE to PYTHON_HISTORY on line 68 of scripts/nemoclaw-start.sh.

Test plan

  • All 58 nemoclaw-start tests pass

Closes #1735

Signed-off-by: latenighthackathon latenighthackathon@users.noreply.github.com

Summary by CodeRabbit

  • Chores
    • Updated the environment variable used to direct Python history to a temporary file in startup scripts and aligned tests to expect the new variable name.

PYTHONHISTFILE is not recognized by CPython. Python 3.13+ uses
PYTHON_HISTORY to control the .python_history file location.
The sandbox was setting the wrong variable name, so the Python
REPL ignored it and wrote history to the default location.

Closes NVIDIA#1735

Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e24cae0c-33e4-4e9c-aad8-58284db2f37b

📥 Commits

Reviewing files that changed from the base of the PR and between 8ef484b and 743f57b.

📒 Files selected for processing (1)
  • scripts/nemoclaw-start.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/nemoclaw-start.sh

📝 Walkthrough

Walkthrough

Replaced the incorrect Python history environment variable name PYTHONHISTFILE with PYTHON_HISTORY in the startup script and updated tests to expect the new variable; no other logic or exports were changed.

Changes

Cohort / File(s) Summary
Startup script
scripts/nemoclaw-start.sh
Changed _TOOL_REDIRECTS entry: PYTHONHISTFILE=/tmp/.python_historyPYTHON_HISTORY=/tmp/.python_history.
Tests
test/service-env.test.ts
Updated assertions to expect PYTHON_HISTORY=/tmp/.python_history in the entrypoint export check and the generated proxy-env.sh content.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped and tuned a single line,
Swapped a name so history can shine,
PYTHON_HISTORY now finds its way,
/tmp/ holds stories of the day,
A tiny fix — hooray! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: replacing PYTHONHISTFILE with PYTHON_HISTORY in scripts, which matches the core fix in the PR.
Linked Issues check ✅ Passed The PR addresses the coding requirement from issue #1735 by replacing PYTHONHISTFILE with PYTHON_HISTORY, enabling forward compatibility with Python 3.13+ when the base image is upgraded.
Out of Scope Changes check ✅ Passed All changes are directly related to the objective: renaming the environment variable in the script and updating corresponding tests, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/nemoclaw-start.sh`:
- Line 68: Update the tests to match the renamed environment variable: replace
assertions that expect PYTHONHISTFILE with PYTHON_HISTORY in
test/service-env.test.ts (specifically the assertions around the snippets you
noted). Search for all occurrences of "PYTHONHISTFILE" in
test/service-env.test.ts (including the two assertion blocks around lines
~170-182 and ~346-358) and change them to expect "PYTHON_HISTORY" so the tests
align with the script change in scripts/nemoclaw-start.sh.
- Line 68: Replace the incorrect environment variable name 'PYTHON_HISTORY' with
the standard Python variable 'PYTHONHISTFILE' in the script (update the string
"'PYTHON_HISTORY=/tmp/.python_history'" to use 'PYTHONHISTFILE'), so Python 3.4+
will pick up the history file; ensure the rest of the line's formatting
(quotes/export) remains consistent with surrounding environment variable
assignments.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 07891a12-82d4-4770-8fc9-61e8407c07bd

📥 Commits

Reviewing files that changed from the base of the PR and between 035144e and 4533303.

📒 Files selected for processing (1)
  • scripts/nemoclaw-start.sh

Comment thread scripts/nemoclaw-start.sh
Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
@cr7258
Copy link
Copy Markdown
Contributor

cr7258 commented Apr 13, 2026

We need to upgrade the Python version in the sandbox as well; otherwise, the PYTHON_HISTORY env doesn't take effect.
https://github.com/NVIDIA/NemoClaw/blob/v0.0.14/Dockerfile.base#L56-L58

@wscurran wscurran added bug Something isn't working fix labels Apr 13, 2026
@wscurran
Copy link
Copy Markdown
Contributor

@latenighthackathon
Copy link
Copy Markdown
Contributor Author

@cr7258 Good catch — the sandbox base image pins Python 3.11.2 (Debian bookworm), and PYTHON_HISTORY is only recognized by Python 3.13+. The old PYTHONHISTFILE wasn't a real CPython env var either, so neither version actually redirects history on 3.11.

This rename is the correct forward-compatible half: once the base image upgrades to 3.13+, the var will take effect without any further script changes. The Python upgrade itself is a bigger lift — bookworm doesn't ship 3.13, so it'd require a base-image or repo change, re-pinning all apt packages, and validating against C API / removed-module breakage across 3.12–3.13. Will leave the Python version bump to maintainer team as it would require more discussion.

Cheers!

@cv cv added the v0.0.16 Release target label Apr 14, 2026
Copy link
Copy Markdown
Contributor

@ericksoa ericksoa left a comment

Choose a reason for hiding this comment

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

LGTM — correct fix. PYTHON_HISTORY is the real CPython 3.13+ env var; PYTHONHISTFILE was never recognized. Tests updated to match.

@ericksoa ericksoa merged commit 214d13e into NVIDIA:main Apr 15, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fix v0.0.16 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[all platform] sandbox uses unsupported and incorrectly named history environment variable PYTHONHISTFILE

5 participants