fix(agent): respect ephemeral_system_prompt over stored DB prompt (#58774) - #59360
Closed
isheng-eqi wants to merge 3 commits into
Closed
fix(agent): respect ephemeral_system_prompt over stored DB prompt (#58774)#59360isheng-eqi wants to merge 3 commits into
isheng-eqi wants to merge 3 commits into
Conversation
…esearch#56918) read_file already blocks /proc/*/maps, /proc/*/mem, /proc/*/auxv, /proc/*/pagemap, and related sensitive pseudo-files via _is_blocked_device_path (NousResearch#56219). search_files applied a separate filter chain through _search_result_read_block_error that only guarded credential-env paths (get_read_block_error) — missing the proc-sensitive patterns. This meant content matches, file listings, and count results could all leak ASLR layout, raw memory, and secrets. Add _is_blocked_device_path to the _search_result_read_block_error guard so all three search_files output modes inherit the same /proc-sensitive blocking that read_file already enforces.
…ch#42961) The local backend unconditionally overwrote terminal.cwd with os.getcwd(), ignoring any explicit terminal.cwd set in config.yaml. Only fall back to os.getcwd() when terminal.cwd is unset or a placeholder (".", "auto", "cwd"); preserve an explicit path. Before: "cd /dir && hermes" was the only way to control cwd After: terminal.cwd: /desired/path in config.yaml works for local too
…usResearch#58774) _restore_or_build_system_prompt unconditionally restored the session-DB stored prompt when it matched the current runtime identity, even when the caller set an explicit ephemeral_system_prompt (e.g. /personality). Check ephemeral_system_prompt before the stored-prompt fast path so a deliberate personality switch takes effect immediately instead of being silently ignored until the next fresh session.
Contributor
Author
|
Recreating from clean main branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/personalitysaves to config but doesn't affect the current CLI session because_restore_or_build_system_prompt()unconditionally restores the session-DB stored prompt when it matches the current runtime identity — even when the caller explicitly setephemeral_system_prompt.Root Cause
In
agent/conversation_loop.py,_restore_or_build_system_promptat L326-330:No check for
ephemeral_system_prompt— stored prompt always wins.Fix
Check
ephemeral_system_promptbefore the stored-prompt fast path. When set (truthy), it takes precedence. The prefix cache will miss for that turn, but that is the expected trade-off for a deliberate personality switch.Test plan
tests/agent/test_system_prompt_restore.py:Related
Closes #58774