Cache shell snapshots in the exec server (#39756)

## What changed

- Add the `shellSnapshotV2` executor capability and an optional shell snapshot request to `ExecParams`.
- Capture and restore Unix shell state and profile exports from an in-memory, attachment-scoped cache for `bash`, `zsh`, and `sh`.
- Apply environment policies, runtime `PATH` entries, sandbox context, and live managed-proxy settings when preparing restored commands.
- Bound snapshot size, capture time, scope length, and cache capacity, and fall back to the original command when capture fails.

## Testing

- Cover local, remote, TTY, sandboxed, and supported-shell execution, plus environment filtering, proxy handling, in-memory reuse, and capture failure fallback.

GitOrigin-RevId: 624f747972c249c88c6f10f42cf0af97b75b5541
This commit is contained in:
jif
2026-08-20 17:39:06 +00:00
committed by copyberry
parent ce950dcf26
commit d0cc662b8c
20 changed files with 799 additions and 1 deletions
@@ -221,6 +221,7 @@ fn exec_server_params_for_request(
argv: request.command.clone(),
cwd: request.cwd.clone(),
env_policy,
shell_snapshot: None,
env,
tty,
pipe_stdin: false,