{"record":{"id":"a28b02da37eb63d2","repo":"astrid-runtime/astrid","slug":"headless-approval-automation-is-unsupported-appro","errorCode":null,"errorMessage":"headless approval automation is unsupported: approvals cannot be correlated to this run; remove --yes, --yolo, or --autonomous","messagePattern":"headless approval automation is unsupported: approvals cannot be correlated to this run; remove --yes, --yolo, or --autonomous","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/dispatch.rs","lineNumber":105,"sourceCode":"        std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin_text)?;\n        if !stdin_text.is_empty() {\n            commands::headless::run_headless(\n                stdin_text,\n                output_format,\n                cli.session_name,\n                cli.print_session,\n            )\n            .await?;\n            return Ok(ExitCode::SUCCESS);\n        }\n    }\n\n    dispatch_subcommand(cli.command, output_format).await\n}\n\nfn ensure_headless_auto_approve_rejected(auto_approve: bool, headless_route: bool) -> Result<()> {\n    if auto_approve && headless_route {\n        anyhow::bail!(headless::AUTO_APPROVE_UNSUPPORTED_MESSAGE);\n    }\n    Ok(())\n}\n\nfn should_check_for_update(cli: &Cli) -> bool {\n    cli.prompt.is_none()\n        && !matches!(\n            cli.command,\n            Some(\n                Commands::Update(_)\n                    | Commands::Hook(_)\n                    | Commands::Completions(_)\n                    | Commands::Mcp { .. }\n                    | Commands::Init { offline: true, .. }\n                    | Commands::Distro {\n                        command: DistroCommands::Apply { offline: true, .. }\n                    }\n            )","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/dispatch.rs#L87-L123","documentation":"`ensure_headless_auto_approve_rejected` fails closed when a CLI invocation both requests automatic approval (`--yes`, `--yolo`, or `--autonomous`) and runs through a headless route. The guard exists because in headless mode approvals cannot be correlated to the originating run, so auto-approving is unsafe and unsupported.","triggerScenarios":"Invoking a run subcommand with any auto-approve flag set while the dispatch is on a headless route, e.g. `astrid --yes run ...` in a non-interactive/headless context.","commonSituations":"CI pipelines or scripts copying interactive flags into non-interactive invocations; users automating runs with `--yolo` after switching from a TTY to headless execution.","solutions":["Remove the `--yes`, `--yolo`, or `--autonomous` flag from the headless invocation.","Run the command interactively if auto-approval is genuinely required.","Use an explicit, auditable approval mechanism appropriate for headless runs instead of blanket auto-approve flags."],"exampleFix":"// before\nastrid --yolo run capsule:build\n// after\nastrid run capsule:build","handlingStrategy":"validation","validationCode":"const AUTO_APPROVE_FLAGS: [&str; 3] = [\"--yes\", \"--yolo\", \"--autonomous\"];\nif is_headless_environment() && AUTO_APPROVE_FLAGS.iter().any(|f| std::env::args().any(|a| a == *f)) {\n    return Err(\"auto-approve flags are unsupported in headless runs\".into());\n}","typeGuard":"fn headless_with_auto_approve(cli: &Cli, headless_route: bool) -> bool {\n    cli.auto_approve && headless_route\n}","tryCatchPattern":"if let Err(e) = astrid::run(cli) {\n    if e.to_string().contains(\"headless approval automation is unsupported\") {\n        eprintln!(\"re-run without --yes/--yolo/--autonomous\");\n        std::process::exit(2);\n    }\n    return Err(e);\n}","preventionTips":["Keep CI/headless invocation templates free of --yes/--yolo/--autonomous flags.","Gate auto-approve flags behind interactive-only wrappers.","Review shared scripts when moving workloads from TTY to headless execution."],"tags":["cli","headless","approval"],"backgroundTag":"conflicting-config-options","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}