feat(cloudflare): Rotate agent conversation id on chat clear - #22720
Merged
JPeer264 merged 2 commits intoJul 28, 2026
Merged
Conversation
Contributor
size-limit report 📦
|
JPeer264
force-pushed
the
jp/cloudflare-instrument-reset-conv-id
branch
from
July 27, 2026 19:38
c842206 to
04a692d
Compare
JPeer264
force-pushed
the
jp/cloudflare-instrument-reset-conv-id
branch
2 times, most recently
from
July 28, 2026 06:15
f7d5470 to
7fb8e0d
Compare
JPeer264
marked this pull request as ready for review
July 28, 2026 06:16
JPeer264
requested review from
andreiborza and
isaacs
and removed request for
a team
July 28, 2026 06:16
JPeer264
force-pushed
the
jp/cloudflare-instrument-reset-conv-id
branch
from
July 28, 2026 07:29
7fb8e0d to
9b6f0c3
Compare
Lms24
approved these changes
Jul 28, 2026
JPeer264
force-pushed
the
jp/cloudflare-instrument-reset-conv-id
branch
from
July 28, 2026 13:35
2e1b802 to
ddb3946
Compare
Clearing an agent's chat should start a fresh conversation in Sentry's AI monitoring, but recreating the Durable Object for that would drop the per-instance MCP/OAuth state (GitHub/Sentry sign-in). Instead, watch the WebSocket stream for cf_agent_chat_clear and rotate an in-memory conversation id on the instance, falling back to the instance name before the first clear — a fresh conversation id per reset while the instance (and its auth) stays put. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JPeer264
force-pushed
the
jp/cloudflare-instrument-reset-conv-id
branch
from
July 28, 2026 14:05
ddb3946 to
e9cb8bc
Compare
JPeer264
added a commit
that referenced
this pull request
Jul 28, 2026
JPeer264
added a commit
that referenced
this pull request
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Within
agentsorworkers-aithere is no concept of conversation IDs. In the main PR it was kept simple and only thenamewas taken in order to retrieve the conversation ID. When usingconst { clearHistory } = useAgent()from the frontend, then the eventmessage:clearis being called as an event (https://developers.cloudflare.com/agents/runtime/operations/observability/#message-tool-and-submission-events).This shows 3 transcripts all cleared with
clearHistory: https://sentry-sdks.sentry.io/explore/traces/trace/0666c413e4104032a349056ed8c51f8a/?tab=ai-spans