openclaw - 💡(How to fix) Fix [Bug] v2026.3.11: CLI agent --channel discord --to routes to agent:*:main instead of live session [1 participants]

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…
GitHub stats
openclaw/openclaw#44450Fetched 2026-04-08 00:46:52
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Root Cause

El resolver de sesiones en dist/gateway-cli-BjsM6fWb.js no busca por delivery context real (channel + to + accountId). Los targets Discord no se normalizan (diferencia entre 148... y channel:148...), causando fallback a agent:*:main.

RAW_BUFFERClick to expand / collapse

Bug Summary

En OpenClaw v2026.3.11, el CLI openclaw agent --channel discord --to ... resuelve incorrectamente la sesión agent:*:main en lugar de la sesión viva asociada al canal/thread Discord especificado.

Síntomas Observados

  • openclaw agent --channel discord --to ... parece entregar pero resuelve sesión equivocada
  • Los mensajes van a agent:*:main en vez de la sesión viva del target Discord
  • No hay forma de enrutar CLI a una sesión de canal/thread específico por delivery context

Root Cause

El resolver de sesiones en dist/gateway-cli-BjsM6fWb.js no busca por delivery context real (channel + to + accountId). Los targets Discord no se normalizan (diferencia entre 148... y channel:148...), causando fallback a agent:*:main.

Archivo Afectado (dist/ compilado)

  • dist/gateway-cli-BjsM6fWb.js - Session resolver sin lookup por delivery target real

Parche Manual Aplicado (Local)

Archivo: dist/gateway-cli-BjsM6fWb.js

  • Agregada resolución de sesión por target de delivery real (channel + to + accountId)
  • Normalización de targets Discord (148...channel:148...)
  • Lookup de sesión existente por delivery context antes de fallback a main

Validación Post-Parche

  • ✅ CLI puede enrutar por target Discord real
  • ✅ Los mensajes llegan a la sesión correcta del canal/thread
  • ✅ Ya no cae por defecto en agent:*:main

Riesgo de Regresión

ALTO: Este es un parche manual sobre archivos compilados en dist/. Se perderá en la próxima actualización/reinstalación de OpenClaw.

Issues Relacionados (Referencia)

  • #36401 - Feature request: Add --session-key option for precise routing
  • #41562 - Discord thread session delivery leaks to main session

Entorno

  • OpenClaw: v2026.3.11
  • CLI: openclaw agent --channel discord --to ...
  • Fecha del parche: Marzo 2026

extent analysis

Fix Plan

To resolve the issue, we need to update the session resolver in gateway-cli-BjsM6fWb.js to correctly resolve the session based on the delivery context (channel + to + accountId).

Step-by-Step Solution:

  1. Update the session resolver:
    • Modify the gateway-cli-BjsM6fWb.js file to include a lookup for the delivery target real (channel + to + accountId).
    • Normalize Discord targets (148...channel:148...).
  2. Implement delivery context lookup:
    • Before falling back to agent:*:main, perform a lookup for an existing session based on the delivery context.
  3. Example Code Snippet:

// Pseudo-code example for updating the session resolver function resolveSession(channel, to, accountId) { const deliveryContext = ${channel}:${to}:${accountId}; const normalizedTarget = channel:${to}; // Normalize Discord target

// Lookup existing session by delivery context const session = getSessionByDeliveryContext(deliveryContext); if (session) { return session; }

// Fallback to main session if no match found return 'agent:*:main'; }

// Helper function to get session by delivery context function getSessionByDeliveryContext(deliveryContext) { // Implement logic to retrieve session based on deliveryContext // This may involve database queries or cache lookups // For demonstration purposes, assume a simple sessions object const sessions = { 'channel:148...:accountId': 'session:148...:accountId', }; return sessions[deliveryContext]; }


### Verification
To verify the fix, run the `openclaw agent --channel discord --to ...` command and ensure that:
- The CLI correctly routes to the target Discord channel/thread.
- Messages arrive at the correct session for the specified channel/thread.
- The default fallback to `agent:*:main` no longer occurs.

### Extra Tips
- **Permanent Fix**: The manual patch applied to `dist/gateway-cli-BjsM6fWb.js` will be lost upon the next OpenClaw update or reinstallation. It's essential to integrate this fix into the source code to ensure persistence.
- **Feature Request**: Consider implementing the `--session-key` option for precise routing as suggested in issue #36401.
- **Regression Risk**: Monitor for any regressions related to session resolution and Discord thread session delivery, as highlighted in issue #41562.

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