add codex cloud list (#9324)

for listing cloud tasks.
This commit is contained in:
Jeremy Rose
2026-01-16 08:56:38 -08:00
committed by GitHub
parent 9147df0e60
commit 4125c825f9
9 changed files with 259 additions and 23 deletions

View File

@@ -16,7 +16,12 @@ pub struct MockClient;
#[async_trait::async_trait]
impl CloudBackend for MockClient {
async fn list_tasks(&self, _env: Option<&str>) -> Result<Vec<TaskSummary>> {
async fn list_tasks(
&self,
_env: Option<&str>,
_limit: Option<i64>,
_cursor: Option<&str>,
) -> Result<crate::TaskListPage> {
// Slightly vary content by env to aid tests that rely on the mock
let rows = match _env {
Some("env-A") => vec![("T-2000", "A: First", TaskStatus::Ready)],
@@ -58,11 +63,14 @@ impl CloudBackend for MockClient {
attempt_total: Some(if id_str == "T-1000" { 2 } else { 1 }),
});
}
Ok(out)
Ok(crate::TaskListPage {
tasks: out,
cursor: None,
})
}
async fn get_task_summary(&self, id: TaskId) -> Result<TaskSummary> {
let tasks = self.list_tasks(None).await?;
let tasks = self.list_tasks(None, None, None).await?.tasks;
tasks
.into_iter()
.find(|t| t.id == id)