Skip to content

improvement(sandbox): log per-phase timing for each sandbox execution - #9587

Merged
waleedlatif1 merged 2 commits into
stagingfrom
improvement/sandbox-call-floor
Nov 3, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
improvement/sandbox-call-floor

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • A warm workbench run_code call has a fixed cost of about 1 s, and today the only thing logged is the total executionTime. This PR records wall time for each phase (resolve, access, lease with its lookup and cli parts, prepare, run, collect, release) and attaches it as phaseMs to the existing E2B shell/JS/Py sandbox log lines, together with sandboxSession (created/reused). The JS and Py lines also get executionTime, which the shell line already had
  • No new log lines. Fields are added to existing lines only. No behavior change: the timer only reads performance.now() around awaits that were already there
  • phaseMs is used only on the log line. The route destructures it and never puts it in a response
  • No overhead removed in this PR. I benchmarked a warm call's steps against a real E2B sandbox (6 warm iterations, about 45 ms RTT). The floor is about 8 serial E2B round trips, and each one has a job: list and connect, the deployment CLI integrity check (launch plus stop receipt, about 250 ms, roughly a third of the floor), the output-dir sentinel, the user command (launch plus stop receipt), and the output listing. On top of those are the ownership claim/settle writes for each tracked command. None of these is redundant without a change to the durable process ownership or CLI repair design, so this PR only measures. The per-phase fields will show whether cli is the right next target in production

Type of Change

  • Improvement (observability)

Testing

  • New test in session-sandbox.test.ts: a warm shell call with slowed lookup, CLI check, and run reports each delay in its own phase. Fails on the pre-change source, passes after
  • bun run --cwd apps/sim test on lib/execution/remote-sandbox, lib/function-execution, lib/uploads/documents, lib/workspace-files: 90 files, 1,406 tests pass
  • check:comment-hygiene, check:file-names, check:explicit-any pass locally. CI runs the full gate

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 3, 2026 12:24am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; both previous findings are addressed and no new actionable issues were found.

Summary

Adds per-phase sandbox timings to existing execution logs without adding them to response fields.

  • Sandbox logs show how long each execution phase takes.

Reviews (2) · Last reviewed commit: "test(sandbox): time the unchanged-CLI wa..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 6 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 6 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 2b77ade into staging Nov 3, 2026
51 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/sandbox-call-floor branch November 3, 2026 00:29

This branch was previously deployed

1 inactive deployment
Preview — c36b9a73 Deployed Nov 3, 2026 by vercel[bot]
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.

1 participant