fix(sandbox): initialize workbench history before honoring a stop during creation
Merged
WA
8d ago+88+88+01234567890123456789-26-26-01234567890123456789
Summary
- A chat workbench created while the caller stopped (e.g. Stop pressed during the first
run_code) keeps existing for the next call to reuse, butensureSessionSandboxchecked the abort before initializing the machine's input history - The next call then reuses a machine with no history, the history script records it as
unknown, and every later code/shell result in that chat is withheld ("Tool execution settled, but its result could not be returned safely") until the machine is discarded — even when the code succeeded - Initialize the history for a newly created machine before honoring the abort. A machine this call just created has received no input, so empty history is exact; nothing changes on the non-abort path
- Existing machines latched before this ships are discarded by the paused-session sweep shortly after their last use, so no cleanup is needed
Type of Change
- Bug fix
Testing
- Added a case to
session-input-certification.integration.ts(real Redis history script, code + shell): the caller stops while the provider is creating the machine, then the next call reuses it and must return its result with clean history - Red on the pre-fix code with
Workbench output withheld because its secret provenance is unavailable, green with the fix; existing certification cases unchanged session-file-provenance.integration.tsand alllib/execution/remote-sandboxunit tests pass (574)- Lint, type-check, audits, and full suites run in CI
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing (new tests pass the
test-auditauthoring gate) - No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)