Skip to content

docs: update session-hierarchy + session-persistence for PR #1781 (smart cache invalidation)#489

Open
MervinPraison wants to merge 1 commit into
mainfrom
claude/issue-485-20260602-1859
Open

docs: update session-hierarchy + session-persistence for PR #1781 (smart cache invalidation)#489
MervinPraison wants to merge 1 commit into
mainfrom
claude/issue-485-20260602-1859

Conversation

@MervinPraison
Copy link
Copy Markdown
Owner

Updates documentation for PR MervinPraison/PraisonAI#1781 which introduced smart cache invalidation and concurrency safety fixes to HierarchicalSessionStore.

Changes

docs/features/session-hierarchy.mdx

  • Restructured with agent-centric Quick Start using proper Agent memory pattern
  • Added hero Mermaid diagram with standard color scheme (#8B0000, #189AB4, #10B981)
  • Added comprehensive "Concurrency & Safety" section with operation safety table
  • Added "Smart cache invalidation" subsection explaining mtime-based cache validity model
  • Added sequence diagram showing UI set_title + worker add_message race scenario
  • Added copy-paste runnable example demonstrating concurrent write safety
  • Added performance characteristics Note callout about cache behavior
  • Used proper Mintlify components: Steps, AccordionGroup, CardGroup

docs/features/session-persistence.mdx

  • Extended "Multi-Process Safety" section with one-sentence mtime-cache explanation
  • Added reference to PR #1781 as specified in the requirements

Technical Content

Documents the key improvements from PR #1781:

  • File mtime-based cache validity checks (_is_cache_valid method)
  • Smart cache invalidation preventing stale reads during concurrent writes
  • Race condition fix where set_title could drop messages from external writes
  • Performance optimization: cache hits on unchanged files, automatic reload on external writes

Standards Compliance

  • Follows all AGENTS.md quality standards
  • Agent-centric examples with proper memory parameter usage
  • One-sentence section introductions
  • Standard Mermaid color scheme with white text
  • No forbidden phrases
  • Copy-paste runnable code examples
  • Progressive disclosure: simple first, advanced later

Fixes #485

Generated with Claude Code

…art cache invalidation + set_title concurrent-write safety)

- Restructure session-hierarchy.mdx with agent-centric Quick Start
- Add smart cache invalidation subsection with mtime-based cache validity explanation
- Add concurrent write scenario sequence diagram for UI set_title + worker race
- Add performance characteristics Note and operation safety table
- Update session-persistence.mdx Multi-Process Safety section with mtime-cache note
- Follow AGENTS.md standards: hero diagram, Steps/AccordionGroup/CardGroup components
- Include copy-paste runnable examples with proper imports
- Use standard color scheme (#8B0000, #189AB4, #10B981) with white text

Fixes #485

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Mervin Praison <MervinPraison@users.noreply.github.com>
@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Warning

Review limit reached

@MervinPraison, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 59 minutes and 23 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6e9bfcc8-bfe8-4f17-820b-8d0c831b7380

📥 Commits

Reviewing files that changed from the base of the PR and between aa7ace5 and fd420ed.

📒 Files selected for processing (2)
  • docs/features/session-hierarchy.mdx
  • docs/features/session-persistence.mdx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-485-20260602-1859

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly updates the documentation for "Session Hierarchy" and "Session Persistence", adding detailed guides, Mermaid diagrams, concurrency safety explanations, and best practices. The review feedback points out two issues in the "Best Practices" code snippets where the session variable is used without being defined, and where a potential AttributeError could occur if session.title is None.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +278 to +281
# Good: Fork before exploring alternatives
main_conversation_complete = len(session.messages) >= 10
if main_conversation_complete:
experimental_id = store.fork_session(session_id, title="Alternative Solution")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In this example, the session variable is used without being defined first. To make this code snippet correct and robust, you should retrieve the session object from the store using store.get_extended_session(session_id).

# Good: Fork before exploring alternatives
session = store.get_extended_session(session_id)
main_conversation_complete = len(session.messages) >= 10
if main_conversation_complete:
    experimental_id = store.fork_session(session_id, title="Alternative Solution")

Comment on lines +289 to +293
# Export important sessions
important_data = store.export_session(session_id)

# Clean up test sessions
if session.title.startswith("Test-"):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The session variable is used here without being defined. Additionally, since session.title can be None, calling startswith() directly on it could raise an AttributeError. You should retrieve the session first and safely check if session.title is not None before calling startswith().

important_data = store.export_session(session_id)

# Clean up test sessions
session = store.get_extended_session(session_id)
if session.title and session.title.startswith("Test-"):
    store.delete_session(session_id)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: update session-hierarchy + session-persistence for PR #1781 (smart cache invalidation + set_title concurrent-write safety)

1 participant