mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Stop TUI chats on misalignment policy violations (#39261)
## Why When the app server reports a misalignment policy violation, the TUI must stop the affected chat rather than allow more work to continue in it. ## What changed - Finalize the active turn, clear queued and draft input, disable the composer, and reject further operations and interactive requests for the stopped chat. - Interrupt an active side conversation when its parent reports the violation, and prevent queued turns, forks, approvals, or goal resumption from restarting work. - Show a non-dismissible precaution view that directs users to start a new chat or resume another one, with agent command center navigation for remote sessions. ## Testing Added coverage for stopped-chat behavior, parent/side-thread handling, blocked goal resumption, navigation actions, and narrow and remote-session rendering. GitOrigin-RevId: 0268c46a19294a17765ea4099f389f15ffaaf030
This commit is contained in:
1 parent
3006151ad4
commit
785ecd7452
16 files changed
+452
-3
No files matched your search
@@ -13,6 +13,7 @@ use crate::config_update::format_config_error;
|
||||
use crate::external_agent_config_migration::flow::ExternalAgentConfigMigrationFlowOutcome;
|
||||
use crate::pager_overlay::TranscriptHistoryState;
|
||||
use crate::session_resume::cwds_differ;
|
||||
use codex_app_server_protocol::ThreadGoalStatus;
|
||||
#[cfg(target_os = "windows")]
|
||||
use codex_config::types::WindowsSandboxModeToml;
|
||||
|
||||
@@ -25,6 +26,24 @@ impl App {
|
||||
app_server: &mut AppServerSession,
|
||||
event: AppEvent,
|
||||
) -> Result<AppRunControl> {
|
||||
if self.chat_widget.has_misalignment_policy_violation()
|
||||
&& matches!(
|
||||
event,
|
||||
AppEvent::OpenAgentPicker
|
||||
| AppEvent::SelectAgentThread(_)
|
||||
| AppEvent::StartSide { .. }
|
||||
| AppEvent::ForkCurrentSession { .. }
|
||||
| AppEvent::ForkSessionForPromptEdit { .. }
|
||||
| AppEvent::SetThreadGoalDraft { .. }
|
||||
| AppEvent::SetThreadGoalStatus {
|
||||
status: ThreadGoalStatus::Active,
|
||||
..
|
||||
}
|
||||
)
|
||||
{
|
||||
return Ok(AppRunControl::Continue);
|
||||
}
|
||||
|
||||
match event {
|
||||
AppEvent::SkillsListLoaded { ref cwd, .. }
|
||||
| AppEvent::PluginMentionsLoaded { ref cwd, .. }
|
||||
@@ -35,6 +54,9 @@ impl App {
|
||||
/*initial_user_message*/ None, name,
|
||||
)
|
||||
.await;
|
||||
if self.chat_widget.has_misalignment_policy_violation() {
|
||||
self.chat_widget.show_misalignment_policy_precaution();
|
||||
}
|
||||
}
|
||||
AppEvent::ChangeWorkingDirectory {
|
||||
thread_id,
|
||||
|
||||
Reference in new issue
Block a user