Repository navigation
Conversation
|
@mturac is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughFix import-jsonl so existing sessions are upserted using ChangesSession KV key fix for import-jsonl
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/functions/replay.ts (1)
394-409:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winHeal the malformed record by setting
existing.id.The key fix is correct — writing under
parsed.sessionIdmatches the read key on Line 394 and avoids the undefined-key serialization failure. However, the upserted record itself still hasidundefined when the stored session was malformed. Any later consumer that reads this session (e.g.mem::replay::sessions/mem::replay::load) and re-keys onsession.idwill hit the same class of bug. Assigning the id here repairs the underlying broken state rather than only the write key.🛠️ Proposed fix to heal the record
const existing = await kv.get<Session>(KV.sessions, parsed.sessionId); if (existing) { + existing.id = parsed.sessionId; existing.observationCount = (existing.observationCount || 0) + parsed.observations.length;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/functions/replay.ts` around lines 394 - 409, The upsert heals the store key but leaves a malformed Session without an id; before calling kv.set(KV.sessions, parsed.sessionId, existing) ensure the Session record has its id set to the storage key by assigning existing.id = parsed.sessionId when missing (check existing.id falsy), then proceed with updating observationCount, endedAt, status, tags, firstPrompt and persisting via kv.set so downstream consumers (e.g., mem::replay::sessions / mem::replay::load) won't reintroduce the undefined-id bug.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/functions/replay.ts`:
- Around line 394-409: The upsert heals the store key but leaves a malformed
Session without an id; before calling kv.set(KV.sessions, parsed.sessionId,
existing) ensure the Session record has its id set to the storage key by
assigning existing.id = parsed.sessionId when missing (check existing.id falsy),
then proceed with updating observationCount, endedAt, status, tags, firstPrompt
and persisting via kv.set so downstream consumers (e.g., mem::replay::sessions /
mem::replay::load) won't reintroduce the undefined-id bug.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e3c30072-8ff8-4492-a1ab-d66b0034b648
📒 Files selected for processing (2)
src/functions/replay.tstest/replay.test.ts
eac3ac8 to
f4d33ee
Compare
|
Thanks @mturac — same fix shipped in v0.9.25 (see PR #791 + release notes). #776 + this PR + my own diagnosis all converged on the same root cause; credit goes to whoever filed first. Closing because the issue is resolved on main. |
Summary
existing.idstate::setwith an undefined keyCloses #775
Tests
npm test -- test/replay.test.tsnpm run buildSummary by CodeRabbit
Bug Fixes
Tests