fix(cli): resolve session export test assertion and move get_container to top-level import
- Fix `security_template_coverage_boost.feature` assertion for "Session export to stdout outputs JSON": the export path outputs raw JSON with a `session_id` key, not a `data` envelope, so revert the erroneous `"data"` assertion back to `"session_id"`. - Move all deferred `from cleveragents.application.container import get_container` imports in session.py to the module-level import block, consistent with every other CLI command file (action.py, actor.py, config.py, plan.py, etc.). No circular import exists. - Update `session_cli_uncovered_branches_steps.py` to patch `cleveragents.cli.commands.session.get_container` directly (the correct target after a top-level import) instead of replacing `sys.modules["cleveragents.application.container"]`. - Add CHANGELOG.md entry for the session create JSON envelope fix. ISSUES CLOSED: #6441
This commit is contained in:
+2
-1
@@ -7,6 +7,7 @@ Changed `wf10_batch.robot` to be less likely to create files, and
|
||||
|
||||
## [Unreleased]
|
||||
- **fix(cli): add --url flag to resource add for git resource type** (#6322): Added support for the `--url` flag on `agents resource add git` command, allowing users to specify a remote URL for git resources. The flag is validated to only apply to git resource types. Includes Behave BDD tests in `features/resource_cli_git_url_flag.feature` and Robot Framework integration tests verifying correct URL validation and CLI behavior.
|
||||
- **Session create JSON envelope** (#6441): Fixed `agents session create --format json` returning a flat `data` dict instead of the spec-required nested structure with `data.session`, `data.settings`, and `data.actor_details` sub-objects. The `command` field is now populated correctly.
|
||||
- **fix(resources): remove unsupported executable resource type and fix resource list columns** (#3077 / PR #3248): Removed `executable` from `LSP_RESOURCE_TYPES` and `BUILTIN_TYPE_NAMES` (the specification defines no such built-in type). Updated `agents resource list` CLI table columns from `[ID, Name, Type, Status, Kind, Location, Description]` to the spec-required `[Name, ID, Type, Phys/Virt, Children, Projects]`. Deleted orphaned `examples/resource-types/executable.yaml`. Lifecycle state for container resources is now displayed as a note below the resource table.
|
||||
- **fix(cli): add Read-Only and Writes columns to tool list output** (#1476): Rewrote
|
||||
`list_tools()` in `src/cleveragents/cli/commands/tool.py` to render exactly the 5
|
||||
@@ -1106,4 +1107,4 @@ iteration` and data corruption under concurrent plan execution. All public
|
||||
- **TUI -- Permission Question Widget**: A new inline `PermissionQuestionWidget`
|
||||
renders permission requests directly in the conversation stream for single-file
|
||||
operations. Users can allow/reject with single-key shortcuts (`a`/`A`/`r`/`R`),
|
||||
navigate with arrow keys, confirm with `Enter`, or press `v` to open the full
|
||||
navigate with arrow keys, confirm with `Enter`, or press `v` to open the full
|
||||
@@ -168,7 +168,7 @@ Feature: Coverage boost for security template branch
|
||||
Given a session CLI test environment
|
||||
And a mock session service that can export
|
||||
When I invoke session export to stdout
|
||||
Then the covboost session output should contain "data"
|
||||
Then the covboost session output should contain "session_id"
|
||||
|
||||
Scenario: Session export to file that exists without force fails
|
||||
Given a session CLI test environment
|
||||
|
||||
@@ -120,16 +120,9 @@ def step_call_get_session_service(context):
|
||||
mock_container.session_service.return_value = mock_service_instance
|
||||
context._mock_persistent_instance = mock_service_instance
|
||||
|
||||
import sys
|
||||
|
||||
mock_container_mod = MagicMock()
|
||||
mock_container_mod.get_container = MagicMock(return_value=mock_container)
|
||||
|
||||
with patch.dict(
|
||||
sys.modules,
|
||||
{
|
||||
"cleveragents.application.container": mock_container_mod,
|
||||
},
|
||||
with patch(
|
||||
"cleveragents.cli.commands.session.get_container",
|
||||
return_value=mock_container,
|
||||
):
|
||||
result = mod._get_session_service()
|
||||
context._get_service_result = result
|
||||
|
||||
@@ -28,6 +28,7 @@ from rich.panel import Panel
|
||||
from rich.table import Table
|
||||
|
||||
from cleveragents.a2a.models import A2aRequest
|
||||
from cleveragents.application.container import get_container
|
||||
from cleveragents.application.services.session_workflow import SessionWorkflow
|
||||
from cleveragents.application.services.strategy_resolution import (
|
||||
build_actor_resolver,
|
||||
@@ -79,8 +80,6 @@ def _get_session_service() -> SessionService:
|
||||
if _service is not None:
|
||||
return _service
|
||||
|
||||
from cleveragents.application.container import get_container
|
||||
|
||||
container = get_container()
|
||||
svc = cast(SessionService, container.session_service())
|
||||
_service = svc
|
||||
@@ -141,8 +140,6 @@ def _build_actor_resolver():
|
||||
that always returns ``None`` (graceful degradation).
|
||||
"""
|
||||
try:
|
||||
from cleveragents.application.container import get_container
|
||||
|
||||
container = get_container()
|
||||
actor_service = container.actor_service()
|
||||
if actor_service is None:
|
||||
@@ -177,8 +174,6 @@ def _build_actor_options_resolver():
|
||||
the actor is unknown, or the registry is unavailable.
|
||||
"""
|
||||
try:
|
||||
from cleveragents.application.container import get_container
|
||||
|
||||
container = get_container()
|
||||
actor_service = container.actor_service()
|
||||
if actor_service is None:
|
||||
@@ -254,8 +249,6 @@ def _resolve_actor_details(actor_name: str | None) -> OrderedDict[str, Any] | No
|
||||
|
||||
actor = None
|
||||
try:
|
||||
from cleveragents.application.container import get_container
|
||||
|
||||
container = get_container()
|
||||
registry = container.actor_registry()
|
||||
actor = registry.get_actor(actor_name)
|
||||
@@ -471,8 +464,6 @@ def create(
|
||||
# Actor Details panel (if actor is bound)
|
||||
if session.actor_name:
|
||||
try:
|
||||
from cleveragents.application.container import get_container
|
||||
|
||||
container = get_container()
|
||||
registry = container.actor_registry()
|
||||
actor_obj = registry.get_actor(session.actor_name)
|
||||
|
||||
Reference in New Issue
Block a user