Repository navigation
fix(core): keep Trajectory event seqs unique across page loads - #7589
Conversation
…PE-506) Each Core instance started its Trajectory seq counter at 0. The Gateway stores a seq once per Trajectory and acknowledges a repeat as accepted, so a page reload, second tab, or remount that reused the Trajectory id silently lost its events as duplicates. Start the counter at the Core instance's creation time in microseconds and keep incrementing it per event. The value stays a safe integer, within the Gateway's seq range, until about 2255; past that, the existing SEQUENCE_EXHAUSTED path drops the event.
…ly (refs PE-506) A Date.now that returns a fraction no longer makes every seq unsafe. The README now states when a reused Trajectory ID can still collide instead of reducing it to one millisecond.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: CopilotKit/CopilotKit/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Production Digest-Pinning AuditAll 42 services digest-pinned. Run 2026-10-02 07:23:46 PDT — 0 finding(s). |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
|
Size Change: +40 B (0%) Total Size: 1.76 MB 📦 View Changed
ℹ️ View Unchanged
|
058fdb7
into
alem/pe-471-pair-on-browser-interaction-capture-experiments
What does this PR do?
Stacked on #7556. Keeps Trajectory event seqs unique across page loads, so reused Trajectory IDs no longer lose events silently.
TrajectoryConnectionstartedseqat 0 for every Core instance. The Gateway stores each seq once per Trajectory and acknowledges a repeat as accepted. When a reload, a second tab or a remount reused the same Trajectory ID, the new events reused seqs 0..n, were dropped as duplicates, and the SDK still saw a full acknowledgement.Math.floor(Date.now()) * 1000and increments by one per event. That stays a safe integer (and within the Gateway's@max_seq) until about 2255. The existingSEQUENCE_EXHAUSTEDguard still applies.seqno longer starts at 0 for connected capture; the standalone collector and custom sinks still start at 1.Not included: reporting duplicates. The Gateway reply (
accepted = fresh + duplicates,highestSeqincludes duplicates) can't tell them apart. Addingduplicatesto the reply intrajectory_channel.exwould let the SDK report them; that belongs in the Intelligence backend.Related PRs and Issues
Testing
pnpm nx run-many -t test,check-types --projects=@copilotkit/core,@copilotkit/react-core --skip-nx-cache: all passing.SEQUENCE_EXHAUSTED. Both fail on the base commit.bigint, and the read API'sposition(/^\d{1,16}$/) handle these values.Checklist