Skip to content

pi-durable: gen_ai.conversation.id changes after a restart #25773

Closed

Description

@andreiborza

The pi-durable integration reports gen_ai.conversation.id as <harnessId>:<conversationId>. harnessId is a random uuid that the SDK makes each time Harness.open() runs (packages/server-utils/src/ai/pi-durable/runs.ts). It stays in memory only. When a process restarts, or a Durable Object restarts after an eviction or a deploy, the Harness opens again on the same storage and gets a new uuid. Each run after the restart then shows as a new conversation in Sentry.

This affects all server SDKs that use persistent pi-durable storage (SQLite, JSONL). It occurs most on Cloudflare, because Durable Objects are often evicted. Also, two processes that use the same storage report different ids for the same conversation.

We cannot remove the prefix. pi-durable numbers conversations from 1 in each storage, so the bare numbers from different storages would merge into one conversation. pi-durable has no stable storage id that the SDK can use.

Reproduction: https://github.com/andreiborza/cf-pi-durable-objects. Two prompts give the same id. A third prompt, after a restart with ctx.abort(), gives a different id.

Activity

  1. linear-code commented on Oct 27, 2026

    @linear-code
  2. andreiborza commented on Oct 27, 2026

    @andreiborza
    MemberAuthor

    pi-durable already has a stable id for this. Since 1.0.2, it keeps a UUIDv7 per conversation in the pi.provider document (earendil-works/pi#10424). It stays the same after a reopen, it is unique across storages, and pi-durable sends it to pi-ai as sessionId.

    The fix is to report this id as gen_ai.conversation.id, and to keep <harnessId>:<conversationId> only as the fallback for versions without the document.

  3. github-actions commented on Oct 28, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #25792, which was included in the 11.10.0 release.

  4. added a commit that references this issue on Oct 29, 2026
    73eb37d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions