Skip to content

Add isolated named Python sessions - #25

Merged
mkagenius merged 3 commits into
mainfrom
add-named-sessions-and-mcp-contracts
Aug 13, 2026
Merged

Add isolated named Python sessions#25
mkagenius merged 3 commits into
mainfrom
add-named-sessions-and-mcp-contracts

Conversation

@abhishek-anand

Copy link
Copy Markdown
Collaborator

Summary

  • add named Python sessions backed by dedicated Jupyter kernels
  • support isolated state and concurrent execution through MCP and REST
  • discard session kernels on stop and wait for new kernels to become responsive
  • stop retrying user-code exceptions while retaining retries for infrastructure failures
  • verify MCP 2025-06-18 negotiation and output schemas for every tool

Testing

  • session isolation across two kernels
  • parallel execution across named sessions
  • five-session capacity and overflow behavior
  • MCP tool schemas and 2025-06-18 protocol negotiation
  • REST session lifecycle and execution
  • user-code exceptions execute once and preserve the kernel

Copilot AI lite review requested due to automatic review settings August 11, 2026 23:58
@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds named, isolated Python sessions backed by dedicated Jupyter kernels, exposing them via new MCP tools and REST session lifecycle endpoints, and updates retry behavior so user-code exceptions aren’t retried while infrastructure failures still can be.

Changes:

  • Introduces PythonSessionManager to create/list/stop named sessions and route execution to session-reserved kernels.
  • Adjusts kernel lifecycle handling (discard on session stop, wait for newly created kernels to become responsive, refine retry behavior).
  • Adds a contract/integration-style test script covering MCP protocol negotiation/tool schemas plus REST session lifecycle.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
server.py Adds session manager + MCP/REST session APIs; changes kernel lifecycle + retry/error behavior.
test-sessions.py Adds end-to-end contract tests for MCP tools, session isolation, concurrency, capacity limits, and REST lifecycle.
README.md Documents new MCP tools for starting/listing/stopping sessions and how to pass session_id.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread server.py Outdated
Comment thread server.py Outdated
Comment thread test-sessions.py Outdated
Comment thread server.py Outdated
@mkagenius mkagenius self-assigned this Aug 12, 2026
@mkagenius
mkagenius self-requested a review August 13, 2026 13:03

@mkagenius mkagenius left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I built PR 25's actual head ( 3d60721 ) and ran it. Everything passed:

@mkagenius
mkagenius merged commit e8a4b58 into main Aug 13, 2026
4 checks passed
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.

3 participants