Skip to content

Fix sandbox exec telemetry events never being sent#419

Merged
robinaugh merged 1 commit intomainfrom
jason/fix-sandbox-exec-telemetry
Mar 11, 2026
Merged

Fix sandbox exec telemetry events never being sent#419
robinaugh merged 1 commit intomainfrom
jason/fix-sandbox-exec-telemetry

Conversation

@robinaugh
Copy link
Contributor

@robinaugh robinaugh commented Mar 11, 2026

Summary

  • rwx sandbox exec called os.Exit(result.ExitCode) directly inside its Cobra RunE, which bypassed main()'s telem.Flush() call. All telemetry events (sandbox.exec, sandbox.start for lazy-starts, ssh.command, sandbox.sync_pull, etc.) were recorded in memory but never sent.
  • Introduced ExitCodeError type so commands can signal a non-zero exit code via a normal error return, allowing main() to flush telemetry before exiting.
  • Added test verifying sandbox.exec telemetry is recorded even with non-zero exit codes.

Test plan

  • Existing telemetry tests pass
  • New TestTelemetry_SandboxExecNonZeroExitCode verifies events are recorded for failed commands
  • Manual: run rwx sandbox exec -- pwd and verify telemetry events appear server-side

The sandbox exec command called os.Exit(result.ExitCode) directly,
which bypassed main()'s telemetry flush. This meant sandbox.exec
(and sandbox.start for lazy-started sandboxes) events were recorded
in memory but never sent to the server.

Replace the os.Exit call with an ExitCodeError return so that main()
can flush telemetry before exiting with the correct code.
@robinaugh robinaugh self-assigned this Mar 11, 2026
@robinaugh robinaugh marked this pull request as ready for review March 11, 2026 22:15
@robinaugh robinaugh merged commit c8279c4 into main Mar 11, 2026
1 check passed
@robinaugh robinaugh deleted the jason/fix-sandbox-exec-telemetry branch March 11, 2026 23:52
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.

2 participants