Collect plugin metrics from remote executors (#38283)

## What changed

- Resolve manifest-declared metric operations against the executor filesystem for remote plugin commands.
- Create the measurement sidecar in an executor-native, owner-private temporary directory, stream its bounded output back for validation, and clean up the directory afterward.
- Extend the exec-server protocol with the executor temporary directory and atomic private-directory creation.

## Testing

- Cover remote unified-exec measurements for foreground and background commands.
- Verify private directories use owner-only permissions on Unix and fail closed on unsupported platforms.

GitOrigin-RevId: dbbd0a84717b91237fc5728e510e18994eb46dd4
This commit is contained in:
Kyle Brown
2026-08-13 00:39:04 +00:00
committed by copyberry
parent 1e71e35df6
commit 9579479d28
18 changed files with 416 additions and 82 deletions
@@ -216,7 +216,8 @@ pub(crate) fn spawn_exit_watcher(
&session_ref,
&turn_ref,
&call_id,
);
)
.await;
emit_exec_end_for_unified_exec(
session_ref,
turn_ref,
@@ -251,14 +251,15 @@ struct InitialExecCommandGuard {
}
impl InitialExecCommandGuard {
fn finish_plugin_metrics(&mut self, context: &UnifiedExecContext, exit_code: i32) {
async fn finish_plugin_metrics(&mut self, context: &UnifiedExecContext, exit_code: i32) {
finish_and_track_measurements(
self.metrics_sidecar.take(),
exit_code,
&context.session,
&context.step_context.turn,
&context.call_id,
);
)
.await;
}
}
@@ -661,7 +662,8 @@ impl UnifiedExecProcessManager {
&context.session,
&context.step_context.turn,
&context.call_id,
);
)
.await;
(None, exit_code)
}
ProcessStatus::Unknown => {
@@ -694,7 +696,9 @@ impl UnifiedExecProcessManager {
}
let exit_code = process.exit_code();
let exit = exit_code.unwrap_or(-1);
initial_exec_command_guard.finish_plugin_metrics(context, exit);
initial_exec_command_guard
.finish_plugin_metrics(context, exit)
.await;
emit_exec_end_for_unified_exec(
Arc::clone(&context.session),
Arc::clone(&context.step_context.turn),