hermes - 💡(How to fix) Fix setup_open_webui.sh nested-heredoc strips single quotes in embedded Python launcher template

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

scripts/setup_open_webui.sh write_launcher() writes a launcher script that contains an inline Python heredoc to extract API_SERVER_KEY from ~/.hermes/.env. When setup_open_webui.sh is itself invoked through bash heredoc layers (nested SSH sessions, automation wrappers, remote dispatch scripts), bash interpolates inside the non-quoted EOF and strips Python's literal single quotes from constructs like Path.home() / '.hermes' / '.env'. The emitted launcher then fails at runtime with SyntaxError: invalid syntax.

Root Cause

scripts/setup_open_webui.sh write_launcher() writes a launcher script that contains an inline Python heredoc to extract API_SERVER_KEY from ~/.hermes/.env. When setup_open_webui.sh is itself invoked through bash heredoc layers (nested SSH sessions, automation wrappers, remote dispatch scripts), bash interpolates inside the non-quoted EOF and strips Python's literal single quotes from constructs like Path.home() / '.hermes' / '.env'. The emitted launcher then fails at runtime with SyntaxError: invalid syntax.

Fix Action

Fix / Workaround

scripts/setup_open_webui.sh write_launcher() writes a launcher script that contains an inline Python heredoc to extract API_SERVER_KEY from ~/.hermes/.env. When setup_open_webui.sh is itself invoked through bash heredoc layers (nested SSH sessions, automation wrappers, remote dispatch scripts), bash interpolates inside the non-quoted EOF and strips Python's literal single quotes from constructs like Path.home() / '.hermes' / '.env'. The emitted launcher then fails at runtime with SyntaxError: invalid syntax.

Workaround (applied 2026-05-31 on Studio 2)

  • Hermes Agent: v0.15.2
  • Trigger: any nested-heredoc invocation path (SSH heredoc, remote dispatch wrapper, etc.)

Code Example

ssh studio2 'bash -s' <<EOF
$(cat ~/.hermes/hermes-agent/scripts/setup_open_webui.sh)
EOF

---

api_key = (Path.home() / .hermes / .env).read_text()  # was: '.hermes' / '.env'

---

API_KEY=$(grep "^API_SERVER_KEY=" "$HOME/.hermes/.env" | cut -d= -f2-)
RAW_BUFFERClick to expand / collapse

Summary

scripts/setup_open_webui.sh write_launcher() writes a launcher script that contains an inline Python heredoc to extract API_SERVER_KEY from ~/.hermes/.env. When setup_open_webui.sh is itself invoked through bash heredoc layers (nested SSH sessions, automation wrappers, remote dispatch scripts), bash interpolates inside the non-quoted EOF and strips Python's literal single quotes from constructs like Path.home() / '.hermes' / '.env'. The emitted launcher then fails at runtime with SyntaxError: invalid syntax.

Reproduction

Invoke the setup script via a non-quoted bash heredoc, for example:

ssh studio2 'bash -s' <<EOF
$(cat ~/.hermes/hermes-agent/scripts/setup_open_webui.sh)
EOF

The resulting launcher script written under ~/.hermes/bin/ (or wherever write_launcher() targets) loses its inner Python single quotes, e.g.:

api_key = (Path.home() / .hermes / .env).read_text()  # was: '.hermes' / '.env'

Running the launcher: SyntaxError: invalid syntax.

Workaround (applied 2026-05-31 on Studio 2)

Replace the inline Python API_KEY extraction with a pure-bash one — no nested heredoc, no quote-stripping risk:

API_KEY=$(grep "^API_SERVER_KEY=" "$HOME/.hermes/.env" | cut -d= -f2-)

Suggested fix

Replace the inline Python API_KEY extraction in write_launcher() with the pure-bash grep+cut variant above. Eliminates the nested-heredoc quoting fragility entirely.

Affected file

scripts/setup_open_webui.shwrite_launcher() (around lines 175-180 per live grep on v0.15.2)

Environment

  • Hermes Agent: v0.15.2
  • Trigger: any nested-heredoc invocation path (SSH heredoc, remote dispatch wrapper, etc.)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix setup_open_webui.sh nested-heredoc strips single quotes in embedded Python launcher template