Skip to content

Commit 4f69792

Browse files
committed
Address oz review.
1 parent ab9ed36 commit 4f69792

3 files changed

Lines changed: 83 additions & 27 deletions

File tree

app/src/ai/agent_conversations_model.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,29 @@ enum LinkPreference {
253253

254254
#[derive(Clone, Debug, PartialEq, Eq)]
255255
pub enum AgentRunDisplayStatus {
256+
/// Raw task-service lifecycle states. `from_task` only returns `TaskInProgress` while the
257+
/// task still has an active execution, or when there is no shadowed local conversation to
258+
/// provide a more granular status.
256259
TaskQueued,
257260
TaskPending,
258261
TaskClaimed,
259262
TaskInProgress,
260263
TaskSucceeded,
261264
TaskFailed,
262265
TaskError,
263-
TaskBlocked { blocked_action: String },
266+
TaskBlocked {
267+
blocked_action: String,
268+
},
264269
TaskCancelled,
265270
TaskUnknown,
271+
/// Conversation-derived lifecycle states, used for interactive conversations and for
272+
/// in-progress ambient tasks after they can be resolved to their shadowed local conversation.
266273
ConversationInProgress,
267274
ConversationSucceeded,
268275
ConversationError,
269-
ConversationBlocked { blocked_action: String },
276+
ConversationBlocked {
277+
blocked_action: String,
278+
},
270279
ConversationCancelled,
271280
}
272281

app/src/ui_components/agent_icon.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,11 @@ pub(crate) fn agent_conversation_entry_icon_variant(
105105
let is_ambient = matches!(entry.provenance, AgentConversationProvenance::AmbientRun)
106106
|| entry.backing.has_ambient_run
107107
|| entry.identity.ambient_agent_task_id.is_some();
108-
Some(match entry.provenance {
109-
AgentConversationProvenance::AmbientRun => agent_icon_variant_for_run(
110-
entry.display.harness.unwrap_or(Harness::Oz),
111-
status,
112-
is_ambient,
113-
),
114-
AgentConversationProvenance::LocalInteractive
115-
| AgentConversationProvenance::CloudSyncedConversation => {
116-
if is_ambient {
117-
agent_icon_variant_for_run(
118-
entry.display.harness.unwrap_or(Harness::Oz),
119-
status,
120-
is_ambient,
121-
)
122-
} else {
123-
IconWithStatusVariant::OzAgent {
124-
status: Some(status),
125-
is_ambient,
126-
}
127-
}
128-
}
129-
})
108+
Some(agent_icon_variant_for_run(
109+
entry.display.harness.unwrap_or(Harness::Oz),
110+
status,
111+
is_ambient,
112+
))
130113
}
131114

132115
/// Primitive inputs to the terminal-view waterfall, gathered once from the live

app/src/ui_components/agent_icon_tests.rs

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,22 @@
1010
//!
1111
//! Adding a new canonical state is a one-enum-variant + one `expected` arm + one `*_inputs`
1212
//! arm change; the table test below enforces every surface agrees.
13+
use chrono::Utc;
1314
use warp_cli::agent::Harness;
1415

1516
use super::{
16-
agent_icon_variant_for_run, agent_icon_variant_from_terminal_inputs, CLISessionInputs,
17-
TerminalIconInputs,
17+
agent_conversation_entry_icon_variant, agent_icon_variant_for_run,
18+
agent_icon_variant_from_terminal_inputs, CLISessionInputs, TerminalIconInputs,
19+
};
20+
use crate::ai::agent::conversation::{AIConversationId, ConversationStatus};
21+
use crate::ai::agent_conversations_model::entry::{
22+
AgentConversationBackingData, AgentConversationCapabilities, AgentConversationCreator,
23+
AgentConversationDisplayData, AgentConversationIdentity,
24+
};
25+
use crate::ai::agent_conversations_model::{
26+
AgentConversationEntry, AgentConversationEntryId, AgentConversationProvenance,
27+
AgentRunDisplayStatus,
1828
};
19-
use crate::ai::agent::conversation::ConversationStatus;
2029
use crate::terminal::CLIAgent;
2130
use crate::ui_components::icon_with_status::IconWithStatusVariant;
2231

@@ -372,3 +381,58 @@ fn local_claude_vs_cloud_claude_differ_only_by_is_ambient() {
372381
assert!(!local.is_ambient);
373382
assert!(cloud.is_ambient);
374383
}
384+
385+
#[test]
386+
fn non_ambient_entry_uses_display_harness() {
387+
let conversation_id = AIConversationId::new();
388+
let entry = AgentConversationEntry {
389+
id: AgentConversationEntryId::Conversation(conversation_id),
390+
identity: AgentConversationIdentity {
391+
local_conversation_id: Some(conversation_id),
392+
ambient_agent_task_id: None,
393+
server_conversation_token: None,
394+
session_id: None,
395+
},
396+
provenance: AgentConversationProvenance::CloudSyncedConversation,
397+
display: AgentConversationDisplayData {
398+
title: "Codex conversation".to_string(),
399+
initial_query: None,
400+
created_at: Utc::now(),
401+
last_updated: Utc::now(),
402+
status: AgentRunDisplayStatus::ConversationSucceeded,
403+
creator: AgentConversationCreator::default(),
404+
request_usage: None,
405+
run_time: None,
406+
source: None,
407+
working_directory: None,
408+
environment_id: None,
409+
harness: Some(Harness::Codex),
410+
artifacts: Vec::new(),
411+
},
412+
backing: AgentConversationBackingData {
413+
has_loaded_conversation: true,
414+
has_local_persisted_data: true,
415+
has_cloud_data: true,
416+
has_ambient_run: false,
417+
},
418+
capabilities: AgentConversationCapabilities {
419+
can_open: true,
420+
can_copy_link: false,
421+
can_share: false,
422+
can_delete: false,
423+
can_fork_locally: false,
424+
can_cancel: false,
425+
},
426+
};
427+
428+
let variant = agent_conversation_entry_icon_variant(&entry).unwrap();
429+
assert_eq!(
430+
AgentIconFields::from_variant(&variant).unwrap(),
431+
AgentIconFields {
432+
is_cli: true,
433+
cli_agent: Some(CLIAgent::Codex),
434+
status: Some(ConversationStatus::Success),
435+
is_ambient: false,
436+
}
437+
);
438+
}

0 commit comments

Comments
 (0)