Skip to content

Operator API hardening: error mapping and input validation (QA panel on #3970) #3973

Description

@mabry1985

The QA panel flagged these on #3970. They're in operator routes that existed before that PR, so they were left out of it. Re-check each against current main before fixing.

Error mapping

  • operator_api/routes.py:~135: _http_error returns str(exc) as the 500 detail, leaking internal file paths and library internals to the client. Log the exception and return a generic message.
  • No not-found mapping, so these return 500 instead of 404:
    • DELETE and PUT /api/scheduler/jobs/{id} for a missing job
    • the task close route for a missing issue
  • _runtime_status and _goal_status have no try/except guard, unlike their sibling routes.
  • POST /api/chat has no structured mapping for chat() failures. /v1 maps the same failures to 429, 502 and so on.

Availability

  • operator_api/routes.py:~119: the SSE event stream ends on a single malformed bus event, because per-event key access and json.dumps aren't guarded.

Input validation

  • SubagentBatchRequest.tasks has no upper bound.
  • GET /api/background?status=: the value isn't checked against the documented 3-value enum.
  • POST /api/goals takes a bare dict instead of a Pydantic model.
  • graph/goals/controller.py:~419: max_iterations and no_progress_limit from a JSON goal spec aren't type-checked, so a string such as "abc" is accepted.
  • ScheduleAddRequest.schedule and .timezone aren't format-checked at the route. The scheduler now normalises errors to 400 (fix: settle ledger on restart reconcile, ValueError for bad schedules, watch clear race, partial scheduler PUT (#3943) #3969), but checking at the route would be clearer.

Nit

  • graph/checkpoint_prune.py:~97: the LIKE pattern in the delete_thread cascade doesn't escape % or _ in thread_id.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-infoIssue is missing required sections — see CONTRIBUTING.md (silent issue gate).

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions