Preserve strategic failure cause chains
This commit is contained in:
parent
ea4d3b659a
commit
bb846cccf7
2 changed files with 12 additions and 5 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue