Skip to content

Add a non-interactive flag to brev delete to skip the confirmation prompt #388

@robobryce

Description

@robobryce

Summary

brev delete <instance> prompts for confirmation when the target instance exists, and there is no documented flag to skip the prompt. brev delete --help lists only global flags (--help, --no-check-latest, --user, --version); there is no --yes / --force / --non-interactive / --skip-confirmation. This makes the command unsafe to call from scripts or agent harnesses that delete test instances as part of automated teardown.

Reproduction

$ brev delete --help
…
SYNOPSIS

    brev delete [ Workspace Name or ID... ]
…
Global Flags:
  -h, --help              Help for Brev
      --no-check-latest   Do not check for the latest version when printing version
      --user string       Non root user to use for per user configuration of commands run as root
      --version           Print version output

No command-specific flags. When the command runs against an existing instance with an open-but-non-TTY stdin (e.g. a pipe / unix socket from a parent process / a subprocess invocation that didn't close fd 0), brev blocks on a read(2) waiting for confirmation that never arrives:

$ sudo cat /proc/<brev-pid>/stack
[<0>] unix_stream_data_wait+0x121/0x1b0
[<0>] unix_stream_read_generic+0x345/0xae0
[<0>] unix_stream_recvmsg+0x8d/0xa0
[<0>] sock_recvmsg+0xde/0xf0
[<0>] sock_read_iter+0x8f/0x100
[<0>] vfs_read+0x36a/0x3a0

We observed three separate agent-driven session wedges in a single day, each lasting hours, all caused by brev delete <existing-test-manager> blocking on a confirmation read inside an automated teardown script.

The only workarounds we found are non-obvious:

  • brev delete X </dev/null — close stdin so the read returns EOF.
  • yes | brev delete X — feed an infinite stream of y.

Neither is documented as the official non-interactive pattern. The Examples block in brev delete --help does mention echo instance-name | brev delete, but that's for piping the name, not the confirmation answer, and it doesn't address the prompt at all.

What we'd like

A documented, command-specific flag to skip the confirmation prompt, in line with conventions in other CLIs:

  • brev delete --yes <instance> (preferred — matches apt-get -y, dnf -y, gh repo delete --yes)
  • or --force (matches kubectl delete --force, though --force is overloaded)
  • or --non-interactive / --no-confirm

The flag should:

  1. Skip the confirmation prompt.
  2. Not change any other delete semantics — same eventual API call, same brev ls post-state.
  3. Behave identically whether stdin is a TTY, a pipe, a unix socket, or /dev/null — i.e. confirmation reading is conditional on the flag, not on TTY detection.

Documentation patch: add the flag to brev delete --help and to the Examples section showing how to script a teardown safely.

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