Skip to content

Enforce agent status before allowing chat #852

@chubes4

Description

@chubes4

Summary

The status field on datamachine_agents supports active, inactive, and archived states, but nothing checks this before allowing a chat session. An inactive or archived agent can still chat.

Current Behavior

ChatOrchestrator::createSession() resolves the agent via datamachine_resolve_or_create_agent_id() and proceeds regardless of the agent's status field. The status column exists in the schema but is never checked in the chat flow.

Proposed Fix

Check agent status in ChatOrchestrator before creating or continuing a session:

  • active → proceed normally
  • inactive → reject with appropriate error ("Your chat agent is currently disabled")
  • archived → reject with appropriate error ("This agent has been archived")

This gives site admins a kill switch for individual agents without deleting them, and is a prerequisite for any moderation system where a misbehaving agent needs to be disabled.

Related

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