mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
test(system_prompt): cover surface-aware context-file cwd contract
Updates TestContextFileCwd for the #64590 rework: the CLI now receives its launch dir explicitly (previously None), daemon surfaces receive None, and a configured TERMINAL_CWD wins on every surface.
This commit is contained in:
parent
e7d6840989
commit
e89d56e48d
1 changed files with 19 additions and 5 deletions
|
|
@ -46,15 +46,29 @@ def _captured_context_cwd(agent):
|
|||
|
||||
|
||||
class TestContextFileCwd:
|
||||
def test_none_when_terminal_cwd_unset(self, monkeypatch):
|
||||
# Unset → None, so discovery falls back to the launch dir inside
|
||||
# build_context_files_prompt (the local-CLI #19242 contract).
|
||||
def test_cli_launch_dir_when_terminal_cwd_unset(self, monkeypatch, tmp_path):
|
||||
# Unset → the interactive CLI (empty/None platform defaults to it)
|
||||
# promotes its launch dir to an explicit choice, so discovery loads
|
||||
# context files from it even inside the Hermes checkout (#64590).
|
||||
monkeypatch.delenv("TERMINAL_CWD", raising=False)
|
||||
assert _captured_context_cwd(_make_agent()) is None
|
||||
monkeypatch.chdir(tmp_path)
|
||||
assert _captured_context_cwd(_make_agent()) == str(tmp_path)
|
||||
|
||||
def test_daemon_none_when_terminal_cwd_unset(self, monkeypatch, tmp_path):
|
||||
# Daemon surfaces pass None so build_context_files_prompt's
|
||||
# install-tree fallback guard applies — their process cwd is an
|
||||
# accident of spawning, not a user choice (#64590).
|
||||
monkeypatch.delenv("TERMINAL_CWD", raising=False)
|
||||
monkeypatch.chdir(tmp_path)
|
||||
assert _captured_context_cwd(_make_agent(platform="tui")) is None
|
||||
|
||||
def test_configured_dir_when_terminal_cwd_set(self, monkeypatch, tmp_path):
|
||||
monkeypatch.setenv("TERMINAL_CWD", str(tmp_path))
|
||||
assert _captured_context_cwd(_make_agent()) == tmp_path
|
||||
assert _captured_context_cwd(_make_agent()) == str(tmp_path)
|
||||
|
||||
def test_configured_dir_wins_on_daemon_surface(self, monkeypatch, tmp_path):
|
||||
monkeypatch.setenv("TERMINAL_CWD", str(tmp_path))
|
||||
assert _captured_context_cwd(_make_agent(platform="telegram")) == str(tmp_path)
|
||||
|
||||
|
||||
def _stable_prompt(agent):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue