mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-30 19:09:28 +00:00
test(tui): pin approval-mode fixtures to env HERMES_HOME for canonical resolver
Some checks failed
CI / Detect affected areas (push) Waiting to run
CI / Python tests (push) Blocked by required conditions
CI / Python lints (push) Blocked by required conditions
CI / JS & TS checks (push) Blocked by required conditions
CI / Desktop E2E (push) Blocked by required conditions
CI / Docs Site (push) Blocked by required conditions
CI / Deny unrelated histories (push) Blocked by required conditions
CI / Check contributors (push) Blocked by required conditions
CI / Check uv.lock (push) Blocked by required conditions
CI / Check no committed infographics (push) Blocked by required conditions
CI / package-lock.json diff (push) Blocked by required conditions
CI / Lint Docker scripts (push) Blocked by required conditions
CI / Build&Test Docker image (push) Blocked by required conditions
CI / Supply-chain scan (push) Blocked by required conditions
CI / Review label gate (push) Blocked by required conditions
CI / OSV scan (push) Waiting to run
CI / CI review comment (live) (push) Blocked by required conditions
CI / All required checks pass (push) Blocked by required conditions
CI / CI timing report (push) Blocked by required conditions
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
Docker Build, Test, and Publish / build (amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=docker-amd64, linux/amd64, ubuntu-latest) (push) Waiting to run
Docker Build, Test, and Publish / build (arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope=docker-arm64, linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Docker Build, Test, and Publish / publish (amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=docker-amd64, linux/amd64, ubuntu-latest) (push) Blocked by required conditions
Docker Build, Test, and Publish / publish (arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope=docker-arm64, linux/arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
Docker Build, Test, and Publish / merge (push) Blocked by required conditions
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Waiting to run
auto-fix lint issues & formatting / Apply patch (push) Blocked by required conditions
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Some checks failed
CI / Detect affected areas (push) Waiting to run
CI / Python tests (push) Blocked by required conditions
CI / Python lints (push) Blocked by required conditions
CI / JS & TS checks (push) Blocked by required conditions
CI / Desktop E2E (push) Blocked by required conditions
CI / Docs Site (push) Blocked by required conditions
CI / Deny unrelated histories (push) Blocked by required conditions
CI / Check contributors (push) Blocked by required conditions
CI / Check uv.lock (push) Blocked by required conditions
CI / Check no committed infographics (push) Blocked by required conditions
CI / package-lock.json diff (push) Blocked by required conditions
CI / Lint Docker scripts (push) Blocked by required conditions
CI / Build&Test Docker image (push) Blocked by required conditions
CI / Supply-chain scan (push) Blocked by required conditions
CI / Review label gate (push) Blocked by required conditions
CI / OSV scan (push) Waiting to run
CI / CI review comment (live) (push) Blocked by required conditions
CI / All required checks pass (push) Blocked by required conditions
CI / CI timing report (push) Blocked by required conditions
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
Docker Build, Test, and Publish / build (amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=docker-amd64, linux/amd64, ubuntu-latest) (push) Waiting to run
Docker Build, Test, and Publish / build (arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope=docker-arm64, linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Docker Build, Test, and Publish / publish (amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=docker-amd64, linux/amd64, ubuntu-latest) (push) Blocked by required conditions
Docker Build, Test, and Publish / publish (arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope=docker-arm64, linux/arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
Docker Build, Test, and Publish / merge (push) Blocked by required conditions
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Waiting to run
auto-fix lint issues & formatting / Apply patch (push) Blocked by required conditions
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
_load_approval_mode now delegates to tools.approval._get_approval_mode, which reads config via hermes_cli.config.load_config — that path resolves HERMES_HOME from the environment, not the server module's _hermes_home attribute. The four approval-mode tests only monkeypatched the module attribute, so the resolver silently read the developer/CI real config (default 'smart') instead of the temp fixture. Behavior assertions are unchanged (invalid → manual fail-safe, YAML off-bool → 'off', three-way persist + live emit); the fixtures now also set HERMES_HOME so the canonical read path sees the same temp config.
This commit is contained in:
parent
eff3b11eb2
commit
c5d37bb95c
1 changed files with 16 additions and 0 deletions
|
|
@ -5313,6 +5313,10 @@ def test_config_get_approval_mode_uses_smart_default_when_key_is_missing(
|
|||
import yaml
|
||||
|
||||
monkeypatch.setattr(server, "_hermes_home", tmp_path)
|
||||
# Point the canonical resolver (load_config → env HERMES_HOME) at the
|
||||
# temp home too, so the smart default is asserted against THIS config
|
||||
# rather than whatever the developer's real ~/.hermes happens to hold.
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
||||
(tmp_path / "config.yaml").write_text(
|
||||
yaml.safe_dump({"approvals": {"timeout": 15}})
|
||||
)
|
||||
|
|
@ -5329,6 +5333,11 @@ def test_config_get_approval_mode_fails_safe_to_manual_for_invalid_explicit_valu
|
|||
import yaml
|
||||
|
||||
monkeypatch.setattr(server, "_hermes_home", tmp_path)
|
||||
# _load_approval_mode delegates to the canonical resolver in
|
||||
# tools.approval, which reads via hermes_cli.config.load_config —
|
||||
# that path resolves HERMES_HOME from the environment, not
|
||||
# server._hermes_home.
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
||||
(tmp_path / "config.yaml").write_text(
|
||||
yaml.safe_dump({"approvals": {"mode": "sometimes"}})
|
||||
)
|
||||
|
|
@ -5343,6 +5352,9 @@ def test_config_get_approval_mode_normalizes_yaml_off(tmp_path, monkeypatch):
|
|||
import yaml
|
||||
|
||||
monkeypatch.setattr(server, "_hermes_home", tmp_path)
|
||||
# See fail-safe test above: the canonical resolver reads via
|
||||
# load_config, which resolves HERMES_HOME from the environment.
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
||||
(tmp_path / "config.yaml").write_text(
|
||||
yaml.safe_dump({"approvals": {"mode": False}})
|
||||
)
|
||||
|
|
@ -5359,6 +5371,10 @@ def test_config_set_approval_mode_persists_three_way_value_and_emits_live_status
|
|||
import yaml
|
||||
|
||||
monkeypatch.setattr(server, "_hermes_home", tmp_path)
|
||||
# config.set writes via server._hermes_home, but the post-write
|
||||
# session.info emit resolves the effective mode through the canonical
|
||||
# tools.approval resolver (load_config → env HERMES_HOME).
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
||||
emitted = []
|
||||
monkeypatch.setattr(server, "_emit", lambda *args: emitted.append(args))
|
||||
server._sessions["sid"] = {"agent": object(), "session_key": "profile-session"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue