Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl AgentInboxStore {

/// Atomically persist a recovery/outbox message only while its Agent Org
/// run is still Running. This shares the sessions writer lock and an
/// IMMEDIATE transaction with run finality, so a queued watchdog action
/// IMMEDIATE transaction with Team Quiescence, so a queued watchdog action
/// cannot insert a new unread row after pause or terminal transition.
pub(crate) fn insert_if_run_running(
params: InsertInboxParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ impl AgentOrgPlanApprovalStore {
OR EXISTS (
SELECT 1 FROM agent_org_runs run
WHERE run.id=approval.org_run_id
AND run.status IN ('completed','failed','cancelled','abandoned')
AND run.status IN ('failed','archived')
)
)",
)
Expand All @@ -667,7 +667,7 @@ impl AgentOrgPlanApprovalStore {
OR EXISTS (
SELECT 1 FROM agent_org_runs run
WHERE run.id=agent_org_plan_approvals.org_run_id
AND run.status IN ('completed','failed','cancelled','abandoned')
AND run.status IN ('failed','archived')
)
)",
params![
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ pub(super) fn load_by_id(run_id: &str) -> SqliteResult<Option<AgentOrgRunRecord>
org_snapshot_json,
entry_mode,
status,
activation_generation,
has_initial_work,
work_item_id,
project_slug,
routine_fire_id,
summary,
last_error,
failure_json,
last_activity_outcome,
created_at,
updated_at,
completed_at
idled_at
FROM agent_org_runs
WHERE id = ?1
LIMIT 1",
Expand All @@ -78,14 +82,18 @@ pub(super) fn load_by_root_session(
org_snapshot_json,
entry_mode,
status,
activation_generation,
has_initial_work,
work_item_id,
project_slug,
routine_fire_id,
summary,
last_error,
failure_json,
last_activity_outcome,
created_at,
updated_at,
completed_at
idled_at
FROM agent_org_runs
WHERE root_session_id = ?1
ORDER BY created_at DESC
Expand Down Expand Up @@ -121,14 +129,18 @@ pub(super) fn row_to_run(row: &rusqlite::Row<'_>) -> SqliteResult<AgentOrgRunRec
org_snapshot_json: row.get(4)?,
entry_mode,
status,
work_item_id: row.get(7)?,
project_slug: row.get(8)?,
routine_fire_id: row.get(9)?,
summary: row.get(10)?,
last_error: row.get(11)?,
created_at: row.get(12)?,
updated_at: row.get(13)?,
completed_at: row.get(14)?,
activation_generation: row.get(7)?,
has_initial_work: row.get::<_, i64>(8)? != 0,
work_item_id: row.get(9)?,
project_slug: row.get(10)?,
routine_fire_id: row.get(11)?,
summary: row.get(12)?,
last_error: row.get(13)?,
failure_json: row.get(14)?,
last_activity_outcome: row.get(15)?,
created_at: row.get(16)?,
updated_at: row.get(17)?,
idled_at: row.get(18)?,
})
}

Expand Down Expand Up @@ -204,15 +216,19 @@ pub(super) fn insert_run(conn: &Connection, run: &AgentOrgRunRecord) -> SqliteRe
org_snapshot_json,
entry_mode,
status,
activation_generation,
has_initial_work,
work_item_id,
project_slug,
routine_fire_id,
summary,
last_error,
failure_json,
last_activity_outcome,
created_at,
updated_at,
completed_at
) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15)",
idled_at
) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19)",
params![
&run.id,
&run.org_id,
Expand All @@ -221,14 +237,18 @@ pub(super) fn insert_run(conn: &Connection, run: &AgentOrgRunRecord) -> SqliteRe
run.org_snapshot_json.as_deref(),
run.entry_mode.as_str(),
run.status.as_str(),
run.activation_generation,
i64::from(run.has_initial_work),
run.work_item_id.as_deref(),
run.project_slug.as_deref(),
run.routine_fire_id.as_deref(),
run.summary.as_deref(),
run.last_error.as_deref(),
run.failure_json.as_deref(),
run.last_activity_outcome.as_deref(),
&run.created_at,
&run.updated_at,
run.completed_at.as_deref(),
run.idled_at.as_deref(),
],
)?;
Ok(())
Expand Down
Loading
Loading