Skip to content

docs/API.md Execute AI Run curl example omits required providerId, causing HTTP 400 on invocation #6030

Description

@atomantic

Problem

In docs/API.md:858-864, the documentation provides a curl example for executing an AI run via POST /api/runs:

curl -X POST http://localhost:5555/api/runs \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "List all files in the current directory",
    "workspacePath": "/path/to/workspace"
  }'

However, server/lib/aiToolkit/routes/runs.js:34-36 enforces:

if (!providerId) {
  throw new ServerError('providerId is required', { status: 400 });
}

Because providerId is omitted in the documentation snippet, the request is rejected immediately.

Trigger

A developer or API consumer copying the example request directly from docs/API.md and pasting it into a terminal against a running PortOS instance.

Impact

The server responds with HTTP 400 ({"error": "providerId is required", ...}). A developer following the documentation cannot successfully execute an AI run via curl without reading server route source code to diagnose the missing parameter.

Fix

  1. Update docs/API.md lines 858-864 to include "providerId": "claude" (or <provider-id>) in the JSON payload.
  2. Ensure the curl snippet documents the standard minimal fields (providerId, prompt, workspacePath).
  3. Verify that server/lib/aiToolkit/routes/runs.test.js covers route validation for this shape.

Alternative rejected: Making providerId optional with a fallback default in routes/runs.js — rejected because provider selection must remain explicit across multi-provider environments to avoid unintended token/quota expenditure.

Acceptance Criteria

  • docs/API.md example for POST /api/runs includes providerId in its request body.
  • Executing the documented curl snippet against a running server with a valid provider ID passes route validation.
  • server/lib/aiToolkit/routes/runs.test.js passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationeffort:lowEffort: lowmodel:lightModel size: lightplanTracked by /do:replanplanner:gemini-3-7-flashPlan authored by the gemini-3-7-flash model

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions