Skip to content

fix(runtime): adopt the Sandbox run result - #913

Merged
drewstone merged 6 commits into
mainfrom
fix/runtime-sandbox-outcome-20260820
Aug 21, 2026
Merged

fix(runtime): adopt the Sandbox run result#913
drewstone merged 6 commits into
mainfrom
fix/runtime-sandbox-outcome-20260820

Conversation

@drewstone

@drewstone drewstone commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Use the Sandbox run outcome tracker as the only terminal result source.
  • Project Sandbox messages, tool calls, usage, and events once inside Runtime.
  • Preserve blocked, failed, and completed run states after stream recovery.
  • Remove the older event-level failure parser.

Why

Consumers should receive one complete Runtime result from the public Sandbox contract.
Braid no longer needs a second parser for raw Sandbox events.
A recovered tool error does not incorrectly fail a completed turn.

Dependency cohort and release

Sandbox 0.31.0 is published and exports createAgentRunOutcomeTracker and AgentRunOutcome from its runtime entry, so the dependency update is part of this pull request.

  • Sandbox catalog and peer range become >=0.31.0 <0.32.0. The floor is 0.31.0 because this code requires createAgentRunOutcomeTracker, which 0.29 and 0.30 do not export.
  • Interface catalog and peer range become ^1.3.0, because Sandbox 0.31.0 requires Interface ^1.3.0. One consumer install therefore resolves one Interface copy.
  • scripts/lib/packed-package-test.mjs states the one supported Sandbox cohort (0.31.0), and the packed-cohort consumer install proves it.
  • ci.yml and publish.yml check out the Interface cohort source at @tangle-network/agent-interface@1.3.0 (a3c31b98).
  • Runtime moves to 0.143.0. The bump is a minor one because ./kernel removes assertSandboxEventSucceeded and sandboxEventFailure. It also adds SandboxExecutorToolCall, which names one retained tool call on SandboxLeafOut.
  • Bench moves to 0.8.19 with the same cohort.

Proof

Local, on the merge head:

  • pnpm run lint: 607 files checked, 0 diagnostics.
  • pnpm run typecheck: clean (tsc --noEmit plus the examples project).
  • pnpm run build: 151 files, 9.29 MB, complete.
  • pnpm test: 2,780 passed, 6 skipped, 105 failed. Every failure is a local macOS artifact and reproduces unchanged on origin/main: the same 20 files fail on both, and a per-test diff of the two runs lists zero failures unique to this branch. They are git-worktree and process-spawn timeouts in tests/candidate-execution-*, tests/mcp/*-harness, and tests/version-bump-check.
  • pnpm run check:version-bump: the minor bump is paid by 0.142.3 -> 0.143.0, and the bench patch by 0.8.18 -> 0.8.19.
  • pnpm run verify:package: 2,087 exports across 17 entry points, record current; static-import, publint, attw, and edge tool loop pass.
  • pnpm run docs:check: API reference regenerated with no diff, and the freshness gate passes on the version pin, 3 substrate peers, and 10 citations.
  • pnpm run verify:primeintellect: pass.
  • pnpm install --frozen-lockfile: clean after the lockfile regeneration.

pnpm run verify:bench fails locally only where its tests read /proc/<pid>/stat and resolve jail containment, which Linux provides and macOS does not. The agent-bench CI job runs the same command on Linux and passes.

Simplification

Simplification: the event-level failure parser is deleted with its tests (sandboxEventFailure, assertSandboxEventSucceeded, describeSandboxError, TERMINAL_EVENT_TYPES), so the four Sandbox paths that used to each apply their own per-event failure rule now read one terminal state from the platform tracker; TERMINAL_FAILURE is left scoped to one tool call only.
Net: +814 / -379 lines across 44 files (src and tests: +667 / -259 across 29 files); 103 lines of parser and its test block removed, 2 public exports dropped, 4 terminal-truth call sites collapsed to 1 owner.
Tests: +2 cases plus 5 table rows in the streamAgentTurn: Sandbox outcome contract block (a failed outcome after stream recovery stays failed with its usage; blocked_on_approval / awaiting_question / awaiting_plan_decision settle as blocked, not completed; a recovered tool error does not fail a completed turn), -7 deleted with the parser they tested (4 sandboxEventFailure decoder cases, 2 per-event assert cases, 1 renamed). No test asserts the new range, the version, or a removed export — check:version-bump, check:api-surface, and the packed-cohort job prove those.
Not done here: #912's remainder — served backend identity on settle records, and an explicit empty-vs-absent output marker beside content. That is a separate PR in this program, tracked on #912.

Closes #781

@drewstone
drewstone marked this pull request as ready for review August 21, 2026 00:37

@tangletools tangletools left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Auto-approved drewstone PR — a14f3115

This PR was opened by the trusted drewstone account.

This approval is provisional and was applied by the local stand-in because the pr-reviewer webhook host is unreachable (2026-08-21). CI on this head is fully green. The full PR reviewer audit re-runs via the resweep when the service returns and will publish findings if it detects issues.

@drewstone
drewstone merged commit fc445e0 into main Aug 21, 2026
4 checks passed
@drewstone
drewstone deleted the fix/runtime-sandbox-outcome-20260820 branch August 21, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(runtime): preserve failed sandbox terminal outcomes in streamAgentTurn

2 participants