Skip to content

fix(tui): honour DEEPSEEK_YOLO env on TUI startup#1870

Closed
victorcheng2333 wants to merge 1 commit into
Hmbown:mainfrom
victorcheng2333:fix/yolo-env-respected-on-startup
Closed

fix(tui): honour DEEPSEEK_YOLO env on TUI startup#1870
victorcheng2333 wants to merge 1 commit into
Hmbown:mainfrom
victorcheng2333:fix/yolo-env-respected-on-startup

Conversation

@victorcheng2333
Copy link
Copy Markdown
Contributor

Summary

  • deepseek --yolo did not start the TUI in YOLO mode. The deepseek launcher (crates/cli/src/lib.rs:1479-1481) forwards --yolo to the child deepseek-tui binary via the DEEPSEEK_YOLO=true env var, not as a CLI flag.
  • The TUI's config loader (crates/tui/src/config.rs:2544-2546) already folds that env var into config.yolo: Option<bool>, but run_interactive and the exec subcommand handler in crates/tui/src/main.rs only consulted cli.yolo, so the env-derived value was loaded and then silently dropped.
  • Net effect: deepseek --yolo opened a plain Agent-mode session instead of YOLO (shell + trust + auto-approve).

Fix

Derive let yolo = cli.yolo || config.yolo.unwrap_or(false); at both call sites and route it into TuiOptions (start_in_agent_mode, allow_shell, yolo) and run_exec_agent (auto_mode, needs_engine). No other behaviour change — when neither source sets YOLO, cli.yolo remains the deciding flag exactly as before.

Test plan

  • cargo check -p deepseek-tui (passes)
  • cargo test -p deepseek-tui --bin deepseek-tui -- yolo — 10 yolo-tagged tests pass, including test_trust_mode_follows_yolo_on_startup, leaving_yolo_after_startup_restores_baseline_policies, set_mode_yolo_restores_previous_policies_on_exit, agent_and_yolo_modes_elevate_shell_sandbox_to_allow_network, model_tool_catalog_keeps_everything_loaded_in_yolo_mode.
  • Manual: replaced the deepseek-tui binary in a local npm install with the patched release build, ran deepseek --yolo in a real tty, footer reports yolo (red) and tool approvals are auto-granted.

Notes

The downstream wiring in App::new (crates/tui/src/tui/app.rs around initial_mode = if yolo { AppMode::Yolo } …) is unchanged — it already correctly sets trust_mode, allow_shell, approval_mode = Auto, and mode = AppMode::Yolo whenever TuiOptions::yolo is true. The bug was purely in the env→options handoff.

The `deepseek` launcher binary forwards `--yolo` to the `deepseek-tui`
child via the `DEEPSEEK_YOLO=true` env var (see crates/cli/src/lib.rs),
not as a CLI flag. The TUI's config loader already folds that env var
into `config.yolo`, but `run_interactive` and the `exec` subcommand
handler only consulted `cli.yolo`, so the env-derived value was loaded
and then silently dropped. The net effect: `deepseek --yolo` started a
plain Agent-mode session instead of YOLO.

Derive an effective `yolo = cli.yolo || config.yolo.unwrap_or(false)` at
both call sites and route it into `TuiOptions` and `run_exec_agent`.
Existing unit tests (`test_trust_mode_follows_yolo_on_startup`,
`leaving_yolo_after_startup_restores_baseline_policies`, etc.) continue
to cover the downstream wiring once `yolo: true` reaches `App::new`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the TUI to honor the YOLO mode setting from both the CLI flag and the configuration (which may be populated via environment variables). This ensures consistent behavior when the application is launched through different wrappers like the deepseek launcher. I have no feedback to provide as there were no review comments to evaluate.

@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 26, 2026

Harvested in build/v0.8.47 (commit 236ad41). Thank you! Added to CHANGELOG.

@Hmbown Hmbown closed this May 26, 2026
Hmbown added a commit that referenced this pull request May 26, 2026
Harvested and vetted — no malware, no external deps, no injection:
- #1859 (@harvey2011888): loop guard now reports Failed on halt
- #1870 (@victorcheng2333): honour DEEPSEEK_YOLO env on startup
- #1935 (@IIzzaya): replace [x] with [✓] completion markers
- #1837 (@PurplePulse): fix macOS title centering (pin to top)
- #1967 (@cyq1017): show base_url in /config view
- #1906 (@knqiufan): copy transcript without visual-wrap newlines

Also fix cycle_manager archive_dir_for to use resolve_state_dir
so recall_archive tests pass with the migrated sessions path.

Co-authored-by: victorcheng2333 <victorcheng2333@users.noreply.github.com>
Co-authored-by: IIzzaya <IIzzaya@users.noreply.github.com>
Co-authored-by: PurplePulse <PurplePulse@users.noreply.github.com>
Co-authored-by: cyq1017 <cyq1017@users.noreply.github.com>
Co-authored-by: knqiufan <knqiufan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants