Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kits/agent-kiro-kit/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Configure sys.path for standalone kit test execution.

Adds the kit's ``src/`` to sys.path so ``import beddel_agent_kiro``
Adds the kit's ``python/`` to sys.path so ``import beddel_agent_kiro``
resolves. The ``beddel`` SDK itself must be installed (``pip install beddel``).
"""

import sys
from pathlib import Path

_KIT_ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(_KIT_ROOT / "src"))
sys.path.insert(0, str(_KIT_ROOT / "python"))
23 changes: 19 additions & 4 deletions kits/agent-kiro-kit/tests/test_kiro_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
from unittest.mock import AsyncMock, MagicMock, patch

import pytest
from _helpers import make_context
from beddel_agent_kiro.adapter import _DEFAULT_CLI_PATH, KiroCLIAgentAdapter

from beddel.domain.errors import AgentError
from beddel.domain.models import DefaultDependencies
from beddel.domain.models import DefaultDependencies, ExecutionContext
from beddel.domain.ports import IAgentAdapter
from beddel.error_codes import (
AGENT_EXECUTION_FAILED,
Expand All @@ -29,6 +28,11 @@
_PATCH_WAIT = "beddel_agent_kiro.adapter.asyncio.wait_for"


def _make_context(workflow_id: str) -> ExecutionContext:
"""Build the execution context required by the registry primitive."""
return ExecutionContext(workflow_id=workflow_id, current_step_id="step-1")


def _make_mock_process(
*,
stdout: bytes = b"Hello, world!",
Expand Down Expand Up @@ -281,6 +285,17 @@ async def test_happy_path(self) -> None:
"timeout": 600,
}

@pytest.mark.asyncio
async def test_subprocess_receives_no_cwd(self) -> None:
"""Characterize today's inherited cwd; Story 7.2a is expected to change it."""
adapter = KiroCLIAgentAdapter()
mock_proc = _make_mock_process()

with patch(_PATCH_EXEC, return_value=mock_proc) as mock_exec:
await adapter.execute(_PROMPT)

assert "cwd" not in mock_exec.call_args.kwargs

@pytest.mark.asyncio
async def test_non_zero_exit_code(self) -> None:
adapter = KiroCLIAgentAdapter()
Expand Down Expand Up @@ -376,7 +391,7 @@ async def test_adapter_registered_and_resolved_via_agent_exec(self) -> None:
"""Register adapter as 'kiro-cli', execute via AgentExecPrimitive."""
# Arrange
adapter = KiroCLIAgentAdapter()
ctx = make_context(workflow_id="wf-registry-roundtrip")
ctx = _make_context(workflow_id="wf-registry-roundtrip")
ctx.deps = DefaultDependencies(agent_registry={"kiro-cli": adapter})

mock_proc = _make_mock_process(stdout=b"hello", returncode=0)
Expand All @@ -401,7 +416,7 @@ async def test_result_usage_contains_model_and_timeout(self) -> None:
"""Verify usage metadata includes default model and timeout."""
# Arrange
adapter = KiroCLIAgentAdapter()
ctx = make_context(workflow_id="wf-registry-usage")
ctx = _make_context(workflow_id="wf-registry-usage")
ctx.deps = DefaultDependencies(agent_registry={"kiro-cli": adapter})

mock_proc = _make_mock_process(stdout=b"hello", returncode=0)
Expand Down
Loading