fix(tui): emit subagent completion before terminal update#2120
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for a base_url configuration setting, allowing users to specify custom DeepSeek-compatible endpoints through the TUI and CLI. It also addresses a race condition in subagent task completion (Issue #1961) by reordering logic to emit parent completions before updating the manager's terminal state. Review feedback indicates that persist_status_items and network policy commands are currently hardcoded to use the default configuration path, suggesting they should be updated to respect custom configuration paths provided via the application state.
| use std::fs; | ||
|
|
||
| let path = config_toml_path()?; | ||
| let path = config_toml_path(None)?; |
There was a problem hiding this comment.
persist_status_items is hardcoded to use the default configuration path (None). This ignores any custom configuration path provided via the --config CLI flag or the DEEPSEEK_CONFIG_PATH environment variable. This function should be updated to accept an optional path parameter, and its callers (such as in config_ui.rs) should pass app.config_path.as_deref() to ensure consistency.
|
|
||
| fn list_policy() -> anyhow::Result<String> { | ||
| let path = super::config::config_toml_path()?; | ||
| let path = super::config::config_toml_path(None)?; |
There was a problem hiding this comment.
The network policy commands are hardcoded to use the default configuration path by passing None to config_toml_path. This causes the application to read from and write to the default ~/.deepseek/config.toml even if a custom configuration file was specified at startup. These functions should be updated to respect the active configuration path from the App state.
e75c1b9 to
d4e75b3
Compare
d4e75b3 to
134d89f
Compare
Closes #1961
Summary
Fixes a race where
<codewhale:subagent.done>completion events could be emitted after the parent turn had already proceeded to terminal update/summarization, making the assistant appear to remain active after it should have finished.This change reorders emission so parent sub-agent completion is sent before the terminal update path executes, so completion is recorded in transcript in the expected sequence.
Changed files
crates/tui/src/tools/subagent/mod.rscrates/tui/src/tools/subagent/tests.rsVerification
cargo fmt --all -- --checkcargo test -p deepseek-tui run_subagent_task_emits_parent_completion_before_terminal_updatecargo test -p deepseek-tui emit_parent_completion_fires_for_direct_child -- --nocapturecargo test -p deepseek-tui emit_parent_completion_skips_grandchildren -- --nocapturecargo test -p deepseek-tui turn_holds_open_for_running_or_completed_subagents -- --nocapturegit diff --check