nit: prevent race in event rendering (#8181)

This commit is contained in:
jif-oai 2025-12-17 13:24:02 +00:00 committed by GitHub
parent 2bf57674d6
commit 0abaf1b57c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -175,7 +175,6 @@ impl UnifiedExecSessionManager {
// Shortlived command: emit ExecCommandEnd immediately using the
// same helper as the background watcher, so all end events share
// one implementation.
self.release_process_id(&request.process_id).await;
let exit = exit_code.unwrap_or(-1);
emit_exec_end_for_unified_exec(
Arc::clone(&context.session),
@ -191,6 +190,7 @@ impl UnifiedExecSessionManager {
)
.await;
self.release_process_id(&request.process_id).await;
session.check_for_sandbox_denial_with_text(&text).await?;
} else {
// Longlived command: persist the session so write_stdin can reuse