Save subagent and memory opt-ins through the app server (#43113)

## What changed

Route the TUI's subagent and memory enable prompts through server config writes for new threads, leaving the current thread unchanged. Report success, configuration overrides, or failures after the write completes, and clarify the scope in the prompts.

Write both `features.memories` and the legacy `features.memory_tool` key for compatibility with older app servers.

## Testing

Extend tests to cover writes to the selected server config, preservation of current settings, legacy memory key updates, and managed configuration overrides. Update prompt snapshots and verify that confirmation emits the new save event.

GitOrigin-RevId: ec331db675b38102851899a4aa878d6fe8e9606e
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-05 22:16:26 +00:00
1 parent a31c18ab7a
commit fc748ab8d5
14 files changed
+184 -149

No files matched your search

+3 -19
View File
@@ -2654,7 +2654,7 @@ async fn select_uncached_agent_thread_still_refreshes_liveness() -> Result<()> {
}
#[tokio::test]
async fn open_agent_picker_prompts_to_enable_multi_agent_when_disabled() -> Result<()> {
async fn open_agent_picker_prompts_when_subagents_disabled() -> Result<()> {
let (mut app, mut app_event_rx, _op_rx) = Box::pin(make_test_app_with_channels()).await;
let mut app_server = Box::pin(crate::start_embedded_app_server_for_picker(
app.chat_widget.config_ref(),
@@ -2664,24 +2664,8 @@ async fn open_agent_picker_prompts_to_enable_multi_agent_when_disabled() -> Resu
let _ = app.config.features.disable(Feature::Collab);
Box::pin(app.open_agent_picker(&mut app_server)).await;
app.chat_widget
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
assert_matches!(
app_event_rx.try_recv(),
Ok(AppEvent::UpdateFeatureFlags { updates }) if updates == vec![(Feature::Collab, true)]
);
let cell = match app_event_rx.try_recv() {
Ok(AppEvent::InsertHistoryCell(cell)) => cell,
other => panic!("expected InsertHistoryCell event, got {other:?}"),
};
let rendered = cell
.display_lines(/*width*/ 120)
.into_iter()
.map(|line| line.to_string())
.collect::<Vec<_>>()
.join("\n");
assert!(rendered.contains("Subagents will be enabled in the next session."));
assert!(app.chat_widget.has_active_view());
assert!(app_event_rx.try_recv().is_err());
Ok(())
}