fix(e2b): address the v7 review round

- restore the parent's AGENTS.md body around this branch's e2b row (the
  replay had resurrected the pre-profile-CLI layout, deleting the api/,
  bundle/, settings/, and credentials/ groups); the fs/lsp row
  condensations stay for the word budget
- aggregate the composite rollback failure, not the original error, when
  private state cleanup also fails — a surviving remote group is no
  longer hidden by a later cleanup error (triple-failure regression)
- own the state directory before the makeDir RPC, matching the terminal
  transaction, so a cancellation racing a committed creation still
  enters cleanup
- drop the hidden pollMs parameter defaults; the schemastery default is
  the one home, and tests pass the cadence explicitly
- restore spawn/spawnTerminal graceMs validation to the seam's
  documented bound (the earlier removal cited subprocess-local as not
  validating; it does), with rejection regressions
This commit is contained in:
Tianyi Cui
2026-08-08 22:52:25 +08:00
parent 10fc9405c7
commit 450ec99325
11 files changed
+218 -137

No files matched your search

+5 -3
View File
@@ -194,7 +194,7 @@ export class E2BSubprocessHandle implements SubprocessHandle {
private readonly runtime: E2BSandboxService,
private readonly spec: SubprocessSpawnSpec,
readonly stateDir: string,
private readonly pollMs = 20,
private readonly pollMs: number,
) {
this.paths = {
pid: posix.join(stateDir, 'pid'),
@@ -378,7 +378,7 @@ export class E2BSubprocessHandle implements SubprocessHandle {
await this.removeFailedState(sandbox)
} catch (cleanupError: unknown) {
failure = new AggregateError(
[error, cleanupError],
[failure, cleanupError],
'subprocess-e2b: command failed and private state cleanup failed',
)
}
@@ -398,8 +398,10 @@ export class E2BSubprocessHandle implements SubprocessHandle {
const signal = this.terminationController.signal
const ambient = await readRemoteEnvironment(sandbox, signal)
this.controlEnvs = bootstrapEnvironment(ambient)
await sandbox.files.makeDir(this.stateDir, { signal })
// Own the directory before the request: a cancellation racing a committed
// creation must still enter cleanup (removal tolerates an absent path).
this.stateDirectoryCreated = true
await sandbox.files.makeDir(this.stateDir, { signal })
await sandbox.commands.run(
`chmod 700 -- ${quoteE2BShellArg(this.stateDir)}`,
commandOpts(this.controlEnvs, signal),