From bb846cccf7cda4004acfaa4ce7951705a4d83b1b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 23 Aug 2026 09:52:36 +0200 Subject: [PATCH] Preserve strategic failure cause chains --- crates/ghostlight-dungeon/src/main.rs | 6 +++++- crates/ghostlight-dungeon/src/scheduler.rs | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/crates/ghostlight-dungeon/src/main.rs b/crates/ghostlight-dungeon/src/main.rs index c849967..9c64611 100644 --- a/crates/ghostlight-dungeon/src/main.rs +++ b/crates/ghostlight-dungeon/src/main.rs @@ -5777,7 +5777,11 @@ struct ErrorBody { } fn player_safe_strategic_failure(error: &anyhow::Error) -> ErrorBody { - tracing::warn!(%error, "private strategic simulation failed without mutation"); + let private_error_chain: String = format!("{error:#}").chars().take(4_000).collect(); + tracing::warn!( + error = %private_error_chain, + "private strategic simulation failed without mutation" + ); ErrorBody { error: "The strategic world simulation could not produce a valid atomic wave. No world state changed; retry when ready." .into(), diff --git a/crates/ghostlight-dungeon/src/scheduler.rs b/crates/ghostlight-dungeon/src/scheduler.rs index 678abd7..299ef95 100644 --- a/crates/ghostlight-dungeon/src/scheduler.rs +++ b/crates/ghostlight-dungeon/src/scheduler.rs @@ -97,14 +97,17 @@ pub async fn propose_resolution_wave_with_policy( let slice = cell_slice(campaign, &cell)?; jobs.spawn(async move { let cell_id = cell.id; + let subject_ids = cell.subject_ids; let _permit = semaphore .acquire_owned() .await .map_err(|_| anyhow!("provider concurrency gate closed"))?; - let terminal = engine - .execute(slice) - .await - .with_context(|| format!("simulation cell {cell_id} pipeline failed"))?; + let terminal = engine.execute(slice).await.with_context(|| { + format!( + "simulation cell {cell_id} subjects {} pipeline failed", + serde_json::to_string(&subject_ids).unwrap_or_else(|_| "[unavailable]".into()) + ) + })?; Ok::<_, anyhow::Error>((cell_id, terminal)) }); }