fix: pass code_file=True to redact_sensitive_text in execute_code and terminal - #33840
fix: pass code_file=True to redact_sensitive_text in execute_code and terminal#33840annguyenNous wants to merge 1 commit into
Conversation
… terminal Fixes NousResearch#33801 redact_sensitive_text() has code_file=True to skip ENV-assignment and JSON-field regex patterns that corrupt code output. file_tools.py already uses it, but code_execution_tool.py (3 calls) and terminal_tool.py (1 call) were missing it. Added code_file=True to all 4 calls.
|
Verified: correctly extends Consistency check: Semantic correctness: Scope completeness: |
|
Thanks — the It wasn't sufficient on its own, though: |
Fixes #33801
Problem
redact_sensitive_text()corrupts code syntax in tool output fromexecute_codeandterminal. The function has acode_file=Trueparameter that skips ENV-assignment and JSON-field regex patterns which cause false positives on code output.file_tools.pyalready usescode_file=Truefor bothread_file(line 573) andwrite_file(line 996), butcode_execution_tool.pyandterminal_tool.pywere missing it.Fix
Added
code_file=Trueto all 4redact_sensitive_textcalls:tools/code_execution_tool.pyline 998: stdout_texttools/code_execution_tool.pyline 1381: stdout_texttools/code_execution_tool.pyline 1382: stderr_texttools/terminal_tool.pyline 2122: outputBehavior Change
MAX_TOKENS = 100MAX_TOKENS = ***MAX_TOKENS = 100"apiKey": "test""apiKey": "***""apiKey": "test"sk-proj-abc123...sk-pro...1234(still redacted)sk-pro...1234(still redacted)Prefix patterns, auth headers, private keys, DB connstrings, JWTs, and URL secrets are still redacted even with
code_file=True.