ad4b882bff
This PR fixes 2 bugs that made the follow option in `e2b sbx logs` not work: 1. `e2b sbx logs -f <id>` failed to follow because the `isRunning` function was always returning false due to the API call being unauthenticated if you dont have the `E2B_API_KEY` environment variable set. This follows the existing pattern from other API calls: https://github.com/e2b-dev/E2B/blob/c4ce97e9b9a1809e3419d64499c1e56f9138e3d0/packages/cli/src/commands/sandbox/list.ts#L138-L152 Eventually it would make sense to handle the error here, for now just a hotfix to fix the --follow usage 2. Once it actually followed, it never stopped following because `isRunning` was not inside the loop and always true. Now when you kill the sandbox follow actually stops following <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Fixes `e2b sbx logs -f` by authenticating `isRunning` and re-checking sandbox state each loop so following works and stops when closed. > > - **CLI — `packages/cli/src/commands/sandbox`**: > - **Logs follow behavior (`logs.ts`)**: > - Re-check `isRunning(sandboxID)` inside the loop (`isSandboxRunning`) instead of using a cached promise, ensuring follow stops when sandbox is closed or not found. > - **Sandbox state check auth (`utils.ts`)**: > - Use `ensureAPIKey()` and pass `apiKey` to `Sandbox.getInfo(getShortID(sandboxID), { apiKey })` so `isRunning` is authenticated. > - **Release**: > - Changeset adds patch for `@e2b/cli` with note: fix sbx logs follow option. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5fbd87166b70aca7229ccc1ff8fa2c27f12b1641. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->