Skip to content

Add targeted user cache patch on miss#269

Open
gkatz2 wants to merge 1 commit intokorotovsky:masterfrom
gkatz2:feature/targeted-user-cache-patch
Open

Add targeted user cache patch on miss#269
gkatz2 wants to merge 1 commit intokorotovsky:masterfrom
gkatz2:feature/targeted-user-cache-patch

Conversation

@gkatz2
Copy link
Copy Markdown

@gkatz2 gkatz2 commented Apr 3, 2026

Summary

  • When a user ID isn't in the in-memory cache, fetch it via users.info (O(1) API call) and patch the snapshot atomically, instead of showing raw IDs or failing the tool call
  • Wire recovery into paramFormatUser (search filters), convertMessagesFromHistory, and convertMessagesFromSearch (message rendering)
  • Introduce a userResolver that encapsulates cache lookup, on-demand fetch, and failed-lookup dedup for message batches
  • On Enterprise Grid (~50K users), this avoids a full cache rebuild (minutes of API calls) for a single missing entry

Fixes #268

Test plan

  • Unit tests for PatchUser (success, API error, empty/nil result, snapshot immutability, overwrite)
  • go build ./... passes
  • make test passes (all existing + new tests)
  • Manual test: run MCP server, query messages from a user not in cache, verify name resolves
  • Upstream CI

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

When a user ID is not in the in-memory cache, message rendering
degrades to raw IDs and paramFormatUser fails the tool call
entirely. This is common on Enterprise Grid workspaces where the
user cache (50K+ users) can be hours stale.

On cache miss, fetch the single user via users.info and patch the
snapshot atomically. This costs one API call instead of rebuilding
the entire user cache. Disk persistence is skipped; the next full
refresh cycle handles it.

Fixes korotovsky#268

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User cache miss returns raw IDs instead of resolving via users.info

1 participant