Skip to content

SANDBOX-1811: add openspec for warm pod pool - #13

Merged
fbm3307 merged 2 commits into
masterfrom
SANDBOX-1811-warm-pod-pool-openspec
Jul 2, 2026
Merged

SANDBOX-1811: add openspec for warm pod pool#13
fbm3307 merged 2 commits into
masterfrom
SANDBOX-1811-warm-pod-pool-openspec

Conversation

@fbm3307

@fbm3307 fbm3307 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator
  • Covers ReconcilePool goroutine, atomic claim flow via resourceVersion optimistic locking, POST /assign token delivery, async replenishment, and fallback to on-demand creation
  • Optimistic locking via resourceVersion for claim atomicity
  • Warm pods created without auth Secret or session-id label (agent starts unassigned)
  • Async replenishment after claim via buffered channel
  • Oldest-first pod claiming with retry on conflict
  • Stale unassigned pod cleanup at 2× IdleTimeout

Assisted By: Cursor

Summary by CodeRabbit

  • New Features
    • Added a “warm pod pool” option to keep pre-warmed sandbox pods available, reducing session start latency when enabled.
    • Sessions now attempt to claim an available warm pod first; the pool replenishes in the background to maintain the target size.
    • Added configurable reconciliation timing (default 30s) and automatic stale cleanup of unassigned warm pods (idle beyond 2× IdleTimeout).
    • Added safe concurrency behavior for pod claims, with rollback if a claim or assignment fails.

Design proposal, spec, and task breakdown for the warm pod pool feature
that pre-creates unassigned sandbox pods to eliminate cold-start latency.

Co-authored-by: Cursor <cursoragent@cursor.com>
@fbm3307
fbm3307 requested a review from alexeykazakov July 1, 2026 10:20
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: b8805d30-f1ba-4b59-b8ab-f71f8d67ff74

📥 Commits

Reviewing files that changed from the base of the PR and between 126149d and 4881df0.

📒 Files selected for processing (3)
  • openspec/changes/2026-07-01-warm-pod-pool/design.md
  • openspec/changes/2026-07-01-warm-pod-pool/specs/warm-pool/spec.md
  • openspec/changes/2026-07-01-warm-pod-pool/tasks.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • codeready-toolchain/mcp-common (manual)
  • codeready-toolchain/mcp-server-devsandbox (manual)
  • codeready-toolchain/api (manual)
  • codeready-toolchain/toolchain-common (manual)
  • codeready-toolchain/host-operator (manual)
  • codeready-toolchain/toolchain-e2e (manual)
✅ Files skipped from review due to trivial changes (2)
  • openspec/changes/2026-07-01-warm-pod-pool/tasks.md
  • openspec/changes/2026-07-01-warm-pod-pool/design.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • openspec/changes/2026-07-01-warm-pod-pool/specs/warm-pool/spec.md
📜 Recent review details
🧰 Additional context used
🔀 Multi-repo context

Linked repositories findings

codeready-toolchain/mcp-server-devsandbox

  • deploy/README.md:184-197 documents the session-init flow and the Mcp-Session-Id header used for subsequent requests. This is relevant because the warm-pool design depends on per-session assignment behavior and assumes session identity is established before later calls like /assign-driven pod assignment.

codeready-toolchain/mcp-common

  • No direct references found for /assign, AssignRequest, ReconcileInterval, WarmPool, session-id, created-at, or SANDBOX_AUTH_TOKEN.

codeready-toolchain/api

  • No direct references found for /assign, AssignRequest, ReconcileInterval, WarmPool, session-id, created-at, or SANDBOX_AUTH_TOKEN.

Walkthrough

This PR adds OpenSpec documents for a warm pod pool feature in the CLI MCP Server session manager. It includes a proposal, design rationale, behavioral spec, metadata, and an implementation checklist. No code changes are included.

Changes

Warm Pod Pool OpenSpec

Layer / File(s) Summary
Metadata and proposal
openspec/changes/2026-07-01-warm-pod-pool/.openspec.yaml, openspec/changes/2026-07-01-warm-pod-pool/proposal.md, openspec/changes/2026-07-01-warm-pod-pool/specs/warm-pool/spec.md
Adds the OpenSpec change metadata, feature proposal, and the config contract for ReconcileInterval.
Design contract
openspec/changes/2026-07-01-warm-pod-pool/design.md
Defines warm-pool ownership, claim behavior, pod creation rules, reconciliation, cleanup, and fallback behavior.
Behavioral spec
openspec/changes/2026-07-01-warm-pod-pool/specs/warm-pool/spec.md
Specifies ReconcilePool, ClaimPod, buildWarmPodSpec, StartReconciler, and GetOrCreatePod behavior, including rollback and disabled-pool handling.
Implementation checklist
openspec/changes/2026-07-01-warm-pod-pool/tasks.md
Lists the implementation steps and test cases for the warm-pool feature.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: proposal

Suggested reviewers: rajivnathan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding an openspec for the warm pod pool feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch SANDBOX-1811-warm-pod-pool-openspec

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

@coderabbitai coderabbitai Bot added the proposal label Jul 1, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@openspec/changes/2026-07-01-warm-pod-pool/design.md`:
- Around line 11-15: The warm pool reconciliation currently appears to be run by
every replica via ReconcilePool(), which can cause the pool target to be
enforced per replica instead of cluster-wide. Update the design around
ReconcilePool(), WarmPoolSize, and the claim/replenishment flow to make
reconciliation owned by a single leader/reconciler, or explicitly define that
WarmPoolSize is scoped per replica and state that clearly. Ensure the ownership
model is described consistently alongside the existing atomic claim flow and
fallback behavior.

In `@openspec/changes/2026-07-01-warm-pod-pool/specs/warm-pool/spec.md`:
- Around line 77-82: The StartReconciler/ReconcileInterval behavior needs
validation so the background ticker never receives a zero or negative duration.
Update the StartReconciler flow to enforce a positive ReconcileInterval, falling
back to the 30s default or rejecting invalid input before calling
time.NewTicker, and keep the check close to the reconciler startup logic so the
behavior is enforced consistently.
- Around line 32-60: The warm-pool ClaimPod flow is missing recovery rules for
failures after the pod is claimed but before assignment completes. Update the
ClaimPod scenario in the warm-pool spec to explicitly handle auth Secret
creation errors by rolling back the pod label claim, and clarify that ambiguous
POST /assign failures such as timeouts or connection loss must also trigger
rollback of the session-id label and deletion of the auth Secret. Use the
ClaimPod, /assign, and cli-mcp-sandbox-auth-<sessionID> symbols to keep the
behavior consistent across retries and avoid pod/Secret/agent divergence.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: ca498b33-d90a-4a1e-8ae7-da20abfa9e5e

📥 Commits

Reviewing files that changed from the base of the PR and between 4ea0a2f and 126149d.

📒 Files selected for processing (5)
  • openspec/changes/2026-07-01-warm-pod-pool/.openspec.yaml
  • openspec/changes/2026-07-01-warm-pod-pool/design.md
  • openspec/changes/2026-07-01-warm-pod-pool/proposal.md
  • openspec/changes/2026-07-01-warm-pod-pool/specs/warm-pool/spec.md
  • openspec/changes/2026-07-01-warm-pod-pool/tasks.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • codeready-toolchain/mcp-common (manual)
  • codeready-toolchain/mcp-server-devsandbox (manual)
  • codeready-toolchain/api (manual)
  • codeready-toolchain/toolchain-common (manual)
  • codeready-toolchain/host-operator (manual)
  • codeready-toolchain/toolchain-e2e (manual)
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • openspec/changes/2026-07-01-warm-pod-pool/specs/warm-pool/spec.md
  • openspec/changes/2026-07-01-warm-pod-pool/tasks.md
  • openspec/changes/2026-07-01-warm-pod-pool/proposal.md
  • openspec/changes/2026-07-01-warm-pod-pool/design.md
🔀 Multi-repo context

Linked repositories findings

codeready-toolchain/mcp-server-devsandbox

  • deploy/README.md:184-206 — documents the MCP session lifecycle and the Mcp-Session-Id header. This is directly relevant to the warm-pool claim flow, since the new feature depends on session creation/assignment behavior and per-session identity propagation.

codeready-toolchain/mcp-common

  • No direct warm-pool / /assign / AssignRequest / ReconcileInterval references were found in the repo surface I checked.

codeready-toolchain/host-operator

  • No direct warm-pool / /assign / AssignRequest / ReconcileInterval consumers were found; the search hits were unrelated cluster-assigned state-label usages in tests/docs.

codeready-toolchain/toolchain-e2e

  • No direct warm-pool / /assign / AssignRequest / ReconcileInterval consumers were found; the search hits were unrelated “assigned” references in tests/docs.
🔇 Additional comments (3)
openspec/changes/2026-07-01-warm-pod-pool/.openspec.yaml (1)

1-2: LGTM!

openspec/changes/2026-07-01-warm-pod-pool/proposal.md (1)

1-45: LGTM!

openspec/changes/2026-07-01-warm-pod-pool/tasks.md (1)

1-65: LGTM!

Comment thread openspec/changes/2026-07-01-warm-pod-pool/design.md Outdated
Comment thread openspec/changes/2026-07-01-warm-pod-pool/specs/warm-pool/spec.md
Comment thread openspec/changes/2026-07-01-warm-pod-pool/specs/warm-pool/spec.md
- Clarify WarmPoolSize is a cluster-wide target, not per-replica;
  add Decision 7 explaining why every replica runs reconciliation
  (idempotent convergence, no leader election needed)
- Add rollback scenario for auth Secret creation failure in ClaimPod
- Clarify that ambiguous /assign failures (timeouts, connection loss)
  also trigger full rollback of pod label and Secret
- Add ReconcileInterval validation: fall back to 30s default on
  zero/negative values to prevent time.NewTicker panic
- Update task checklist with new rollback steps and test cases

Co-authored-by: Cursor <cursoragent@cursor.com>
@fbm3307
fbm3307 merged commit b89bfaf into master Jul 2, 2026
3 of 4 checks passed
@fbm3307
fbm3307 deleted the SANDBOX-1811-warm-pod-pool-openspec branch July 2, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants