From 11b0b84e08b12ed5fa96a327c5048bbb4966ef57 Mon Sep 17 00:00:00 2001 From: Dotta Date: Fri, 26 Jun 2026 15:38:17 +0000 Subject: [PATCH] Allow execute_code in Hermes smoke config --- doc/HERMES_GATEWAY_SMOKE.md | 10 +++++-- scripts/smoke/hermes-gateway-e2e.sh | 32 ++++++++++++++------- scripts/smoke/hermes-gateway-smoke.test.mjs | 2 ++ 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/doc/HERMES_GATEWAY_SMOKE.md b/doc/HERMES_GATEWAY_SMOKE.md index ba00cab9c64..99cb25f1f64 100644 --- a/doc/HERMES_GATEWAY_SMOKE.md +++ b/doc/HERMES_GATEWAY_SMOKE.md @@ -37,9 +37,13 @@ and the non-loopback HTTP guard. pnpm smoke:hermes-gateway-e2e ``` - This writes only `model` and `providers: {}` into the temporary Hermes home; - provider keys still come from environment variables and are redacted from - diagnostics. + This writes only `model`, `providers: {}`, and + `command_allowlist: [execute_code]` into the temporary Hermes home. Provider + keys still come from environment variables and are redacted from diagnostics. +- The E2E helper always seeds `command_allowlist: [execute_code]` in the fresh + Hermes config so non-interactive gateway/API runs do not wait for a manual + execute-code approval prompt. Do not copy a host `~/.hermes` directory into + the container to solve approval or provider setup. - Board/operator auth is required through `PAPERCLIP_AUTH_HEADER`, `PAPERCLIP_COOKIE`, or a board-capable `PAPERCLIP_API_KEY`. - Diagnostic files are redacted before they are written, except the join output diff --git a/scripts/smoke/hermes-gateway-e2e.sh b/scripts/smoke/hermes-gateway-e2e.sh index f60be46ad94..7aac9c17369 100755 --- a/scripts/smoke/hermes-gateway-e2e.sh +++ b/scripts/smoke/hermes-gateway-e2e.sh @@ -104,6 +104,9 @@ Mode notes: network and reverse-proxy smoke runs. Raw Hermes and Paperclip API keys are redacted from logs and diagnostic files. + The E2E helper seeds a minimal non-secret Hermes config in the fresh container + state, including command_allowlist: execute_code so gateway/API runs do not + pause on an interactive approval prompt. The generated/claimed key material is kept only in the per-run state directory, which is deleted on success unless HERMES_SMOKE_KEEP=1. @@ -501,10 +504,11 @@ yaml_single_quote() { } write_hermes_model_config() { - if [[ -z "$HERMES_SMOKE_MODEL_PROVIDER" && -z "$HERMES_SMOKE_MODEL_DEFAULT" && -z "$HERMES_SMOKE_MODEL_BASE_URL" ]]; then - return + local has_model_config=0 + if [[ -n "$HERMES_SMOKE_MODEL_PROVIDER" || -n "$HERMES_SMOKE_MODEL_DEFAULT" || -n "$HERMES_SMOKE_MODEL_BASE_URL" ]]; then + has_model_config=1 fi - if [[ -z "$HERMES_SMOKE_MODEL_PROVIDER" || -z "$HERMES_SMOKE_MODEL_DEFAULT" ]]; then + if [[ "$has_model_config" == "1" && ( -z "$HERMES_SMOKE_MODEL_PROVIDER" || -z "$HERMES_SMOKE_MODEL_DEFAULT" ) ]]; then fail "HERMES_SMOKE_MODEL_PROVIDER and HERMES_SMOKE_MODEL_DEFAULT must be set together" fi @@ -514,16 +518,24 @@ write_hermes_model_config() { fi { - echo "model:" - printf " default: %s\n" "$(yaml_single_quote "$HERMES_SMOKE_MODEL_DEFAULT")" - printf " provider: %s\n" "$(yaml_single_quote "$HERMES_SMOKE_MODEL_PROVIDER")" - if [[ -n "$HERMES_SMOKE_MODEL_BASE_URL" ]]; then - printf " base_url: %s\n" "$(yaml_single_quote "$HERMES_SMOKE_MODEL_BASE_URL")" + if [[ "$has_model_config" == "1" ]]; then + echo "model:" + printf " default: %s\n" "$(yaml_single_quote "$HERMES_SMOKE_MODEL_DEFAULT")" + printf " provider: %s\n" "$(yaml_single_quote "$HERMES_SMOKE_MODEL_PROVIDER")" + if [[ -n "$HERMES_SMOKE_MODEL_BASE_URL" ]]; then + printf " base_url: %s\n" "$(yaml_single_quote "$HERMES_SMOKE_MODEL_BASE_URL")" + fi + echo "providers: {}" fi - echo "providers: {}" + echo "command_allowlist:" + echo "- execute_code" } > "$config_file" chmod 644 "$config_file" - log "seeded Hermes model config provider=${HERMES_SMOKE_MODEL_PROVIDER} model=${HERMES_SMOKE_MODEL_DEFAULT}" + if [[ "$has_model_config" == "1" ]]; then + log "seeded Hermes model config provider=${HERMES_SMOKE_MODEL_PROVIDER} model=${HERMES_SMOKE_MODEL_DEFAULT}" + else + log "seeded Hermes smoke config" + fi } start_container() { diff --git a/scripts/smoke/hermes-gateway-smoke.test.mjs b/scripts/smoke/hermes-gateway-smoke.test.mjs index cb36e94e620..49efa5d6821 100644 --- a/scripts/smoke/hermes-gateway-smoke.test.mjs +++ b/scripts/smoke/hermes-gateway-smoke.test.mjs @@ -86,6 +86,8 @@ config="$HERMES_SMOKE_STATE_DIR/hermes-home/config.yaml" grep -Fq "default: 'z-ai/glm-5.2'" "$config" grep -Fq "provider: 'openrouter'" "$config" grep -Fq "base_url: 'https://openrouter.ai/api/v1'" "$config" +grep -Fq "command_allowlist:" "$config" +grep -Fq -- "- execute_code" "$config" ! grep -Eiq "api[_-]?key|token|secret" "$config" `, );