Hardcode Python default empty response

This commit is contained in:
Brandon Zhang
2026-03-27 17:54:38 +08:00
parent 8a0dffbcae
commit 372e30ff6f
5 changed files with 22 additions and 25 deletions

View File

@@ -13,7 +13,7 @@ from typing import Optional
from mcp.server.fastmcp import FastMCP, Context
from app.config import settings
from app.config import DEFAULT_EMPTY_RESPONSE, settings
from app.services import config_service, event_service, instruction_service, status_service
logger = logging.getLogger(__name__)
@@ -38,9 +38,6 @@ _MAX_WAIT_SECONDS = 86400 # 24 hours
# multiple keepalive progress updates.
DEFAULT_WAIT_SECONDS = 50
# Default response when queue is empty after waiting
DEFAULT_EMPTY_RESPONSE = "call this tool `get_user_request` again to fetch latest user input..."
# Per-agent generation counter — incremented on every new call.
# The wait loop only consumes an instruction when it holds the latest generation,
# preventing abandoned (timed-out) coroutines from silently consuming queue items.
@@ -65,7 +62,6 @@ KEEPALIVE_INTERVAL_SECONDS: float = 5.0
@mcp.tool()
async def get_user_request(
agent_id: str = "unknown",
default_response_override: Optional[str] = None,
ctx: Optional[Context] = None,
) -> dict:
"""
@@ -76,8 +72,6 @@ async def get_user_request(
Args:
agent_id: An identifier for this agent instance (used to track connectivity).
default_response_override: Override the server-default empty response text
for this single call.
Returns:
A dict with keys: status, result_type, instruction, response,
@@ -222,11 +216,7 @@ async def get_user_request(
status_service.record_agent_activity(agent_id, "empty")
event_service.broadcast("status.changed", {})
empty_response = (
default_response_override
if default_response_override is not None
else DEFAULT_EMPTY_RESPONSE
)
empty_response = DEFAULT_EMPTY_RESPONSE
result_type = "default_response" if empty_response else "empty"
if _i_am_active():