fix(tui): route owner activity through app server

This commit is contained in:
dank-openai
2026-05-02 12:29:29 -04:00
parent 82005dc1a2
commit b3f85c0969
2 changed files with 33 additions and 1 deletions

View File

@@ -5123,6 +5123,26 @@ async fn interrupt_without_active_turn_is_treated_as_handled() {
assert_eq!(handled, true);
}
#[tokio::test]
async fn owner_activity_is_routed_to_app_server() {
let mut app = make_test_app().await;
let mut app_server = crate::start_embedded_app_server_for_picker(app.chat_widget.config_ref())
.await
.expect("embedded app server");
let op = AppCommand::note_owner_activity();
let err = app
.try_submit_active_thread_op_via_app_server(&mut app_server, ThreadId::new(), &op)
.await
.expect_err("missing thread should fail after routing owner activity to app-server");
assert!(
err.to_string()
.contains("thread/inputActivity failed in TUI"),
"owner activity should reach the app-server path: {err:#}"
);
}
#[tokio::test]
async fn clear_only_ui_reset_preserves_chat_session_state() {
let mut app = make_test_app().await;

View File

@@ -526,6 +526,10 @@ impl App {
}
Ok(true)
}
AppCommandView::NoteOwnerActivity => {
app_server.thread_input_activity(thread_id).await?;
Ok(true)
}
AppCommandView::UserTurn {
items,
cwd,
@@ -715,7 +719,15 @@ impl App {
.await?;
Ok(true)
}
_ => Ok(false),
AppCommandView::ExecApproval { .. }
| AppCommandView::PatchApproval { .. }
| AppCommandView::ResolveElicitation { .. }
| AppCommandView::UserInputAnswer { .. }
| AppCommandView::RequestPermissionsResponse { .. }
| AppCommandView::Shutdown
| AppCommandView::Other(Op::AddToHistory { .. })
| AppCommandView::Other(Op::GetHistoryEntryRequest { .. })
| AppCommandView::Other(_) => Ok(false),
}
}