fix(agent-runtime): support thread metadata#446
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds optional metadata support to ChangesThread metadata support
Sequence DiagramsequenceDiagram
participant Client
participant AgentRuntime
participant AgentStore
participant Thread
Client->>AgentRuntime: createThread(options: {metadata: {...}})
AgentRuntime->>AgentStore: createThread({metadata: {...}})
AgentStore->>Thread: create with metadata
Thread-->>AgentStore: thread record
AgentStore-->>AgentRuntime: thread
AgentRuntime-->>Client: thread
Client->>AgentRuntime: syncRun({threadId, metadata: {...}})
AgentRuntime->>AgentStore: ensureThread(threadId)
AgentStore-->>AgentRuntime: existing thread (metadata unchanged)
AgentRuntime->>AgentStore: createRun({threadId, metadata: {...}})
AgentStore-->>AgentRuntime: run
AgentRuntime-->>Client: run result
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to provide metadata when creating a thread by updating the createThread method to accept CreateThreadOptions. It also ensures that metadata associated with a run is not incorrectly copied to auto-created threads, maintaining a clear separation between run and thread records. Comprehensive tests were added to verify metadata persistence and isolation across different run types. I have no feedback to provide.
Summary
Upstream reference: eggjs/egg#5949
Test
Summary by CodeRabbit
New Features
Tests