refactor: remove wait_seconds from get_user_request tool
Wait time is now fully server-controlled via default_wait_seconds setting. Agents can no longer request a different wait duration - only the user controls this via the web UI. - Remove wait_seconds param from get_user_request signature - Simplify actual_wait to min(cfg.default_wait_seconds, MAX_WAIT) - Update Settings panel label from 'Min Wait' to 'Wait (sec)' - Update hint text to explain server-only control - Update README: input schema, behavior rules, settings description, changelog
This commit is contained in:
@@ -42,21 +42,16 @@ _agent_generations: dict[str, int] = {}
|
||||
@mcp.tool()
|
||||
async def get_user_request(
|
||||
agent_id: str = "unknown",
|
||||
wait_seconds: Optional[int] = None,
|
||||
default_response_override: Optional[str] = None,
|
||||
) -> dict:
|
||||
"""
|
||||
Fetch the next pending user instruction from the queue.
|
||||
|
||||
The server enforces a minimum wait time (configurable via the web UI).
|
||||
The agent may request a longer wait via `wait_seconds`, but cannot go
|
||||
below that minimum — this prevents busy-polling when the queue is empty.
|
||||
actual_wait = max(wait_seconds or 0, server_min_wait_seconds).
|
||||
If no instruction is available the tool will wait up to `wait_seconds`
|
||||
(or the server-configured default) before returning an empty / default response.
|
||||
|
||||
Args:
|
||||
agent_id: An identifier for this agent instance (used to track connectivity).
|
||||
wait_seconds: Desired wait when queue is empty. Actual wait is
|
||||
max(this, server minimum). Omit to use server minimum only.
|
||||
default_response_override: Override the server-default empty response text
|
||||
for this single call.
|
||||
|
||||
@@ -66,12 +61,8 @@ async def get_user_request(
|
||||
"""
|
||||
cfg = config_service.get_config()
|
||||
|
||||
# default_wait_seconds is the server-enforced MINIMUM wait time.
|
||||
client_requested = wait_seconds if wait_seconds is not None else 0
|
||||
actual_wait = min(
|
||||
max(client_requested, cfg.default_wait_seconds), # enforce floor
|
||||
_MAX_WAIT_SECONDS,
|
||||
)
|
||||
# Wait time is entirely server-controlled — the user sets it via the web UI.
|
||||
actual_wait = min(cfg.default_wait_seconds, _MAX_WAIT_SECONDS)
|
||||
|
||||
# Register this call as the newest for this agent. Any older coroutines
|
||||
# still lingering (e.g. client timed-out and retried) will see a stale
|
||||
|
||||
Reference in New Issue
Block a user