Skip to content

[codex] fix state-pg setIfNotExists TTL expiry#636

Draft
Zygimantass wants to merge 1 commit into
vercel:mainfrom
Zygimantass:codex/state-pg-set-if-not-exists-ttl
Draft

[codex] fix state-pg setIfNotExists TTL expiry#636
Zygimantass wants to merge 1 commit into
vercel:mainfrom
Zygimantass:codex/state-pg-set-if-not-exists-ttl

Conversation

@Zygimantass

Copy link
Copy Markdown

Summary

Fixes the Postgres state adapter so setIfNotExists() can claim a cache key whose existing row has expired.

Previously the method used ON CONFLICT DO NOTHING, so an expired row in chat_state_cache still blocked acquisition until a separate cleanup deleted it. That diverged from the memory adapter behavior and from the expected lease semantics for cache-backed coordination.

The new query keeps active rows protected, but replaces rows whose expires_at is in the past.

Validation

  • pnpm --filter @chat-adapter/state-pg test
  • pnpm --filter @chat-adapter/state-pg typecheck
  • pnpm exec ultracite check packages/state-pg/src/index.ts packages/state-pg/src/index.test.ts

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@Zygimantass is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant