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 authored and copyberry committed 2026-08-20 17:39:06 +00:00
1 parent ce950dcf26
commit d0cc662b8c
20 files changed
+799 -1

No files matched your search

@@ -605,6 +605,7 @@ impl ExecutorStdioServerLauncher {
process_id,
argv,
cwd,
shell_snapshot: None,
env_policy: Some(Self::remote_env_policy(&remote_env_vars)),
env,
tty: false,