fix(cli): forward system prompt overlay in oneshot (-z) mode (supersedes #34863) - #69957
fix(cli): forward system prompt overlay in oneshot (-z) mode (supersedes #34863)#69957hey-ynot wants to merge 1 commit into
Conversation
…des NousResearch#34863) hermes -z built its AIAgent without the ephemeral system-prompt overlay, so HERMES_EPHEMERAL_SYSTEM_PROMPT and agent.system_prompt were silently ignored in oneshot mode. Mirror the interactive CLI resolution order (cli.py:3992, gateway/run.py:5250): non-empty env var wins, then agent.system_prompt from config, else None (no overlay), and forward it as ephemeral_system_prompt to AIAgent. Credit to NousResearch#34863 for identifying the gap; this is the narrowed, rebased alternative per its sweeper review: no config-show changes, no claim on closed NousResearch#34852, tests target the current run_conversation() contract.
Related to #34863. This narrowed alternative addresses the recorded config-show scope and stale test-contract concerns while retaining the same oneshot overlay-forwarding goal; maintainer selection is needed. |
|
Thanks for the narrowly scoped fix. The current-head premise is confirmed: The proposed forwarding reaches the real wire behavior: Automated hermes-sweeper review. |
Summary
hermes -zbuilds itsAIAgentdirectly inhermes_cli/oneshot.py:_run_agent()(L313) and never forwards the system-prompt overlay, soHERMES_EPHEMERAL_SYSTEM_PROMPTand the configuredagent.system_promptare silently ignored in oneshot mode.Verified on current main (
8fc278207):cli.py:3992and forwards it athermes_cli/cli_agent_setup_mixin.py:369gateway/run.py:5250system_promptreference at all (git grep ephemeral_system_prompt -- hermes_cli/oneshot.py→ empty)AIAgentalready accepts the kwarg (run_agent.py:442)This PR mirrors the interactive resolution order in oneshot:
HERMES_EPHEMERAL_SYSTEM_PROMPTenv var wins,agent.system_promptfrom config,None(no overlay),and forwards the result as
ephemeral_system_prompt=toAIAgent.Supersedes #34863
Credit to #34863 (@wadzwigidy) for identifying the oneshot forwarding gap. This is the narrowed, rebased alternative per the hermes-sweeper review there:
config showchanges (display.personalityis still persisted/used by the TUI attui_gateway/server.py:10742-10743),Fixes #34852claim (that issue was SOUL.md-related and closed after maintainer E2E verification; this PR fixes only overlay forwarding),run_conversation()tuple contract rather than the legacychat()API.Note: the open
-s/--skills-in-oneshot PRs (#65249, #63814, #59402, #31591) pass a skills prompt through the sameephemeral_system_promptseam. None of them reads the env/config overlay, so there is no functional overlap — but whichever lands second will need a one-line rebase at theAIAgent(...)call site (composition of skills prompt + user overlay is left to that PR, matching how the gateway concatenates ephemeral segments).Changes
hermes_cli/oneshot.py: resolve env → config →Noneand passephemeral_system_prompttoAIAgent(12 lines).tests/hermes_cli/test_oneshot_system_prompt.py(new): parametrized regression tests for env precedence, config fallback, empty-env fallback, and no-overlay (None) behavior.How to test
Tests
HERMES_TEST_FILE_RETRIES=0 scripts/run_tests.sh tests/hermes_cli/test_oneshot_system_prompt.py tests/hermes_cli/test_oneshot_usage_file.py tests/hermes_cli/test_tui_resume_flow.py -q→ 82 passed, 0 failedtests/hermes_cli/ tests/cli/sweep run locally; the only failures (11, in cua-driver/WSL/service-manager files) reproduce identically on pristineorigin/mainin this environment (macOS sandbox,/Applicationsnot writable) — none are related to this change.uvx --from ruff==0.15.10 ruff check hermes_cli/oneshot.py tests/hermes_cli/test_oneshot_system_prompt.py→ cleanInteractive CLI and gateway behavior are unchanged.