Skip to content

argo watch (and other long-running CLI commands) cannot be cancelled with Ctrl+C #15863

@ciiiii

Description

@ciiiii

Pre-requisites

  • I have double-checked my configuration
  • I have tested with the :latest image tag (i.e. quay.io/argoproj/workflow-controller:latest) and can confirm the issue still exists on :latest. If not, I have explained why, in detail, in my description below.
  • I have searched existing issues and could not find a match for this bug
  • I'd like to contribute the fix myself (see contributing guide)

What happened? What did you expect to happen?

argo watch cannot be cancelled with Ctrl+C (SIGINT). The process silently swallows the signal and continues running.

Root cause: initSignalHandlers() in util/logging/init.go calls signal.Notify(c, os.Interrupt, syscall.SIGTERM) which overrides Go's default SIGINT handler.
However, after consuming the signal and emitting init logs, the goroutine simply returns without calling os.Exit() or restoring default signal behavior. This
means:

  1. The first Ctrl+C is consumed but the process doesn't terminate.
  2. Subsequent Ctrl+C signals are delivered to the channel but nobody reads them — they are silently dropped.

Additionally, the context passed to the watch loop is created from context.Background() (via ContextWithLogger), so it has no signal-based cancellation. The case
<-ctx.Done() branch in the watch loop never fires on Ctrl+C.

Expected behavior: Ctrl+C should gracefully cancel argo watch and return the user to their shell.

This also affects other long-running CLI commands like argo wait and argo logs --follow.

Version(s)

9c77acc

Paste a minimal workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflow that uses private images.

# Any workflow — the bug is in the CLI, not the workflow.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-
spec:
  entrypoint: main
  templates:
    - name: main
      container:
        image: argoproj/argosay:v2
        command: [cowsay]


Steps to reproduce:
1. argo submit --watch or argo watch <workflow-name>
2. Press Ctrl+C while the workflow is still running
3. Observe the CLI does not exit

Logs from the workflow controller

N/A — CLI-side bug

Logs from in your workflow's wait container

N/A — CLI-side bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions