Skip to content

Studio chat: classify destructive tool approvals by name tokens, not word boundaries #2224

Closed

Description

@peppescg

Parent: #2210. Surfaced by #2212.

Problem

The chat approval card picks its destructive (red) versus warning (amber) treatment from the tool name, using a word-boundary regex:

// apps/web/src/features/chat/approval-panel.tsx:10
const destructiveTool = /\b(delete|remove|drop|revoke|destroy|purge|rm)\b/iu;

\b doesn't separate words inside camelCase or snake_case names, so tools such as DeleteFile, delete_file, removeBranch or drop_table don't match and get the warning treatment. The bug predates #2212. It became visible once #2212 coloured badge ink, because the badge now reads amber where it should read red.

Scope

  1. Classify by name tokens, not raw word boundaries: split on case changes, _, -, . and /, then match any token against the destructive verbs.
  2. If the daemon's permission ask carries a structured risk or kind signal (check permission.ask events and the approval payload in the SDK), prefer it over name heuristics and keep the name check as the fallback. Record what you find.
  3. Check the prototype's approval card (stacklok/mecatl-prototypes stack/08-tooling, features/chat/) and match its classification and treatment, in line with Studio: align the UI with the design prototype (prototype is the UI source of truth) #2210.
  4. Unit tests: DeleteFile, delete_file, delete-file, fs.delete, RemoveBranch, drop_table are destructive; Read, Edit, deleted_items_report (a read that only mentions "deleted") and Bash are not, unless the structured signal says otherwise.

Acceptance

Activity

  1. added
    enhancement
    WebUI
    on Oct 9, 2026
  2. added 20 commits that reference this issue on Oct 9, 2026
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

    WebUIenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions