Order unified exec lifecycle events reliably (#34713)

## What changed

- Treat output-task closure as the signal that trailing output is complete, drain any remaining chunks before publishing command completion, and retain the grace period as a fallback.
- Wait for deferred network-denial classification before emitting the final command result.
- Serialize `write_stdin` interaction and completion events so an interaction that exits a process is published first, and avoid pruning processes while their terminal events are being finalized.

## Testing

- Add coverage for late output, missing output-close signals, late network denials, interaction/completion ordering, cross-platform aggregated output, and pruning during finalization.

GitOrigin-RevId: 46a118552bb1a4658b78aa5a5ca76eb8c5fba571
This commit is contained in:
jif authored and copyberry committed 2026-07-22 09:29:09 +00:00
1 parent 516f1e2aff
commit 9fc715c086
10 files changed
+445 -35

No files matched your search

+12
View File
@@ -116,6 +116,18 @@ pub(crate) struct WriteStdinRequest<'a> {
pub yield_time_ms: u64,
pub max_output_tokens: Option<usize>,
pub truncation_policy: TruncationPolicy,
pub interaction_event: Option<WriteStdinInteractionEvent<'a>>,
}
pub(crate) struct WriteStdinInteractionEvent<'a> {
pub session: &'a Arc<Session>,
pub turn: &'a Arc<TurnContext>,
}
impl std::fmt::Debug for WriteStdinInteractionEvent<'_> {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("WriteStdinInteractionEvent")
}
}
#[derive(Default)]