openclaw - ✅(Solved) Fix sessions_send schema encourages invalid sessionKey+label calls [1 pull requests, 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#63308Fetched 2026-04-09 07:55:27
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1referenced ×1

sessions_send rejects requests when both sessionKey and label are present, but the model-facing tool schema exposes them as separate optional fields with no mutual-exclusion guidance or normalization. In practice, models often populate both fields when they know both, which leads to avoidable runtime failures.

Error Message

Runtime error

Root Cause

That seems like the safest normalization because sessionKey is already the most specific target.

Fix Action

Fixed

PR fix notes

PR #63377: fix: Clarify sessions_send schema field guidance for sessionKey/label

Description (problem / solution / changelog)

Summary

  • Update sessions_send tool schema descriptions to clarify the mutual exclusion between sessionKey and label parameters
  • Prevents confusing errors when both parameters are provided simultaneously

Closes #63308

Changes

  • Added clear guidance in schema field descriptions explaining that sessionKey and label are mutually exclusive
  • Updated description text to indicate which parameter takes precedence

Testing

  • Verified schema descriptions are accurate
  • Confirmed tool behavior matches updated documentation

AI Disclosure: This fix was developed with AI assistance (Claude via islo.dev).


Built autonomously by islo.dev

Changed files

  • docs/concepts/session-tool.md (modified, +5/-0)
  • src/agents/tools/sessions-send-tool.ts (modified, +19/-3)

Code Example

Provide either sessionKey or label (not both).

---

{
  "sessionKey": "agent:example:discord:channel:123",
  "label": "Example Agent",
  "agentId": "example",
  "message": "test",
  "timeoutSeconds": 5
}

---

Provide either sessionKey or label (not both).

---

{
  "sessionKey": "agent:example:discord:channel:123",
  "message": "..."
}

---

{
  "label": "Example Agent",
  "agentId": "example",
  "message": "..."
}
RAW_BUFFERClick to expand / collapse

Bug: sessions_send schema encourages invalid calls by exposing sessionKey and label as independent optionals

Summary

sessions_send rejects requests when both sessionKey and label are present, but the model-facing tool schema exposes them as separate optional fields with no mutual-exclusion guidance or normalization. In practice, models often populate both fields when they know both, which leads to avoidable runtime failures.

Runtime error

Provide either sessionKey or label (not both).

Why this happens

The tool contract currently makes all of these look independently optional:

  • sessionKey
  • label
  • agentId

The description says the tool can send by session key or label, but the schema does not strongly indicate:

  • that sessionKey and label are mutually exclusive
  • that sessionKey should be preferred when known
  • that agentId is only useful with label-based resolution

As a result, a model may emit something like:

{
  "sessionKey": "agent:example:discord:channel:123",
  "label": "Example Agent",
  "agentId": "example",
  "message": "test",
  "timeoutSeconds": 5
}

That payload is semantically unambiguous to a human, but it fails at runtime.

Expected behavior

Either of these would be reasonable:

  1. Preferred: improve the schema/tool metadata so the model is guided to emit only one addressing mode.
  2. Also helpful: executor-side normalization so that if both are present, sessionKey wins and label is ignored.

Actual behavior

The tool fails hard with:

Provide either sessionKey or label (not both).

Impact

This makes cross-session messaging unnecessarily brittle, especially in cases where:

  • a prior discovery step returned both a session key and a human-readable label
  • the model tries to be helpful by filling in all known addressing fields
  • existing docs or local instructions are imperfect

Suggested fix

Option A — schema guidance

Add explicit field descriptions / guidance such as:

  • sessionKey: preferred when known; do not also provide label
  • label: use only when sessionKey is not available
  • agentId: optional helper for label resolution only

Option B — executor canonicalization

If both sessionKey and label are provided:

  • prefer sessionKey
  • ignore label
  • continue normally

That seems like the safest normalization because sessionKey is already the most specific target.

Bonus docs issue observed

Some local/user-written examples may incorrectly use invalid parameter names like agent= or target= for sessions_send. The core tool docs should probably show a canonical example block using only the actual supported fields:

{
  "sessionKey": "agent:example:discord:channel:123",
  "message": "..."
}

and

{
  "label": "Example Agent",
  "agentId": "example",
  "message": "..."
}

Environment

Observed on a current 2026.4.x OpenClaw install.

extent analysis

TL;DR

To fix the issue, update the schema to include explicit field descriptions guiding the model to emit only one addressing mode, or implement executor-side normalization to prefer sessionKey when both are present.

Guidance

  • Update the schema with explicit field descriptions, such as:
    • sessionKey: preferred when known; do not also provide label
    • label: use only when sessionKey is not available
    • agentId: optional helper for label resolution only
  • Implement executor-side normalization to prefer sessionKey when both are present, ignoring label in such cases
  • Review and update local/user-written examples to use only supported fields, such as sessionKey and label
  • Ensure core tool documentation provides canonical example blocks using actual supported fields

Example

// Preferred sessionKey usage
{
  "sessionKey": "agent:example:discord:channel:123",
  "message": "..."
}

// Alternative label usage
{
  "label": "Example Agent",
  "agentId": "example",
  "message": "..."
}

Notes

The suggested fix assumes that the executor has the capability to perform normalization. If this is not the case, updating the schema to provide explicit guidance may be the more feasible solution.

Recommendation

Apply workaround by implementing executor-side normalization to prefer sessionKey when both are present, as this seems to be the safest normalization approach given the existing tool behavior.

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…

FAQ

Expected behavior

Either of these would be reasonable:

  1. Preferred: improve the schema/tool metadata so the model is guided to emit only one addressing mode.
  2. Also helpful: executor-side normalization so that if both are present, sessionKey wins and label is ignored.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING