agent's intercom search returned stale conversation state: read-your-writes
A guide to fixing stale Intercom conversation state in agent search results, in the business-apis-integrations category: read-your-writes consistency, cache invalidation, and freshness checks. Use when agents act on outdated conversation data, search shows old state after updates, or when building agents on Intercom data. Not for Intercom search relevance, inbox UI, or conversation design.
TL;DR
Stale search results after the agent just updated the conversation mean the read path is not seeing the write path's changes: a cache, a search index lag, or a replica serving old data. Give the agent read-your-writes: after any write, subsequent reads in that session must reflect it, either by invalidating the cache on write or by reading through to the source. The agent should never be surprised by its own actions.
The query
agent's intercom search returned stale conversation stateUse this when
- Agents act on outdated conversation data
- Search shows old state after the agent updated it
- You are building agents on Intercom data
- Debugging state inconsistencies
Not for
- Improving Intercom search relevance
- Inbox UI behavior
- Designing conversation flows
- Webhook delivery
Steps
1. Confirm the staleness with a write-then-read test
Update a conversation, then immediately search for it and compare. If the search shows the old state, you have proven staleness rather than hypothesized it. The test also measures the lag duration.
Expected output: measured staleness window.
2. Invalidate caches on write
Every write the agent makes must invalidate the cached conversation state (and any search-result caches holding it). Write-through or write-invalidate: pick one and apply it uniformly. Stale caches are the most common cause.
Expected output: write-triggered cache invalidation.
3. Read through to the source after writes
For the conversation the agent just touched, read directly from the API rather than from cache or search for a freshness window. Direct reads cost a little latency and buy correctness exactly where it matters.
Expected output: read-through for recently written conversations.
4. Account for search index lag explicitly
Search indexes lag behind the source by design. Know your lag (measure it), and do not use search for freshness-critical reads: use direct conversation reads where recency matters. Search is for discovery; direct reads are for truth.
Expected output: documented index lag with read-path routing.
5. Version-stamp reads and detect conflicts
Attach a version or updated-at to cached state; if a read returns an older version than the agent last wrote, treat it as stale and re-read. Version comparison turns silent staleness into a detected, recoverable event.
Expected output: version-stamped state with staleness detection.
Template: the checklist
Read-your-writes:
[ ] Write-then-read staleness test done
[ ] Cache invalidated on every write
[ ] Read-through for recently written conversations
[ ] Index lag documented, reads routed accordingly
[ ] Version-stamped state with conflict detectionVariant phrasings
intercom search shows old conversation data
Steps 1 and 4. Measure, route around index lag.
agent acting on stale state
Steps 2 and 3. Invalidate, read through.
search results outdated after update
Steps 2 and 5. Invalidation plus version stamps.
Why it happens
Reads and writes take different paths: writes hit the primary API, reads hit caches and search indexes built for speed. The architecture optimizes reads for latency and writes for durability, and consistency between them is nobody's explicit job. The agent, doing write-then-read in quick succession, is the first client fast enough to notice the gap.
Edge cases
- Webhook-driven updates: another system's webhook can update the conversation between the agent's write and read. Version stamps catch this too.
- Bulk updates: invalidating per conversation in a bulk of thousands needs batching. Invalidate in bulk-aware ways.
- The lag that grows: index lag is not constant; it spikes under load. Monitor lag, do not assume the measured value.
- Eventual consistency as a feature: some staleness is by design. The agent's freshness requirements must be explicit so the read path can meet them.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_hNzntA2fgZe2eAglMPfIrw