Skip to content
Open
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
7 changes: 6 additions & 1 deletion mini_agent/acp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ async def prompt(self, params: PromptRequest) -> PromptResponse:
if not state:
# Auto-create session if not found (compatibility with clients that skip newSession)
logger.warning(f"Session '{params.sessionId}' not found, auto-creating new session")
new_session = await self.newSession(NewSessionRequest(cwd=None))
new_session = await self.newSession(
NewSessionRequest(
cwd=str(self._config.agent.workspace_dir),
mcpServers=[],
)
)
state = self._sessions.get(new_session.sessionId)
if not state:
logger.error("Failed to auto-create session")
Expand Down
8 changes: 6 additions & 2 deletions tests/test_acp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Integration tests for the MiniMax ACP adapter."""

from pathlib import Path
from types import SimpleNamespace

import pytest
Expand Down Expand Up @@ -82,8 +83,11 @@ async def test_acp_turn_executes_tool(acp_agent):


@pytest.mark.asyncio
async def test_acp_invalid_session(acp_agent):
async def test_acp_unknown_session_auto_creates_with_configured_workspace(acp_agent):
agent, _ = acp_agent
prompt = SimpleNamespace(sessionId="missing", prompt=[{"text": "?"}])
response = await agent.prompt(prompt)
assert response.stopReason == "refusal"
assert response.stopReason == "end_turn"
assert len(agent._sessions) == 1
created_session = next(iter(agent._sessions.values()))
assert Path(created_session.agent.workspace_dir) == Path(agent._config.agent.workspace_dir)