Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

fix(api): GetSandboxesSandboxID omits VolumeMounts and sets empty string Alias for paused sandboxes

オープン 初心者向け
#3,575 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
go
領域
api

調査の方向性

packages/api/internal/handlers/sandbox_get.go から始め、特に235-265行付近のpaused sandboxのマッピングを確認し、そのVolumeMountsとAliasの処理をsandboxes_list.goと比較してください。orchestratorがnilの場合のガードを追加し、sandbox_get_test.goでpaused snapshotのケースをカバーしてください。paused responseでvolume mountsが保持され、空のaliasが省略され、orchestratorがnilでもpanicしなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

Problem

When querying sandbox metadata via GET /sandboxes/{sandboxID} (packages/api/internal/handlers/sandbox_get.go), paused or stopped sandboxes loaded from lastSnapshot exhibit two payload inconsistencies with the OpenAPI specification and list endpoints:

  1. Missing VolumeMounts in Paused Sandbox Response:
    When a sandbox is paused, lastSnapshot.Snapshot.Config.VolumeMounts contains all persistent volume mount mappings. However, GetSandboxesSandboxID constructs api.SandboxDetail without populating the VolumeMounts field, resulting in "volume_mounts": null or omission in the JSON response. In contrast, the list endpoint GET /v2/sandboxes (packages/api/internal/handlers/sandboxes_list.go:L292) correctly maps VolumeMounts for paused sandboxes via convertFromDBMountsToAPIMounts.

  2. Malformed Alias Serialized as "" (Empty String) instead of null / Omission:
    When a paused sandbox has no aliases, pausedAlias := firstAlias(lastSnapshot.Aliases) returns "" (empty string). sandbox.Alias = &pausedAlias then assigns a non-nil pointer to "". When serialized to JSON, this emits "alias": "" instead of null or omitting the property, violating the OpenAPI schema contract for optional string fields.

  3. Potential Nil Pointer Panic on a.orchestrator:
    GetSandboxesSandboxID attempts to call a.orchestrator.GetSandbox without verifying a.orchestrator != nil, causing panics in isolated unit tests and environments where the orchestrator client is nil.

Root Cause

In packages/api/internal/handlers/sandbox_get.go:L235-L265:

// Current implementation for paused sandboxes:
pausedAlias := firstAlias(lastSnapshot.Aliases)
sandbox = api.SandboxDetail{
    // VolumeMounts is omitted completely
    Alias: &pausedAlias, // Points to "" when len(Aliases) == 0
    ...
}

Comparison of metadata mapping across endpoints:

Endpoint Paused Sandbox VolumeMounts Empty Alias Representation
GET /v2/sandboxes (sandboxes_list.go) Populated via convertFromDBMountsToAPIMounts nil (omitted)
GET /sandboxes/{id} (Current) nil (omitted) &"" (serialized as "")
GET /sandboxes/{id} (Expected) Populated from Config.VolumeMounts nil (omitted)

Reproduction Steps

  1. Create a sandbox with persistent volume mounts: POST /sandboxes with volume_mounts: [{"name": "my-vol", "path": "/mnt/data"}].
  2. Pause the sandbox: POST /sandboxes/{id}/pause.
  3. Query the paused sandbox: GET /sandboxes/{id}.
  4. Observed:
    • volume_mounts is null or missing from the JSON payload.
    • alias is "" (empty string) if no alias was assigned.
  5. Expected:
    • volume_mounts contains [{"name": "my-vol", "path": "/mnt/data"}].
    • alias is null or omitted when no alias exists.

Technical Context

  • File affected: packages/api/internal/handlers/sandbox_get.go
  • Subsystem: Control Plane API / Sandboxes
  • Impact: Medium (API Schema compliance, client SDK consistency, and paused sandbox metadata fidelity)

Proposed Changes

# Change File(s) Affected Complexity
1 Add nil check on a.orchestrator != nil before calling GetSandbox sandbox_get.go Trivial
2 Extract volumeMounts from lastSnapshot.Snapshot.Config.VolumeMounts and pass to api.SandboxDetail sandbox_get.go Low
3 Populate sandbox.Alias only when len(lastSnapshot.Aliases) > 0, leaving it nil otherwise sandbox_get.go Trivial
4 Add unit test asserting VolumeMounts and nil alias on paused snapshot sandbox_get_test.go Low
主要言語
Go
スター
1.6k
フォーク
438
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

e2b-dev/runtime のほかの issue

e2b-dev/runtime の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。