Redis session history streams never expire

Open
#364 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
redis, typescript
Domain
backend

Research direction

Start with RedisSessionStore.addMessage and the session touch logic to trace how the history stream and session hash are written; then inspect src/index.ts for cleanup scheduling. Reproduce with sessionTtlMs: 500 and check the session key and history stream TTL after buffering a message. Done means the stream gets the session TTL on touch and an expired session is not recreated without its id.

Written by the indexing model from the issue text.

Description

RedisSessionStore.addMessage XADDs to session:<id>:history but never sets an expiry on it, and the plugin schedules cleanup() only for MemorySessionStore (src/index.ts). Once the session hash expires its history stream (up to 100 messages) stays in Redis forever, including after app.close(). If the hash has already expired, addMessage also re-creates a hash without id.

Repro: sessionTtlMs: 500, buffer one message, wait: the session key is gone, session:<id>:history exists with PTTL -1.

The history stream should get the same TTL as the session (refreshed on touch), and addMessage should not resurrect an expired session.

🤖 Generated with Claude Code

Dominant language
TypeScript
Stars
63
Forks
16
Avg merge
1d 15h
Merged PRs (30d)
56

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from platformatic/mcp

All issues in platformatic/mcp

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.