openclaw - ✅(Solved) Fix [Bug]: iMessage dmHistoryLimit injects blank messages — macOS writes outbound text to attributedBody, not text column [1 pull requests, 1 comments, 2 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#73172Fetched 2026-04-29 06:22:40
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Participants
Timeline (top)
referenced ×3commented ×1cross-referenced ×1

iMessage history injected via dmHistoryLimit is entirely blank for outbound (agent) messages. The gateway reads the text column from chat.db, but macOS writes outbound message content exclusively to the attributedBody column (NSAttributedString blob). This means agents start every new session with zero conversation context.

Root Cause

iMessage history injected via dmHistoryLimit is entirely blank for outbound (agent) messages. The gateway reads the text column from chat.db, but macOS writes outbound message content exclusively to the attributedBody column (NSAttributedString blob). This means agents start every new session with zero conversation context.

Fix Action

Workaround

Agent can manually query chat.db via exec to read attributedBody and decode the NSAttributedString blob, but this defeats the purpose of dmHistoryLimit.

PR fix notes

PR #73775: docs(imessage): drop dmHistoryLimit from supported list; field is a no-op (#73172)

Description (problem / solution / changelog)

Fixes #73172.

@steipete's deep review on the issue listed two acceptable paths; this is option 2 (docs-honest): remove iMessage from the documented dmHistoryLimit supported list and add a NOTE explaining the schema-vs-runtime mismatch. The schema field stays accepted for backward compat; runtime behavior unchanged.

What changed

  • `docs/gateway/config-channels.md:812` — drop `imessage` from the supported list
  • Added a NOTE block referencing #73172 for the runtime gap

11 LOC, docs-only. No code paths touched.

Why option 2 over option 1

Option 1 (implement a testable iMessage DM-history adapter) is macOS-specific and can't be dev-tested on Linux/CI. Option 2 closes the user-facing surprise without claiming a runtime contract we can't honor.

Test

  • `pnpm lint:docs` clean
  • Schema field still accepted (backward compat preserved)

🦞 lobster-biscuit


Sign-Off: hclsys

Changed files

  • CHANGELOG.md (modified, +2/-0)
  • docs/gateway/config-channels.md (modified, +10/-1)

Code Example

SELECT date(m.date/1000000000 + 978307200, 'unixepoch', 'localtime') as day,
  SUM(CASE WHEN m.text IS NOT NULL AND m.text != '' THEN 1 ELSE 0 END) as has_text,
  SUM(CASE WHEN (m.text IS NULL OR m.text = '') AND m.attributedBody IS NOT NULL THEN 1 ELSE 0 END) as only_attributed
FROM message m JOIN chat_message_join cmj ON m.ROWID=cmj.message_id
JOIN chat c ON cmj.chat_id=c.ROWID
WHERE m.is_from_me=1
GROUP BY day ORDER BY day DESC LIMIT 10;
RAW_BUFFERClick to expand / collapse

Summary

iMessage history injected via dmHistoryLimit is entirely blank for outbound (agent) messages. The gateway reads the text column from chat.db, but macOS writes outbound message content exclusively to the attributedBody column (NSAttributedString blob). This means agents start every new session with zero conversation context.

Steps to reproduce

  1. Configure channels.imessage.dmHistoryLimit: 100
  2. Exchange messages with an agent via iMessage
  3. Restart the gateway (or let compaction create a new session)
  4. Agent receives 100 "messages" of history but all outbound messages have null text content

Evidence

Query showing the text column is NULL for all outbound messages while attributedBody contains the actual content:

SELECT date(m.date/1000000000 + 978307200, 'unixepoch', 'localtime') as day,
  SUM(CASE WHEN m.text IS NOT NULL AND m.text != '' THEN 1 ELSE 0 END) as has_text,
  SUM(CASE WHEN (m.text IS NULL OR m.text = '') AND m.attributedBody IS NOT NULL THEN 1 ELSE 0 END) as only_attributed
FROM message m JOIN chat_message_join cmj ON m.ROWID=cmj.message_id
JOIN chat c ON cmj.chat_id=c.ROWID
WHERE m.is_from_me=1
GROUP BY day ORDER BY day DESC LIMIT 10;

Result: 0 messages have text, 100% are attributedBody only. This has been the case for all of April 2026.

The imsg history CLI command CAN decode attributedBody and displays the text correctly. But the gateway history injection path appears to read text directly from the database, bypassing imsg's decoding.

Expected behavior

History injection should use imsg rpc or imsg history to retrieve message text (which properly decodes attributedBody) rather than reading the text column directly from chat.db.

Actual behavior

Agents receive history entries with null/blank text for all outbound messages on new sessions. They have no conversation context and appear to have amnesia.

Environment

  • OpenClaw: 2026.4.22 (also reproduced on 2026.4.24)
  • imsg: 0.5.0 (Homebrew)
  • macOS: Sequoia 15.x (Apple Silicon)
  • Node: 24
  • Channel: imessage (imsg bridge, not BlueBubbles)

Workaround

Agent can manually query chat.db via exec to read attributedBody and decode the NSAttributedString blob, but this defeats the purpose of dmHistoryLimit.

extent analysis

TL;DR

Modify the gateway history injection path to use imsg rpc or imsg history to retrieve message text, which can properly decode attributedBody.

Guidance

  • Identify the code responsible for reading the text column from chat.db in the gateway history injection path.
  • Replace the direct database read with a call to imsg rpc or imsg history to retrieve the message text, ensuring proper decoding of attributedBody.
  • Verify that the imsg version (0.5.0) supports the required decoding functionality.
  • Test the modified history injection path to ensure it correctly populates the text content for outbound messages.

Example

No code snippet is provided as the issue does not contain sufficient code context.

Notes

The provided SQL query demonstrates the issue, but the actual fix requires modifying the gateway's history injection code to utilize imsg rpc or imsg history.

Recommendation

Apply workaround: Modify the gateway history injection path to use imsg rpc or imsg history, as this approach ensures proper decoding of attributedBody and provides the required conversation context.

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

History injection should use imsg rpc or imsg history to retrieve message text (which properly decodes attributedBody) rather than reading the text column directly from chat.db.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: iMessage dmHistoryLimit injects blank messages — macOS writes outbound text to attributedBody, not text column [1 pull requests, 1 comments, 2 participants]