Skip to content

feat(prompt): answer Hermes's clarify questions from the chat - #750

Closed
DarkoKuzmanovic wants to merge 1 commit into
devswha:mainfrom
DarkoKuzmanovic:feat/hermes-clarify-card
Closed

DarkoKuzmanovic wants to merge 1 commit into
devswha:mainfrom
DarkoKuzmanovic:feat/hermes-clarify-card

Conversation

@DarkoKuzmanovic

Copy link
Copy Markdown
Contributor

Change

A Hermes pane asking a clarify question showed no answer card: readKnownPrompt did not know the agent, so the phone had to fall back to the terminal.

This adds parseHermesClarify in server/prompt.ts, read from the dialog Hermes's Ink TUI draws (ui-tui/src/components/prompts.tsx):

  • a question with choices: one option per row, (Recommended) dropped from the label, and Hermes's own "Other (type your answer)" row as the custom answer. Answered with ↓ and Enter, like the other menus.
  • an open question (or a batch's open question, N/M answered as the card body): a typed answer, then Enter.
  • a multi-select question ([ ] rows): a multi-select card. The rows to change are ticked with Space, then Enter locks them (Enter on the Other row would open its text line instead, so the cursor is moved off it first). Typed text is not offered there: Hermes adds it to the ticks, which the card has no way to show.

The hint line is matched on its start (N/M answered · ), because a narrow pane wraps its end, and accepted within the last few lines, because Hermes keeps its status bar under the dialog. An answered dialog leaves the screen, so a stale card does not stay.

Nothing else changes: no endpoint, frame or UI text.

This complements #604 and #680, which read a Hermes pane's conversation: it shares no code with them (only server/prompt.ts and its tests, plus a changelog line), and the card works with or without either.

Validation

  • bun run check fast: passes (on the parent commit before the 0.4.6 release; after rebasing onto it, typecheck and the prompt and release-notes tests pass again).
  • server/hermes-prompt.test.ts: captured screens for a choice, an open question in a batch, an answered dialog (no card) and a multi-select question, with their answerKeys.
  • server/prompt.test.ts: two rows in "moves to a row that is not the cursor's and answers it" for Hermes, a non-default choice and two ticks, each on a redrawn screen.
  • By hand on herdr 0.9.3 with Hermes in a pane: GET /api/pane/prompt returned the card, and POST /api/pane/prompt/answer with the second option made Hermes answer "Blue"; the same answer sent again got 409 prompt_changed. A multi-select question answered with Blue and Green reached Hermes as "Blue, Green".

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 93b5c693-182c-46a8-8d76-30e4de028dd1

📥 Commits

Reviewing files that changed from the base of the PR and between 7e12a89 and fa81998.


📒 Files selected for processing (4)
  • CHANGELOG.md
  • server/hermes-prompt.test.ts
  • server/prompt.test.ts
  • server/prompt.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Summary

Summary by CodeRabbit

  • New Features
    • Added support for answering Hermes clarification questions directly from their cards, including single-choice, multiple-choice, and custom-text answers.
    • For multi-question batches, the active question is presented for answering, and completed question cards are removed. Multiple-choice answers can be toggled before submission.

Walkthrough

The prompt reader now recognizes Hermes clarification screens and creates answer steps for choice menus, custom-text answers, and open questions. Tests cover parsing, answered-question handling, and single- and multi-select answer routes.

Changes

Hermes Clarification Prompts

Layer / File(s) Summary
Parse clarification screens
server/prompt.ts, server/hermes-prompt.test.ts, CHANGELOG.md
The parser recognizes Hermes clarification screens and handles choice menus, custom-text answers, open questions, and answered questions. Tests cover parsed prompt data and answer steps. The changelog describes these interactions.
Wire Hermes into prompt routing
server/prompt.ts, server/prompt.test.ts
The prompt reader supports Hermes and exports currentPrompt. Shared answer-route tests cover Hermes single- and multi-select choices.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: devswha


Merge Risk | ⚪ Minimal · up to fa819

Merge Risk: ⚪ Minimal · up to fa819

The reviewed Hermes clarification flow is ready to merge after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to fa819

This adds another way to answer questions without increasing access permissions. No security defect was established, but interrupted answers and recognition of old terminal content remain incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Each answer directs text or keys to the requested pane through existing terminal RPCs. If screen ownership were misidentified, the affected program would consume those inputs with its existing authority; no additional privilege is granted by this change. Broader consequences depend on that program and its available credentials, which were not assessed.

Trust Boundaries and Controls

  • observed — Terminal content remains a recognition input rather than authenticated dialog state. The existing request access gate, mutation-origin check, and watch-role restrictions precede prompt routing. The answer handler additionally checks pane existence, asking identity, answer shape, and asking lifecycle before terminal delivery.

Resilience and Maintainability Implications

  • observed — Terminal delivery is not an all-or-nothing transaction. A possibly delivered non-movement step causes the old asking to end even if later delivery fails, preventing reuse of its card. Subsequent reads can create a fresh asking from the remaining dialog. This supports recovery but does not roll back partial checkbox changes or text entry; independent terminal interaction can also interleave with the sequence.

Hardening Proposals

  • proposed — Validate completed-dialog rendering against Hermes itself. If arbitrary trailing content can remain under an old question, constrain the accepted suffix to recognized status or wrapped-hint content rather than relying only on a four-line window.
  • proposed — Exercise failures after opening custom input and after individual checkbox toggles, including a fresh-card recovery attempt and concurrent terminal edits. These checks would establish the intended recovery and selection-ownership semantics without assuming transactional terminal delivery.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: enabling chat-based answers for Hermes clarify questions.
Description check Passed The description includes the required Change and Validation sections. It explains the resulting behavior, implementation scope, test coverage, and manual validation results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Thank you for the Hermes clarify card, @DarkoKuzmanovic! It has been carried into #764 (#764), which touches the same file (server/prompt.ts). Your commit is cherry-picked with you as its author, and the changelog entry links this PR and credits you.

One review change was added on top of it (53ae368). Text already on the dialog's > line (typed in the terminal, or a typed answer that Tab brought back) would have joined the answer sent from the chat. So the line is now emptied first with ctrl+k and ctrl+u, which Hermes's TextInput takes on every platform (ui-tui/src/lib/platform.ts), as pi's dialog does. The unused currentPrompt export was also dropped. The keys stay arrows, Space and Enter, never digits. I'm leaving this PR open so the maintainer can close it when #764 lands.

devswha added a commit that referenced this pull request Oct 11, 2026
…swer Hermes, end shut-down teammates (#764)

## Change

Fixes four things reported against 0.4.6, all in the prompt reader and
the Claude background-task reader.

- **Claude multiple choice with ticked rows (#752).** Claude Code
2.1.296 draws a ticked row as `[✔]`; the reader only took `[✓]`, so once
a row was ticked the card became a single choice, its labels kept the
box, and a pick sent Enter on a multi-select row, which unticks it.
`[✔]` is now a tick. With the cursor on the unnumbered **Submit** row
the card no longer disappears: the moves count Submit as a row between
"Type something" and "Chat about this", so ↑/↓ + Enter + → still land
where they should.
- **`/model` guard (#542).** `claudeModelListWaits()` read the hint over
six lines joined with spaces, so a hint cut inside a word (`ses` /
`sion`) or wrapped over seven lines was missed and pending delivery
could type Enter into the list. The hint is now read with spaces taken
out over up to sixteen lines, and the run of lines that holds it must
begin with it, so the same words quoted in Claude's output (`⏺ Example:
Enter to set as default …`) no longer hold pending sends.
`parseClaudeModel` and `promptTailIsActive` read the hint the same way,
so the card and the guard agree.
- **Agent-team teammates that shut down (carried from #744 by
@Haeminway1).** A teammate that approved its lead's shutdown request is
read as completed at that answer, so the pane's running count stops
counting it. Cherry-picked with its author kept.
- **Hermes clarify questions (carried from #750 by @DarkoKuzmanovic).**
Hermes's clarify dialog gets an answer card: arrows + Enter for a
choice, Space ticks + Enter for a multiple choice, typed text for
"Other" and open questions. No digits are sent, per server/AGENTS.md.
Cherry-picked with its author kept, plus one review fix (53ae368): text
already on the dialog's `>` line (typed in the terminal, or a typed
answer Tab brought back) used to join the chat's answer, so the line is
emptied first with ctrl+k / ctrl+u, which Hermes's TextInput takes on
every platform (`ui-tui/src/lib/platform.ts`). An unused `currentPrompt`
export is dropped.

Fixes #752
Fixes #542
Carries #744 and #750

Not changed: #542's gap 4 (a line under the hint that is not Claude's
footer). The issue says no real layout is known to draw one, so it is
left for a maintainer decision.

## Verification

- Before the fix (53ae368), the six new tests failed as the issues
describe: the three `Claude's multiple choice ticked in the terminal`
tests (no card, single choice, Submit move missing) and the three
`Claude Code's model list under a hint wrapped anywhere` tests (split
word, seven lines, quoted hint). They pass after 999099b.
- `HERDR_TEST_MODE=unit bun test ./server/prompt.test.ts
./server/hermes-prompt.test.ts ./server/claude-subagents.test.ts`: 311
pass, 0 fail.
- `bun run typecheck`: passes.
- `CHECK_MAX_RUNS=8 bun run check full` on ba61fd4 (after merging
origin/main 5792d71): workflow syntax, generated types, typecheck,
build, unit tests and the integration and browser lanes all `ok` (252
browser PASS, 0 FAIL).

Origin/main was merged in, not rebased (5792d71, #755); the only
conflict was CHANGELOG.md.

---------

Co-authored-by: Haeminway1 <130830910+Haeminway1@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Darko Kuzmanovic <darko.kuzmanovic@gmail.com>
@devswha

devswha commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Thank you, @DarkoKuzmanovic! Your change landed on main through #764, with you kept as the commit author and credited in the changelog. Closing this one as superseded by #764.

@devswha devswha closed this Oct 11, 2026
DarkoKuzmanovic added a commit to DarkoKuzmanovic/herdr-web-ui that referenced this pull request Oct 12, 2026
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