Skip to content

Interactive fix-confirmation prompt doesn't render under default (fancy) progress mode #345

Description

@rubberduck203

Summary

doctor run --fix=true prompts for confirmation before running a fix (prompt_user in src/doctor/runner.rs:380-392). In the default progress mode (the tracing_indicatif spinner UI), that prompt doesn't visibly render in a real terminal — it appears to hang. Switching to --progress plain makes the prompt show up immediately and work correctly.

The prompt code already wraps itself in tracing_indicatif::suspend_tracing_indicatif specifically to pause the spinner while inquire reads input:

// src/doctor/runner.rs:380-392
fn prompt_user(prompt_text: &str, maybe_help_text: &Option<String>) -> bool {
    tracing_indicatif::suspend_tracing_indicatif(|| {
        let prompt = {
            let base_prompt = inquire::Confirm::new(prompt_text).with_default(false);
            match maybe_help_text {
                Some(help_text) => base_prompt.with_help_message(help_text),
                None => base_prompt,
            }
        };

        prompt.prompt().unwrap_or(false)
    })
}

That suspend doesn't fully prevent the spinner from stomping on the prompt render — this predates today's work (confirmed via git blame, unrelated to #341/#342/#343 merged earlier today) and isn't a regression, but it's a real, reproducible UX bug in a real interactive terminal.

Reproduction (MVCE)

mkdir -p /tmp/scope-prompt-hang/.scope
cat > /tmp/scope-prompt-hang/.scope/group.yaml <<'YAML'
apiVersion: scope.github.com/v1alpha
kind: ScopeDoctorGroup
metadata:
  name: prompt-hang-repro
spec:
  actions:
    - name: needs-file
      check: { commands: ["test -f needed.txt"] }
      fix:
        prompt:
          text: "Create needed.txt?"
        commands:
          - "touch needed.txt"
YAML

cd /tmp/scope-prompt-hang
scope doctor run --fix=true --no-cache

Run this from a real interactive terminal (not piped, --yolo not set).

Expected: the "Create needed.txt? (y/n)" prompt renders immediately and accepts input.

Actual: nothing visibly renders — the terminal appears to hang. Adding --progress plain:

scope doctor run --fix=true --no-cache --progress plain

...makes the same prompt render and behave correctly right away.

Suggested fix

Investigate why suspend_tracing_indicatif isn't fully suppressing the spinner's terminal writes during the inquire prompt in fancy-progress mode — possibly a race between the spinner's redraw tick and inquire taking over the terminal, or an interaction with the IndicatifWriter used for stdout/stderr (src/shared/logging.rs:340-346).

🤖 Generated with Claude Code

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