Skip to content

Commit 73adeb3

Browse files
committed
feat: add warm pool feasibility study spec and planning artifacts
Brainstorm, specification, implementation plan, task breakdown, and review guide for evaluating Agent Sandbox warm pooling on OpenShift. Measures whether sandbox startup latency can be reduced from 8-12s to under 2s using SandboxWarmPool/SandboxClaim extension CRDs. Assisted-By: 🤖 Claude Code
1 parent 709aa0f commit 73adeb3

15 files changed

Lines changed: 1385 additions & 0 deletions

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,10 @@ scripts/lint-mermaid/node_modules/
229229
# Nix
230230
/result
231231
/result-*
232+
233+
# spex: generated/local files (only constitution is committed)
234+
# Use worktree-specific pattern to avoid shadowing root .claude/ tracked files
235+
.claude/worktrees/*/.claude/
236+
**/.specify/**
237+
!**/.specify/memory/
238+
!**/.specify/memory/constitution.md

.specify/memory/constitution.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# [PROJECT_NAME] Constitution
2+
<!-- Example: Spec Constitution, TaskFlow Constitution, etc. -->
3+
4+
## Core Principles
5+
6+
### [PRINCIPLE_1_NAME]
7+
<!-- Example: I. Library-First -->
8+
[PRINCIPLE_1_DESCRIPTION]
9+
<!-- Example: Every feature starts as a standalone library; Libraries must be self-contained, independently testable, documented; Clear purpose required - no organizational-only libraries -->
10+
11+
### [PRINCIPLE_2_NAME]
12+
<!-- Example: II. CLI Interface -->
13+
[PRINCIPLE_2_DESCRIPTION]
14+
<!-- Example: Every library exposes functionality via CLI; Text in/out protocol: stdin/args → stdout, errors → stderr; Support JSON + human-readable formats -->
15+
16+
### [PRINCIPLE_3_NAME]
17+
<!-- Example: III. Test-First (NON-NEGOTIABLE) -->
18+
[PRINCIPLE_3_DESCRIPTION]
19+
<!-- Example: TDD mandatory: Tests written → User approved → Tests fail → Then implement; Red-Green-Refactor cycle strictly enforced -->
20+
21+
### [PRINCIPLE_4_NAME]
22+
<!-- Example: IV. Integration Testing -->
23+
[PRINCIPLE_4_DESCRIPTION]
24+
<!-- Example: Focus areas requiring integration tests: New library contract tests, Contract changes, Inter-service communication, Shared schemas -->
25+
26+
### [PRINCIPLE_5_NAME]
27+
<!-- Example: V. Observability, VI. Versioning & Breaking Changes, VII. Simplicity -->
28+
[PRINCIPLE_5_DESCRIPTION]
29+
<!-- Example: Text I/O ensures debuggability; Structured logging required; Or: MAJOR.MINOR.BUILD format; Or: Start simple, YAGNI principles -->
30+
31+
## [SECTION_2_NAME]
32+
<!-- Example: Additional Constraints, Security Requirements, Performance Standards, etc. -->
33+
34+
[SECTION_2_CONTENT]
35+
<!-- Example: Technology stack requirements, compliance standards, deployment policies, etc. -->
36+
37+
## [SECTION_3_NAME]
38+
<!-- Example: Development Workflow, Review Process, Quality Gates, etc. -->
39+
40+
[SECTION_3_CONTENT]
41+
<!-- Example: Code review requirements, testing gates, deployment approval process, etc. -->
42+
43+
## Governance
44+
<!-- Example: Constitution supersedes all other practices; Amendments require documentation, approval, migration plan -->
45+
46+
[GOVERNANCE_RULES]
47+
<!-- Example: All PRs/reviews must verify compliance; Complexity must be justified; Use [GUIDANCE_FILE] for runtime development guidance -->
48+
49+
**Version**: [CONSTITUTION_VERSION] | **Ratified**: [RATIFICATION_DATE] | **Last Amended**: [LAST_AMENDED_DATE]
50+
<!-- Example: Version: 2.1.1 | Ratified: 2025-06-13 | Last Amended: 2025-07-16 -->

brainstorm/00-overview.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Brainstorm Overview
2+
3+
Last updated: 2026-07-09
4+
5+
## Sessions
6+
7+
| # | Date | Topic | Status | Spec | Issue |
8+
|---|------|-------|--------|------|-------|
9+
| 01 | 2026-07-09 | warm-pool-feasibility | active | - | - |
10+
| 02 | 2026-07-09 | cluster-setup | active | - | - |
11+
| 03 | 2026-07-09 | warm-pool-measurements | active | - | - |
12+
| 04 | 2026-07-09 | results-and-recommendations | active | - | - |
13+
14+
## Structure
15+
16+
01 is the parent document defining the overall feasibility study. 02-04 are execution phases:
17+
18+
- **02** depends on: nothing (first step)
19+
- **03** depends on: 02 (cluster must be running)
20+
- **04** depends on: 03 (measurements must be complete)
21+
22+
## Open Threads
23+
24+
- Does the Red Hat Agent Sandbox operator tech preview include extension CRDs? (from #01, #02)
25+
- Does env var injection at claim time trigger cold start? (from #01, #03)
26+
- Is KEP-753 (native sidecars) available on the target OpenShift version? (from #01, #02)
27+
- How does pool exhaustion behave (cold fallback vs. Pending)? (from #03)
28+
- Should findings be posted to upstream agent-sandbox repo? (from #04)
29+
30+
## Parked Ideas
31+
32+
None.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Brainstorm: Warm Pool Feasibility Study for OpenShell
2+
3+
**Date:** 2026-07-09
4+
**Status:** active
5+
6+
## Problem Framing
7+
8+
OpenShell's Kubernetes driver creates a fresh `agents.x-k8s.io` Sandbox CR for every sandbox request. This cold-start path pays for pod scheduling, image pull, init container execution, supervisor startup, and gateway registration on every create. Measured latency is 8-12 seconds. For agent harnesses like OpenClaw that create sandboxes per tool call or per sub-agent, this is unusable.
9+
10+
The upstream Agent Sandbox project (kubernetes-sigs/agent-sandbox, v0.5.0, v1beta1 API) provides extension CRDs for warm pooling: SandboxTemplate, SandboxWarmPool, and SandboxClaim. OpenShell does not use any of these today. The Kubernetes driver has no awareness of the extension API group `extensions.agents.x-k8s.io`.
11+
12+
This feasibility study measures whether warm pooling can reduce sandbox startup latency to under 2 seconds on OpenShift, and produces a recommendation for how OpenShell should integrate warm pooling into its architecture.
13+
14+
## Approaches Considered
15+
16+
### A: Measure Raw Agent Sandbox Warm Pooling (Without OpenShell)
17+
18+
Deploy the Agent Sandbox extension CRDs on OpenShift, create warm pools with vanilla containers, and measure claim-to-ready latency. This isolates the Kubernetes layer from OpenShell overhead.
19+
20+
- Pros: Fast to set up, answers the fundamental feasibility question, no code changes required
21+
- Cons: Does not account for OpenShell supervisor, identity binding, or policy injection
22+
23+
### B: Measure OpenShell End-to-End with Code Changes
24+
25+
Modify the OpenShell Kubernetes driver to create SandboxClaims instead of direct Sandbox CRs, then measure end-to-end latency.
26+
27+
- Pros: Realistic numbers that include all OpenShell overhead
28+
- Cons: Requires significant code changes before any measurement, high risk of wasted effort if the raw K8s layer is already too slow
29+
30+
### C: Layered Approach (A then B)
31+
32+
Start with raw Agent Sandbox measurements (no OpenShell code changes), then layer on OpenShell-specific concerns (supervisor sidecar, identity injection, readiness patterns) incrementally.
33+
34+
- Pros: Answers feasibility fast, builds understanding incrementally, each layer adds data
35+
- Cons: More phases to execute
36+
37+
## Decision
38+
39+
**Approach C: Layered measurement.** Start with raw Agent Sandbox warm pooling on OpenShift to establish a baseline, then progressively add OpenShell-specific complexity. This avoids wasting effort on code changes if the underlying Kubernetes primitives can't deliver acceptable latency.
40+
41+
## Key Requirements
42+
43+
1. **Fresh ROSA HCP cluster** provisioned via the ROSA plugin for consistent, isolated measurements
44+
2. **Red Hat build of Agent Sandbox operator** (tech preview) installed from OperatorHub for the extension CRDs
45+
3. **OpenShell deployed via the OpenShift deploy chart** (github.com/2000krysztof/Openshell-Openshift-Deploy) for fast setup
46+
4. **Baseline cold-start measurements** (vanilla sandbox creation, no pooling) as the control
47+
5. **Warm pool measurements** with varying configurations (readiness probe intervals, Pod Readiness Gates, sidecar readiness patterns)
48+
6. **Health check optimization experiments** including Knative-style readiness wrapping and KEP-580 Pod Readiness Gates
49+
7. **Results document** with measured data, phase-by-phase breakdown, and architectural recommendations for OpenShell warm pool integration
50+
8. **Scope: Kubernetes only.** Podman/Docker single-player warm pooling is out of scope.
51+
52+
## Experiment Phases
53+
54+
This study decomposes into three execution phases, each with its own brainstorm document:
55+
56+
| Phase | Brainstorm | What it covers |
57+
|-------|------------|----------------|
58+
| 1 | 02-cluster-setup | ROSA cluster provisioning, Agent Sandbox operator, OpenShell deployment |
59+
| 2 | 03-warm-pool-measurements | Cold-start baseline, warm pool experiments, health check optimization |
60+
| 3 | 04-results-and-recommendations | Data synthesis, OpenShell architecture recommendations |
61+
62+
## Open Questions
63+
64+
- Does the Red Hat Agent Sandbox operator tech preview include the extension CRDs (SandboxWarmPool, SandboxClaim, SandboxTemplate), or only the core Sandbox CRD?
65+
- Does env var injection at SandboxClaim time trigger a cold start, or can the `envVarsInjectionPolicy` on SandboxTemplate enable true warm adoption with claim-time injection?
66+
- Is KEP-753 (native sidecar containers) available on the target OpenShift version (needs K8s 1.33+ / OpenShift 4.20+)?
67+
- What is the minimum OpenShift version that supports both the Agent Sandbox operator tech preview and native sidecar containers?

brainstorm/02-cluster-setup.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Brainstorm: Cluster Setup & OpenShell Deployment
2+
3+
**Date:** 2026-07-09
4+
**Status:** active
5+
**Parent:** 01-warm-pool-feasibility
6+
7+
## Problem Framing
8+
9+
Before any measurements can happen, we need an OpenShift cluster with OpenShell and the Agent Sandbox extension CRDs running. This phase covers provisioning, installation, and validation.
10+
11+
Three components must work together:
12+
1. A ROSA HCP cluster with a Kubernetes version that supports native sidecar containers (K8s 1.33+)
13+
2. The Agent Sandbox operator with extension CRDs (SandboxTemplate, SandboxWarmPool, SandboxClaim)
14+
3. OpenShell deployed and functional (can create cold-start sandboxes)
15+
16+
## Approaches Considered
17+
18+
### A: ROSA HCP with Upstream Agent Sandbox Manifests
19+
20+
Provision ROSA, install agent-sandbox from upstream manifests (both `manifest.yaml` and `extensions.yaml`), deploy OpenShell with the OpenShell OpenShift deploy chart.
21+
22+
- Pros: Uses upstream directly, most current version, full control over version
23+
- Cons: No operator lifecycle management, manual CRD updates, no OperatorHub integration
24+
25+
### B: ROSA HCP with Red Hat Agent Sandbox Operator (Tech Preview)
26+
27+
Provision ROSA, install the Red Hat build of Agent Sandbox from OperatorHub, deploy OpenShell with the OpenShell OpenShift deploy chart.
28+
29+
- Pros: Operator manages CRD lifecycle, OperatorHub integration, downstream supported path
30+
- Cons: Tech preview may not include extension CRDs yet, version may lag upstream
31+
32+
### C: Both Paths Available
33+
34+
Install the Red Hat operator for the core Sandbox CRD, then layer upstream extension manifests on top if the operator doesn't include them.
35+
36+
- Pros: Best of both worlds, flexibility
37+
- Cons: Mixed provenance (downstream operator + upstream extensions), potential version conflicts
38+
39+
## Decision
40+
41+
**Approach C: Start with the Red Hat operator, fall back to upstream extensions.** Install the tech preview operator from OperatorHub first. If it includes the extension CRDs, use them. If not, apply upstream `extensions.yaml` on top. This gives us the downstream operator path for the core CRDs while ensuring we have warm pool primitives available.
42+
43+
## Key Requirements
44+
45+
1. **ROSA HCP cluster** via `rosa:create` with the AAET profile
46+
- OpenShift version must support K8s 1.33+ for native sidecar containers (KEP-753 GA)
47+
- Region: us-east-2 (matches AAET profile subnets)
48+
- Worker nodes: at least 3 for realistic scheduling behavior
49+
50+
2. **Agent Sandbox installation**
51+
- Red Hat Agent Sandbox operator from OperatorHub (if available)
52+
- Upstream extensions.yaml as fallback for SandboxTemplate/SandboxWarmPool/SandboxClaim
53+
- Verify all four CRDs are served: `kubectl api-resources | grep agents`
54+
55+
3. **OpenShell deployment**
56+
- Clone github.com/2000krysztof/Openshell-Openshift-Deploy at a pinned commit/tag for reproducibility
57+
- Run `deploy.sh` with default configuration
58+
- Verify: `openshell status` shows Connected
59+
- Verify: `openshell sandbox create --from base` succeeds (cold-start baseline works)
60+
61+
4. **Image pre-pulling**
62+
- Pre-pull the OpenShell base sandbox image and supervisor image on all worker nodes
63+
- This removes image pull latency from warm pool measurements
64+
- Use a DaemonSet with `initContainers` that pull and exit, or `oc debug node/` to pre-pull
65+
66+
5. **Validation checklist**
67+
- Gateway pod is Running
68+
- Agent Sandbox controller is Running
69+
- Extension CRDs are registered
70+
- Cold-start sandbox creation works end-to-end
71+
- Images are pre-pulled on all nodes
72+
73+
## Open Questions
74+
75+
- What OpenShift version does ROSA HCP currently offer that includes K8s 1.33+? Need to check `rosa list versions`.
76+
- Does the Red Hat Agent Sandbox operator tech preview install from the default OperatorHub catalog, or does it require a custom CatalogSource?
77+
- Does the deploy script handle OpenShift 4.20+ or does it need updates for newer SCC/security changes?
78+
- How much cluster capacity do we need? The warm pool experiments will create 5-20 pre-provisioned pods simultaneously.

0 commit comments

Comments
 (0)