Skip to content

clarify and approval SSE events silently dropped — never shown to user #12

Description

@ndesai510

I used mimo to help debug this issue where Hermex would say its looking for a response, but I dont get any prompts and am unable to type in a response. Finally, I'd end up in a stuck thread and have to restart WebUi to fix it.

I didnt personally analyze the code, just asked Mimo to see what the issue might be.

Description
The SSE event parser (SseEventParser.kt) does not handle clarify or approval events from the WebUI server. These events are parsed as SseEvent.Unknown and silently ignored, meaning the user never sees clarification prompts (choices) or tool approval requests.
This renders the app unusable for any agent workflow that requires user input mid-turn — the agent sends a clarify prompt, the timeout expires, the agent defaults, and the user is never shown the question.

Steps to Reproduce
Connect Hermex to a Hermes WebUI server
Start a chat that triggers a clarify tool call (e.g., multi-step workflows like comic generation, skill execution with choices)
The agent sends a clarify SSE event with question + choices_offered
Nothing appears in the app — no prompt, no notification
After the clarify timeout (default 60s), the agent defaults and continues

Root Cause
In SseEventParser.kt, the parse() function only handles these event names:
token, reasoning, tool, tool_complete, done, stream_end, cancel, error
The clarify and approval events fall through to the else -> SseEvent.Unknown branch and are discarded.

What Already Exists
The app already has DTOs and REST endpoints for clarify/approval — just not the SSE parsing:
ClarificationDto.kt — PendingClarificationDto, ClarificationRespondRequest/Response
ApprovalDto.kt — PendingApprovalDto, ApprovalRespondRequest/Response
HermexApi.kt — clarifyPending(), clarifyRespond(), approvalPending(), approvalRespond()

Proposed Fix

  1. Add SSE event types in SseEvent.kt:
    data class Clarify(val payload: ClarifyEventPayload) : SseEvent
    data class Approval(val payload: ApprovalEventPayload) : SseEvent
  2. Add parser cases in SseEventParser.kt:
    "clarify" -> SseEvent.Clarify(decode(data))
    "approval" -> SseEvent.Approval(decode(data))
  3. Wire up UI in ChatViewModel.kt to:
    Show a clarification card (question + clickable choices)
    Show an approval card (command + approve/deny buttons)
    Call clarifyRespond() / approvalRespond() when the user taps a choice

WebUI SSE Contract (for reference)
The WebUI sends these events during a stream:
Event Payload Description
clarify {question, choices_offered, clarify_id, session_id} Agent needs user input
approval {command, description, approval_id, pattern_key} Agent needs command approval
Both have a server-side timeout — if the user doesn't respond, the agent defaults.

Environment
Hermex version: latest (main)
Android: 14+
WebUI: Hermes WebUI latest

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions