Skip to content

Bot creation is not validated against installed agents server-side #21

Open

Description

@anildukkipatty

What happens

handleBotRoutes never receives availableAgents (src/server.ts:70 passes only workspaceCwd). The agent field is validated for shape only — isBotAgent at src/bot-routes.ts:62, :105, :141 — never for availability.

Confirmed against a server with zero agents installed:

POST /bots {"name":"Ghost","agent":"claude-code","instructions":"test"}
-> 200 {"bot":{...,"agent":"claude-code"}}

The bot persists and is unrunnable. Only the client gates this (bot-form.tsx:504 for new bots, marketplace-bot-details.tsx:146-148 on import), so any API consumer bypasses it.

The runtime guards do work — POST /chat rejects with a clear message (src/server.ts:252-257, :299-302) — so this is a data-hygiene problem, not a crash.

Open design question (why this was deferred)

Should an unavailable agent be rejected or saved with a warning? Rejecting breaks a legitimate flow: importing a shared bot now, intending to install its agent later. A warning keeps that flow but leaves an unrunnable bot in the list.

Worth deciding deliberately rather than defaulting to a 400.

Related

Editing an existing bot is deliberately not gated on availability (bot-form.tsx:504 guards only !editing), which is what lets a user fix a bot whose agent is missing. Any change here must preserve that escape hatch.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions