alibaba / alibaba/ROCK

Add environment lifecycle orchestration to McpEnv

Open
#1,230 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
485
Forks
81
Avg merge
16h 12m
Merged PRs (30d)
8

Description

## Summary

Extend rock.sdk.mcp.McpEnv to consume ScaffoldHub EnvLifecycleFactory and orchestrate environment lifecycles within the existing ROCK runtime flow.

## Scope

- construct registered environment lifecycles by MCP server key
- inject the ROCK sandbox and start environment lifecycles before the user before_launch hook
- make McpEnv.is_alive(key: str | None = None) asynchronous and aggregate lifecycle status without short-circuiting
- release environment lifecycles before runtime/auth cleanup while preserving cleanup and error-priority semantics
- update the optional mcp dependency only after an actual ScaffoldHub release containing EnvLifecycle is available

## Acceptance criteria

- unit tests cover construction, start order/config, async liveness, release order, cleanup continuation, and error propagation
- existing MCP integration tests collect with awaited is_alive calls
- relevant Ruff checks pass
- PR references this issue

## Dependency

ScaffoldHub feature/env-lifecycle must provide EnvLifecycle, EnvLifecycleFactory, and GoogleSheetsEnvLifecycle under the fixed google_sheet server key.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at rock.sdk.mcp.McpEnv and trace the existing ROCK runtime and cleanup flow, then inspect the MCP integration tests and current optional mcp dependency. Check the ScaffoldHub EnvLifecycleFactory contract and the google_sheet server key before implementing lifecycle construction, ordering, async liveness, and error handling. Done means the listed unit and integration tests pass, awaited is_alive calls collect, Ruff passes, and the PR references this issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.