Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(api): return empty Response for scheduled-runs DELETE 204

Ofek Shakedc8688f56e7f3
diff --git a/agent/src/api/scheduled_routes.py b/agent/src/api/scheduled_routes.py
index 61badb9b0..ee9306b9f 100644
--- a/agent/src/api/scheduled_routes.py
+++ b/agent/src/api/scheduled_routes.py
@@ -14,6 +14,7 @@ from typing import Any, Awaitable, Callable, Dict, List, Optional
from fastapi import Depends, FastAPI, HTTPException, Query, status
from pydantic import BaseModel, Field
+from starlette.responses import Response
from src.config.accessor import get_env_config
@@ -353,7 +354,7 @@ def register_scheduled_routes(
status_code=status.HTTP_204_NO_CONTENT,
dependencies=[Depends(require_auth)],
)
- async def delete_scheduled_run(job_id: str) -> None:
+ async def delete_scheduled_run(job_id: str) -> Response:
"""Cancel (delete) a scheduled research job by id."""
_host_validate_path_param(job_id, "job_id")
removed = _get_scheduled_research_store().delete(job_id)
@@ -361,6 +362,7 @@ def register_scheduled_routes(
raise HTTPException(
status_code=404, detail=f"scheduled run {job_id} not found"
)
+ return Response(status_code=status.HTTP_204_NO_CONTENT)
# --- Playbook templates ---
#
diff --git a/agent/tests/test_scheduled_routes.py b/agent/tests/test_scheduled_routes.py
index 20f282d87..6131dfa79 100644
--- a/agent/tests/test_scheduled_routes.py
+++ b/agent/tests/test_scheduled_routes.py
@@ -174,6 +174,7 @@ def test_delete_removes_job_and_returns_204(
assert response.status_code == 204
assert not response.content
+ assert "content-type" not in response.headers
assert store.get("cancel-me") is None