Skip to content

Keep prompted Hermes sessions interactive - #8705

Open
spencerbull wants to merge 5 commits into
basecamp:hermes-agentfrom
spencerbull:hermes-prompted-tui
Open

Keep prompted Hermes sessions interactive#8705
spencerbull wants to merge 5 commits into
basecamp:hermes-agentfrom
spencerbull:hermes-prompted-tui

Conversation

@spencerbull

@spencerbull spencerbull commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Prompted Hermes launches currently use --oneshot, so Hermes exits after answering and omarchy-launch-tui correctly closes the agent terminal with it. Passing an arbitrary prompt through Hermes's TUI startup query is not safe because TUI control syntax can be interpreted instead of remaining literal prompt data.

This change uses a two-stage handoff: seed Hermes with --oneshot="$prompt" plus a temporary --usage-file, require a completed non-failed report with a nonempty exact session ID, then resume that session with hermes chat --yolo --tui --resume "$session_id". It clears inherited HERMES_SESSION_SOURCE for both stages so Hermes records the local CLI source and actual launch cwd/workspace, retries once after first-run provider setup, and removes the temporary usage file on every exit path.

The installer now accepts any Hermes version exposing the required --usage-file capability, preserves unsupported foreign installations instead of taking ownership, and leaves the unprompted route as hermes --yolo.

Exact SHA 64203cc2085717d29b7a13257bad1b48a2434cbf passed 57 focused shell assertions and a credential-free disposable Omabot/Proxmox validation against real Hermes Agent 0.19.0. The runtime validation preserved a multiline option-shaped/control-syntax prompt literally, resumed the exact reported session, persisted source=cli plus the correct cwd/workspace, cleaned temporary files on success and failure, preserved a foreign Hermes installation, and kept the unprompted argv unchanged. Residual runtime gaps are rendered-TUI automation and a successful real first-run setup replay; both control paths have focused mock coverage.

This pull request is stacked on #7469's hermes-agent branch. No standalone issue is closed.

🤖 Generated by GPT-5.6 in Codex. Reviewed and runtime-validated by Codex XHigh.

Hermes oneshot deliberately exits after answering, which closes the agent terminal. Seed the TUI chat session instead, keep inherited flags after the subcommand for older Hermes parsers, and bind the query as one argument so dash-prefixed prompts remain data.

Co-Authored-By: Codex XHigh <noreply@openai.com>
Copilot AI balanced review requested due to automatic review settings August 28, 2026 02:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Keeps prompted Hermes sessions interactive by launching its TUI with a seeded query instead of one-shot mode.

Changes:

  • Uses hermes chat --yolo --tui --query=... for prompted launches.
  • Adds coverage for prompted and unprompted Hermes launches.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
bin/omarchy-agent Keeps seeded Hermes sessions interactive.
test/shell.d/default-agent-test.sh Verifies both Hermes launch modes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

spencerbull and others added 4 commits August 27, 2026 22:37
Hermes TUI startup queries execute slash, shell, interpolation, and multiline syntax before reaching the model. Run the prompt through literal one-shot mode, read its exact session ID from a private usage report, and resume that session in the TUI so arbitrary prompt text stays data while the conversation remains interactive.

Co-Authored-By: Codex XHigh <noreply@openai.com>
Keep the one-shot session on Hermes' native CLI source so it records the launch directory before the exact session is resumed in the TUI.

Co-Authored-By: Codex XHigh <noreply@openai.com>
Bind option-looking prompts to one-shot mode, require a successful completed usage report before resuming, replay the prompt after first-run setup, and reject Hermes runtimes that lack the session-report capability.

Co-Authored-By: Codex XHigh <noreply@openai.com>
Clear inherited session-source tags for Omarchy's local one-shot process so Hermes records the launch directory before the exact session is resumed in the TUI.

Co-Authored-By: Codex XHigh <noreply@openai.com>
teknium1 added a commit to NousResearch/hermes-agent that referenced this pull request Aug 28, 2026
…t literally

On a real TTY, `hermes chat -q "…"` (and `--tui -q`) now starts a normal
interactive session with the prompt submitted literally as the first turn —
no slash-command routing, no '!' shell dispatch, no $(...) interpolation,
no file-drop rewriting — matching how other coding agents handle seeded
launches (Omarchy prompted agent terminals, basecamp/omarchy#8705).

Legacy answer-and-exit is preserved everywhere automation depends on it:
- new `hermes chat --oneshot` flag (distinct dest from top-level -z)
- -Q/--quiet machine-readable contract
- any non-TTY stdio (kanban workers, cron, pipes, A2A)
- top-level `hermes -z` unchanged

CLI: seeded prompt rides a _SeededQueryMessage sentinel through
process_loop, which skips the slash/!/file-drop dispatchers for that one
message. TUI: STARTUP_QUERY submits via a new literal path (submitLiteral)
that bypasses dispatchSubmission and the input.detect_drop rewrite.
teknium1 added a commit to NousResearch/hermes-agent that referenced this pull request Aug 28, 2026
…t literally

On a real TTY, `hermes chat -q "…"` (and `--tui -q`) now starts a normal
interactive session with the prompt submitted literally as the first turn —
no slash-command routing, no '!' shell dispatch, no $(...) interpolation,
no file-drop rewriting — matching how other coding agents handle seeded
launches (Omarchy prompted agent terminals, basecamp/omarchy#8705).

Legacy answer-and-exit is preserved everywhere automation depends on it:
- new `hermes chat --oneshot` flag (distinct dest from top-level -z)
- -Q/--quiet machine-readable contract
- any non-TTY stdio (kanban workers, cron, pipes, A2A)
- top-level `hermes -z` unchanged

CLI: seeded prompt rides a _SeededQueryMessage sentinel through
process_loop, which skips the slash/!/file-drop dispatchers for that one
message. TUI: STARTUP_QUERY submits via a new literal path (submitLiteral)
that bypasses dispatchSubmission and the input.detect_drop rewrite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants