fix(platform): address PR review comments

- Revert out-of-scope changes: .gitignore, auth/dependencies.py, auth/jwt_utils.py,
  backend/.gitignore, sdk/response_adapter.py
- Raise ValueError instead of silently truncating search queries in
  agent_generator/core.py so the AI can adjust its search term
- Remove .application.logs artifact
This commit is contained in:
Zamil Majdy
2026-02-24 01:57:29 +07:00
parent 004c2d4201
commit 4088b2ba63
6 changed files with 21 additions and 45 deletions

3
.gitignore vendored
View File

@@ -180,5 +180,4 @@ autogpt_platform/backend/settings.py
.claude/settings.local.json
CLAUDE.local.md
/autogpt_platform/backend/logs
.next
.application.logs
.next

View File

@@ -89,16 +89,6 @@ async def get_user_id(
HTTPException: 401 for authentication failures or missing user ID
HTTPException: 403 if non-admin tries to use impersonation
"""
# TEMPORARY: Allow test mode bypass via header for streaming tests
import os
if os.getenv("COPILOT_TEST_MODE") == "true" or request.headers.get(
"X-Test-User-Id"
):
test_user_id = request.headers.get("X-Test-User-Id", "test-user-streaming")
logger.warning(f"[TEST MODE] Using test user ID: {test_user_id}")
return test_user_id
# Get the authenticated user's ID from JWT
user_id = jwt_payload.get("sub")
if not user_id:

View File

@@ -31,13 +31,6 @@ async def get_jwt_payload(
:return: JWT payload dictionary
:raises HTTPException: 401 if authentication fails
"""
# TEMPORARY: Allow test mode bypass for streaming tests
import os
if os.getenv("COPILOT_TEST_MODE") == "true":
logger.warning("[TEST MODE] Bypassing JWT validation")
return {"sub": "test-user-streaming", "role": "user"}
if not credentials:
raise HTTPException(status_code=401, detail="Authorization header is missing")

View File

@@ -22,5 +22,3 @@ migrations/*/rollback*.sql
# Workspace files
workspaces/
autogpt_platform/backend/.application.logs
.application.logs

View File

@@ -114,13 +114,13 @@ class SDKResponseAdapter:
responses.append(
StreamToolInputStart(toolCallId=block.id, toolName=tool_name)
)
tool_input_obj = StreamToolInputAvailable(
toolCallId=block.id,
toolName=tool_name,
input=block.input,
responses.append(
StreamToolInputAvailable(
toolCallId=block.id,
toolName=tool_name,
input=block.input,
)
)
responses.append(tool_input_obj)
self.current_tool_calls[block.id] = {"name": tool_name}
elif isinstance(sdk_message, UserMessage):
@@ -294,7 +294,7 @@ class SDKResponseAdapter:
self.resolved_tool_calls.add(tool_id)
flushed = True
logger.info(
"[SDK] [%s] Flushed stashed output for %s (call %s, %d chars)",
"[SDK] [%s] Flushed stashed output for %s " "(call %s, %d chars)",
sid,
tool_name,
tool_id[:12],

View File

@@ -245,20 +245,17 @@ async def get_library_agents_for_generation(
Returns:
List of LibraryAgentSummary with schemas and recent executions for sub-agent composition
"""
# Truncate search query to avoid "Search term is too long" error (100 char limit in DB)
truncated_search = None
if search_query:
truncated_search = search_query.strip()[:100]
if len(search_query.strip()) > 100:
logger.debug(
f"Truncated search query from {len(search_query)} to 100 chars: "
f"{truncated_search}..."
)
search_term = search_query.strip() if search_query else None
if search_term and len(search_term) > 100:
raise ValueError(
f"Search query is too long ({len(search_term)} chars, max 100). "
f"Please use a shorter, more specific search term."
)
try:
response = await library_db().list_library_agents(
user_id=user_id,
search_term=truncated_search,
search_term=search_term,
page=1,
page_size=max_results,
include_executions=True,
@@ -312,17 +309,16 @@ async def search_marketplace_agents_for_generation(
Returns:
List of LibraryAgentSummary with full input/output schemas
"""
# Truncate search query to avoid potential issues with very long queries
truncated_search = search_query.strip()[:100]
if len(search_query.strip()) > 100:
logger.debug(
f"Truncated marketplace search query from {len(search_query)} to 100 chars: "
f"{truncated_search}..."
search_term = search_query.strip()
if len(search_term) > 100:
raise ValueError(
f"Search query is too long ({len(search_term)} chars, max 100). "
f"Please use a shorter, more specific search term."
)
try:
response = await store_db().get_store_agents(
search_query=truncated_search,
search_query=search_term,
page=1,
page_size=max_results,
)