hive-sh4re/hive-bash-mcp/hive-agent: retype TaskFile timestamps to DateTime<Utc>, drop now_unix from these crates

This commit is contained in:
damocles 2026-08-01 21:34:29 +02:00 committed by mara
commit 2122e23d81
7 changed files with 30 additions and 22 deletions

View file

@ -133,8 +133,6 @@ fn signal_group(pgid: Option<i32>, sig: i32) {
// Helpers
// ---------------------------------------------------------------------------
use hive_sh4re::wire_time::now_unix;
/// Generate a task ID: `<timestamp_hex><seq_hex>`.
#[must_use]
pub fn new_task_id() -> String {
@ -271,7 +269,7 @@ pub fn submit_task(cmd: String, timeout_secs: Option<u64>, name: Option<String>)
cmd,
timeout_secs,
status: TaskStatus::Pending,
created_at: now_unix(),
created_at: chrono::Utc::now(),
started_at: None,
completed_at: None,
exit_code: None,
@ -377,7 +375,7 @@ pub fn kill_task(id: &str, force: bool) -> (bool, bool) {
&& task.status == TaskStatus::Pending
{
task.status = TaskStatus::Killed;
task.completed_at = Some(now_unix());
task.completed_at = Some(chrono::Utc::now());
let _ = write_task(&task);
// A Pending task never reached Running, so it has no keyed "active"
// todo to clear and (like the old code) fires no completion signal —
@ -435,7 +433,7 @@ async fn mark_interrupted(socket: &Path) {
}
tracing::warn!(id = %id, "bash_runner: marking interrupted task");
task.status = TaskStatus::Interrupted;
task.completed_at = Some(now_unix());
task.completed_at = Some(chrono::Utc::now());
if let Err(e) = write_task(&task) {
tracing::warn!(id = %id, error = ?e, "bash_runner: write interrupted state failed");
}
@ -490,7 +488,7 @@ async fn run_task(mut task: TaskFile, socket: &Path) {
tracing::info!(id = %id, cmd = %task.cmd, "bash_runner: starting task");
task.status = TaskStatus::Running;
task.started_at = Some(now_unix());
task.started_at = Some(chrono::Utc::now());
if let Err(e) = write_task(&task) {
tracing::warn!(id = %id, error = ?e, "bash_runner: write running state failed");
}
@ -559,7 +557,7 @@ async fn run_task(mut task: TaskFile, socket: &Path) {
};
task.status = status;
task.completed_at = Some(now_unix());
task.completed_at = Some(chrono::Utc::now());
task.exit_code = exit_code;
task.stdout_tail = stdout_tail.clone().filter(|s| !s.is_empty());
task.stderr_tail = stderr_tail.clone().filter(|s| !s.is_empty());