Skip to content

Investigate delayed message delivery (possible ctx_token race) #2

@Oaklight

Description

@Oaklight

Description

During testing via WeiLink MCP tools (Claude Code to WeChat), message delivery was occasionally delayed -- a reply would not appear on the user phone immediately, then suddenly pop up later.

Possible Cause

When multiple messages are exchanged rapidly, a ctx_token race condition may occur:

  1. Bot sends a reply using an older ctx_token
  2. User sends a new message concurrently, which updates the ctx_token on the server side
  3. The bot outgoing message arrives with a stale ctx_token

However, the message does eventually get delivered, suggesting the iLink server is tolerant of slightly stale tokens.

Current Behavior

  • Messages are eventually delivered (not lost)
  • Delay is intermittent and may also be caused by WeChat push notification latency
  • The issue only manifests in multi-turn rapid conversation scenarios

Steps to Reproduce

  1. Start MCP server: weilink mcp -t http -p 45678
  2. Use an MCP client to rapidly recv, send, recv, send
  3. Observe occasional delivery delays on the WeChat side

Priority

Low -- no data loss observed. Monitor for recurrence before investing in a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions