Skip to content

docs: update for PR #1723 — async scheduler migration + contextvars singleton replacement#456

Open
MervinPraison wants to merge 1 commit into
mainfrom
claude/issue-443-20260530-0617
Open

docs: update for PR #1723 — async scheduler migration + contextvars singleton replacement#456
MervinPraison wants to merge 1 commit into
mainfrom
claude/issue-443-20260530-0617

Conversation

@MervinPraison
Copy link
Copy Markdown
Owner

Summary

Updates documentation to reflect the architectural changes introduced in PraisonAI PR #1723 which eliminated wrapper layer gaps through:

  • Async scheduler migration to canonical praisonai.scheduler package
  • Global singleton replacement with contextvars for multi-agent safety
  • Import path updates and deprecation status changes

Changes Made

📝 Documentation Updates

  • async-agent-scheduler.mdx: Updated all import paths from deprecated praisonai.async_agent_scheduler to canonical praisonai.scheduler import AsyncAgentScheduler
  • async-scheduler.mdx: Removed duplicate page and docs.json entry (consolidated into async-agent-scheduler.mdx)
  • tool-resolver.mdx: Added per-context resolver documentation with reset_default_resolver() function
  • thread-safety.mdx: Added multi-agent context safety section covering PR #1723 contextvars changes
  • multi-agent-context-safety.mdx: New comprehensive guide for contextvars-based multi-agent patterns

🔧 Technical Changes

  • Updated deprecation warnings from PendingDeprecationWarning to DeprecationWarning
  • Documented context-local default resolver behavior (eliminates first-caller-CWD-wins bug)
  • Added reset_default_resolver() documentation for daemon/IDE plugin use cases
  • Updated docs.json navigation structure

Verification

All verification checklist items from issue #443 completed:

  • ✅ All from praisonai.async_agent_scheduler import updated to canonical imports
  • ✅ Deprecation status changed from "pending" to active
  • tool-resolver.mdx updated to reflect per-context behavior
  • reset_default_resolver() documented with import path and examples
  • thread-safety.mdx mentions PR #1723's contextvars switch
  • docs.json validated as valid JSON
  • ✅ Removed async-scheduler.mdx and its docs.json entry
  • ✅ New page added to docs/features/ (not docs/concepts/)

Related

Closes #443

🤖 Generated with Claude Code

…ingleton replacement

- Update async-agent-scheduler.mdx with canonical import paths (praisonai.scheduler)
- Update deprecation status from PendingDeprecationWarning to DeprecationWarning
- Remove duplicate async-scheduler.mdx and docs.json entry (consolidation)
- Add per-context resolver documentation to tool-resolver.mdx with reset_default_resolver()
- Add multi-agent context safety section to thread-safety.mdx covering PR #1723 changes
- Create new multi-agent-context-safety.mdx with comprehensive contextvars guidance
- Update docs.json navigation to include new page in Safety & Control section

All import paths updated from deprecated praisonai.async_agent_scheduler to canonical
praisonai.scheduler imports. Documentation now reflects contextvars-based per-context
runtime and resolver state for safe concurrent agent operations.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 30, 2026 06:24
@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 May 30, 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 41 minutes and 59 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: 1a96e9db-e8a6-4a1f-b8e9-11d6e20fd514

📥 Commits

Reviewing files that changed from the base of the PR and between ad3daba and 3723c33.

📒 Files selected for processing (6)
  • docs.json
  • docs/features/async-agent-scheduler.mdx
  • docs/features/async-scheduler.mdx
  • docs/features/multi-agent-context-safety.mdx
  • docs/features/thread-safety.mdx
  • docs/features/tool-resolver.mdx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-443-20260530-0617

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 updates the documentation to introduce multi-agent context safety, per-context tool resolvers, and updated import paths for the async agent scheduler. However, the review feedback highlights critical discrepancies where the documented features—such as reset_default_resolver, context-local _get_shared_runtime(), _get_default_resolver(), and cleanup_runtime()—are not yet implemented in the codebase, which would result in import errors and state-sharing bugs.

Comment on lines +244 to +250
### `reset_default_resolver()`

| | |
|---|---|
| **When to call** | Daemons or IDE plugins that switch the working directory between projects |
| **What it does** | Clears the cached `ToolResolver` in the current context so the next call re-anchors to the new CWD |
| **Import** | `from praisonai.tool_resolver import reset_default_resolver` |
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 function reset_default_resolver is documented here as being imported from praisonai.tool_resolver, but it is currently missing from praisonai/tool_resolver.py in the codebase. This will cause an ImportError when users attempt to import and call it. Please ensure the implementation in praisonai/tool_resolver.py is updated to export this function.

Comment on lines +508 to +514
### Multi-agent context safety (PR #1723)

`praisonai.cli.features.interactive_tools._get_shared_runtime()` and `praisonai.tool_resolver._get_default_resolver()` were previously process-wide singletons. They are now **per-context** via `contextvars.ContextVar`:

- Concurrent agents in the same process no longer share an `InteractiveRuntime` (no LSP/ACP config bleed).
- Resolvers anchor to each agent's CWD, not whichever agent ran first.
- For long-lived daemons that switch projects, call `praisonai.tool_resolver.reset_default_resolver()` to force re-anchoring.
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 documentation states that _get_shared_runtime() and _get_default_resolver() are now per-context via contextvars.ContextVar. However, in the codebase (praisonai/cli/features/interactive_tools.py and praisonai/tool_resolver.py), these are still implemented as process-wide singletons using global variables. The implementation needs to be updated to use contextvars.ContextVar to match this documentation.

Comment on lines +267 to +280
<Accordion title="Use context-local cleanup functions">
When cleaning up resources, use the context-local versions that only affect the current agent's context.

```python
from praisonai.cli.features.interactive_tools import cleanup_runtime

async def agent_task():
agent = Agent(name="TempAgent", instructions="Temporary task")
try:
result = await agent.astart("Do something")
return result
finally:
cleanup_runtime() # Only cleans up this context's runtime
```
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 documentation describes cleanup_runtime() as context-local, only cleaning up the current context's runtime. However, the implementation in praisonai/cli/features/interactive_tools.py uses global variables (_shared_runtime and _shared_agent_tools) and shuts down the shared runtime globally. If concurrent agents are running, calling cleanup_runtime() in one agent will prematurely terminate the runtime for all other agents. The implementation should be updated to use contextvars to ensure context-local safety as documented.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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 for PR #1723 — async scheduler migration + contextvars singleton replacement

2 participants