Skip to content

fix(agent): emit assistant events for webchat message content#27

Closed
Nachx639 wants to merge 2 commits intoopenclaw:mainfrom
Nachx639:fix/webchat-agent-events
Closed

fix(agent): emit assistant events for webchat message content#27
Nachx639 wants to merge 2 commits intoopenclaw:mainfrom
Nachx639:fix/webchat-agent-events

Conversation

@Nachx639
Copy link
Contributor

Summary

  • Fix webchat receiving empty messages by passing onAgentEvent callback to runCommandReply in agentCommand

Problem

The webchat was showing "chat timed out" or empty responses because:

  1. agentCommand calls runCommandReply but didn't pass the onAgentEvent callback
  2. Without this callback, assistant text events (stream: "assistant") were never emitted
  3. The gateway accumulates assistant text in chatRunBuffers and includes it in the chat event with state: "final"
  4. Since no assistant events were emitted, the buffer was empty and message was undefined

Solution

Pass onAgentEvent to runCommandReply so that assistant stream events are properly emitted:

onAgentEvent: (evt) => {
  emitAgentEvent({
    runId: sessionId,
    stream: evt.stream,
    data: evt.data,
  });
},

Test plan

  • Send message via webchat → response now shows correctly
  • WhatsApp continues to work as before

🤖 Generated with Claude Code

contributor and others added 2 commits December 13, 2025 22:53
The webchat was receiving empty messages because agentCommand didn't pass
the onAgentEvent callback to runCommandReply. This caused assistant text
events to never be emitted, resulting in the gateway broadcasting chat
events with no message content.

This fix passes onAgentEvent to runCommandReply so that assistant stream
events are properly emitted and the webchat receives the actual response text.

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The webchat sends an idempotencyKey with chat.send requests and expects
events to arrive with that same runId. Previously, the gateway was using
the internal sessionId as runId, causing a mismatch that prevented the
webchat from correlating responses with pending requests.

Changes:
- chatRunSessions now stores {sessionKey, clientRunId} instead of just sessionKey
- Chat events use clientRunId so webchat can match them to pending promises
- Response payload includes the original clientRunId from idempotencyKey

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Nachx639 Nachx639 force-pushed the fix/webchat-agent-events branch from 520bd0a to ead932f Compare December 13, 2025 21:53
@steipete
Copy link
Contributor

Appreciate the fix! I went all choa-monkey on this while working on 2.0, so this was fixed without reviewing the PR in time.
Once the project stabilizes a bit I'll defo be better - thanks for the effort and testing!

@steipete steipete closed this Dec 14, 2025
dgarson referenced this pull request in dgarson/clawdbot Feb 2, 2026
feat(ui): add category filtering to command palette
alexprime1889-prog pushed a commit to alexprime1889-prog/moltbot that referenced this pull request Feb 8, 2026
centminmod added a commit to centminmod/clawdbot that referenced this pull request Feb 9, 2026
frodo-harborbot pushed a commit to harborworks/openclaw that referenced this pull request Feb 16, 2026
Navbar, admin panel, and CRUD for users/orgs/members/harbors
songliu0403-rgb pushed a commit to songliu0403-rgb/openclaw that referenced this pull request Feb 26, 2026
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
ddupg pushed a commit to ddupg/openclaw that referenced this pull request Feb 27, 2026
- 支持根据 bindings 配置将不同用户/群聊分发到不同 Agent
- 优化权限缺失时的错误提示,降低配置排障门槛
- 保留原有 accountId 默认值和流式卡片标题逻辑

Co-authored-by: wsbjj <94124135+wsbjj@users.noreply.github.com>
ddupg pushed a commit to ddupg/openclaw that referenced this pull request Feb 27, 2026
let5sne pushed a commit to let5sne/openclaw that referenced this pull request Mar 1, 2026
Memory files (MEMORY.md, memory/*.md) are the most trusted context
source for agents, yet had no injection detection. External content
(webhooks, emails) already uses detectSuspiciousPatterns() — this
extends the same protection to memory files.

Change: in manager-sync-ops.ts, call detectSuspiciousPatterns() on
file content before indexFile() for memory-source files. Logs a warn
with path + pattern count if suspicious content is found. Non-blocking.

Fixes improvement item openclaw#27 from openclaw-improvement-ideas.md.
benieralexis-sudo pushed a commit to benieralexis-sudo/openclaw that referenced this pull request Mar 6, 2026
- openclaw#6 Reply classifier hallucination pattern: regex plus specifique (exige prenom+nom)
- openclaw#7 Fuzzy match domaine: ajoute verification local part + nom similaire
- openclaw#9 callOpenAI duplique: delegue au shared-nlp (tracking budget)
- openclaw#22 Collision cron 14h: mini-cycles decales 10h/12h/15h/17h
- openclaw#24 Bounce rate dilue: remplace derniere entree success par bounce
- openclaw#26 API chat+HITL sans auth: verification x-api-token/authorization
- openclaw#27 Passwords dashboard: generes aleatoirement (24 chars)
- Bonus: commande "statut systeme" protegee admin-only

28/28 bugs de l'audit corriges. 0 restant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
elliot-ylambda pushed a commit to elliot-ylambda/magister-openclaw that referenced this pull request Mar 7, 2026
Release: OG image and social meta tags
ronan-dandelion-cult pushed a commit to karmaterminal/openclaw that referenced this pull request Mar 7, 2026
- Appendix: Integration Test Evidence section with Swim 7 scorecard
- Evidence locations table (silas-likes-to-watch PR openclaw#27, gateway logs, canary tag)
- Methodology note: 4-agent test topology, blind enrichment findings
- Key finding: silent enrichment indistinguishable from training knowledge
- Scrub verified: zero prince names/hostnames/IPs in main RFC body
- Changelog section (marked for removal) contains internal refs as expected
cael-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Mar 7, 2026
Structured scorecard: 10 pass, 2 deferred, 0 regressions.
Key evidence lines from raw gateway log.
Enrichment trust boundary findings.
Evidence archive links to karmaterminal/silas-likes-to-watch PR openclaw#27.
ronan-dandelion-cult pushed a commit to karmaterminal/openclaw that referenced this pull request Mar 7, 2026
- Gateway log excerpts for each Swim 7 test (tolerance, width, chain, enrichment)
- Each excerpt shows the guard/lifecycle event firing with timestamps
- Matches evidence in silas-likes-to-watch PR openclaw#27 raw logs
lucasmpramos added a commit to butley/openclaw that referenced this pull request Mar 9, 2026
…ron Filter

- README.md: 24→26 active patches, added entries for both
- verify-patches.sh: added checks (26/26 passing)
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.

3 participants