fix: handle None updated_at in DefaultSessionStore.list_sessions() (fixes #1445)#1446
Conversation
- Fix TypeError when sessions have updated_at=None by using 'or' operator - Add regression test for None updated_at values in session store - Ensures sessions with None updated_at sort last (as intended) Fixes #1445
There was a problem hiding this comment.
praisonai-triage-agent[bot] has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
@coderabbitai review |
|
/review |
β Actions performedReview triggered.
|
|
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)
π WalkthroughWalkthroughA single-line bug fix in Changes
Estimated code review effortπ― 2 (Simple) | β±οΈ ~10 minutes Poem
π₯ Pre-merge checks | β 4 | β 1β Failed checks (1 inconclusive)
β Passed checks (4 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ Generate docstrings
π§ͺ 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 |
|
@copilot Do a thorough review of this PR. Read ALL existing reviewer comments above from Qodo, Coderabbit, and Gemini first β incorporate their findings. Review areas:
|
Reviewed at commit Findings:
sessions.sort(
key=lambda x: (x.get("updated_at") or "", x.get("session_id") or ""),
reverse=True,
)Also checked branch CI metadata: many workflow runs report |
|
@claude You are the FINAL architecture reviewer. If the branch is under MervinPraison/PraisonAI (not a fork), you are able to make modifications to this branch and push directly. SCOPE: Focus ONLY on Python packages (praisonaiagents, praisonai). Do NOT modify praisonai-rust or praisonai-ts. Read ALL comments above from Gemini, Qodo, CodeRabbit, and Copilot carefully before responding. Phase 1: Review per AGENTS.md
Phase 2: FIX Valid Issues Phase 3: Final Verdict |
|
Claude finished @MervinPraison's task ββ View job Architecture Review Complete βPhase 1: Architecture Review per AGENTS.md
Phase 2: Address Reviewer Feedback
Phase 3: Final Verdict
Architecture Compliance βThe fix adheres to AGENTS.md principles:
Reviewer Analysis βValid Issues Found:
Verification Results:
Final Verdict: APPROVED βThis PR successfully addresses issue #1445 with:
Recommendation: This PR is ready to merge. The fix is minimal, well-tested, and architecturally sound. |
Fixes the bug where DefaultSessionStore.list_sessions() crashes with a TypeError when any session has updated_at=None.
Changes Made
Fixed the sorting logic in praisonaiagents/session/store.py:493:
Added regression test to ensure None values are handled properly:
Root Cause
dict.get(key, default) only uses default when the key is missing, not when the stored value is None. Any session whose metadata contains "updated_at": None broke the sort comparison between NoneType and str.
Testing
Fixes #1445
Generated with Claude Code
Summary by CodeRabbit