mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
fix(copilot): resolve merge conflict with dev + fix test failures
- Resolve conflict in create_agent.py: keep both require_guide_read gate (from dev) and needs_build_plan_approval gate (from this branch) - Fix create_agent_test.py: add decompose_goal + approval history to test sessions so needs_build_plan_approval gate passes - Bump tool schema char budget from 32000 to 34000 (new decompose_goal tool descriptions pushed it past the old limit) - Fix test_schedule_auto_approve_creates_task: use dynamic baseline (make_session now pre-populates guide_read message) - Fix ruff F841 unused variable errors from dev merge - Re-export openapi.json Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from backend.copilot.model import ChatMessage
|
||||
from backend.copilot.tools.create_agent import CreateAgentTool
|
||||
from backend.copilot.tools.models import AgentPreviewResponse, ErrorResponse
|
||||
|
||||
@@ -13,6 +14,28 @@ _TEST_USER_ID = "test-user-create-agent"
|
||||
_PIPELINE = "backend.copilot.tools.agent_generator.pipeline"
|
||||
|
||||
|
||||
def _add_approval_history(session):
|
||||
"""Add decompose_goal + user approval to the session so the
|
||||
needs_build_plan_approval gate passes."""
|
||||
session.messages.append(
|
||||
ChatMessage(
|
||||
role="assistant",
|
||||
content="",
|
||||
tool_calls=[
|
||||
{
|
||||
"id": "call_decompose",
|
||||
"type": "function",
|
||||
"function": {"name": "decompose_goal", "arguments": "{}"},
|
||||
}
|
||||
],
|
||||
)
|
||||
)
|
||||
session.messages.append(ChatMessage(role="tool", content="{plan}"))
|
||||
session.messages.append(
|
||||
ChatMessage(role="user", content="Approved. Please build the agent.")
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tool():
|
||||
return CreateAgentTool()
|
||||
@@ -20,7 +43,9 @@ def tool():
|
||||
|
||||
@pytest.fixture
|
||||
def session():
|
||||
return make_session(_TEST_USER_ID)
|
||||
s = make_session(_TEST_USER_ID)
|
||||
_add_approval_history(s)
|
||||
return s
|
||||
|
||||
|
||||
# ── Input validation tests ──────────────────────────────────────────────
|
||||
|
||||
@@ -14,8 +14,8 @@ import pytest
|
||||
|
||||
from backend.copilot.tools import TOOL_REGISTRY
|
||||
|
||||
# Character budget (~4 chars/token heuristic, targeting ~8000 tokens)
|
||||
_CHAR_BUDGET = 32_000
|
||||
# Character budget (~4 chars/token heuristic, targeting ~8500 tokens)
|
||||
_CHAR_BUDGET = 34_000
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
|
||||
Reference in New Issue
Block a user