Skip to content

Commit cd96848

Browse files
committed
fix(aenv): preserve None env so arca keeps template default envs
- __init__: stop washing environment_variables None -> {} at construction - _create_env_instance: skip envNAME/envversion injection when env is None - bump version to 0.1.8rc1
1 parent 6b13ca2 commit cd96848

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

aenv/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "aenvironment"
7-
version = "0.1.6"
7+
version = "0.1.8rc1"
88
description = "AEnvironment Python SDK - Production-grade environment for AI agent tools"
99
readme = "README.md"
1010
requires-python = ">=3.10"

aenv/src/aenv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from aenv.core.models import EnvInstance, EnvStatus
3636
from aenv.core.tool import Tool, get_registry, register_tool
3737

38-
__version__ = "0.1.6"
38+
__version__ = "0.1.8rc1"
3939
__all__ = [
4040
"Tool",
4141
"register_tool",

aenv/src/aenv/core/environment.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def __init__(
159159
"""
160160
self.env_name = env_name
161161
self.datasource = datasource
162-
self.environment_variables = environment_variables or {}
162+
self.environment_variables = environment_variables
163163
self.arguments = arguments or []
164164
self.dummy_instance_ip = os.getenv("DUMMY_INSTANCE_IP")
165165
self.skip_for_healthy = skip_for_healthy
@@ -1017,12 +1017,17 @@ async def _create_env_instance(self):
10171017
# Parse env_name to extract name and version
10181018
env_name_parsed, env_version_parsed = split_env_name_version(self.env_name)
10191019

1020-
# Inject system environment variables envNAME and envversion
1021-
env_vars = (
1022-
dict(self.environment_variables) if self.environment_variables else {}
1023-
)
1024-
env_vars["envNAME"] = env_name_parsed
1025-
env_vars["envversion"] = env_version_parsed
1020+
# Inject system environment variables envNAME and envversion only
1021+
# when the caller provided env vars. When environment_variables is
1022+
# None the field must stay omitted end-to-end (api-service coerces
1023+
# to nil, arca keeps the env-config startup vars); injecting here
1024+
# would turn "no override" into a non-empty map that wipes them.
1025+
if self.environment_variables is None:
1026+
env_vars = None
1027+
else:
1028+
env_vars = dict(self.environment_variables)
1029+
env_vars["envNAME"] = env_name_parsed
1030+
env_vars["envversion"] = env_version_parsed
10261031

10271032
self._instance = await self._client.create_env_instance(
10281033
name=self.env_name,

0 commit comments

Comments
 (0)