Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(devbox): use the template's default disk size (#101739)

Raúl Negrón-Oterod928063b6eb8
diff --git a/tools/hogli-commands/hogli_commands/devbox/cli.py b/tools/hogli-commands/hogli_commands/devbox/cli.py
index 9a3f4909006c..74af008aba91 100644
--- a/tools/hogli-commands/hogli_commands/devbox/cli.py
+++ b/tools/hogli-commands/hogli_commands/devbox/cli.py
@@ -1438,9 +1438,8 @@ def _maybe_hint_region_mismatch(name: str) -> None:
@workspace_argument
@click.option(
"--disk",
- type=click.Choice(["100", "200"]),
- default="100",
- help="Disk size in GiB (default: 100)",
+ type=int,
+ help="Disk size in GiB (default: set by the template)",
)
@click.option(
"-t",
@@ -1478,7 +1477,7 @@ def _maybe_hint_region_mismatch(name: str) -> None:
@click.option("-v", "--verbose", is_flag=True, help="Show full Coder/Terraform build output")
def devbox_start(
workspace: str | None,
- disk: str,
+ disk: int | None,
template: str,
preset: str,
region: str | None,
@@ -1507,12 +1506,10 @@ def devbox_start(
config = load_config()
- click.echo(
- f"Creating devbox '{name}' (template={template}, preset={preset}, region={effective_region}, disk={disk}GiB)..."
- )
+ click.echo(f"Creating devbox '{name}' (template={template}, preset={preset}, region={effective_region})...")
create_workspace(
name,
- int(disk),
+ disk,
git_name=config.get("git_name"),
git_email=config.get("git_email"),
dotfiles_uri=config.get("dotfiles_uri"),
diff --git a/tools/hogli-commands/hogli_commands/devbox/coder.py b/tools/hogli-commands/hogli_commands/devbox/coder.py
index c2fc055d249e..1be416af5fe3 100644
--- a/tools/hogli-commands/hogli_commands/devbox/coder.py
+++ b/tools/hogli-commands/hogli_commands/devbox/coder.py
@@ -1283,7 +1283,7 @@ def _start_app_param(start_app: bool | None) -> dict[str, str]:
def create_workspace(
name: str,
- disk_size: int,
+ disk_size: int | None,
git_name: str | None = None,
git_email: str | None = None,
dotfiles_uri: str | None = None,
@@ -1315,10 +1315,11 @@ def create_workspace(
``resolve_template_preset``; pass ``NO_PRESET`` to opt out.
"""
parameters: dict[str, str] = {
- DISK_SIZE_PARAMETER: str(disk_size),
"repo": repo,
WORKSPACE_REGION_PARAMETER: region,
}
+ if disk_size is not None:
+ parameters[DISK_SIZE_PARAMETER] = str(disk_size)
if git_name:
parameters[GIT_NAME_PARAMETER] = git_name
if git_email:
diff --git a/tools/hogli-commands/hogli_commands/tests/test_devbox.py b/tools/hogli-commands/hogli_commands/tests/test_devbox.py
index caa0a347dff4..877848c57cf0 100644
--- a/tools/hogli-commands/hogli_commands/tests/test_devbox.py
+++ b/tools/hogli-commands/hogli_commands/tests/test_devbox.py
@@ -911,7 +911,7 @@ def _stub_create_workspace(captured: dict[str, str | None]) -> Callable[..., Non
def stub(
name: str,
- disk_size: int,
+ disk_size: int | None,
*,
git_name: str | None = None,
git_email: str | None = None,
@@ -967,7 +967,7 @@ class TestWorkspaceCreation:
["Default (warm)", "Cold"],
"posthog-linux",
"none",
- {"disk_size": "100", "repo": _REPO, "workspace_region": "us-east-1"},
+ {"repo": _REPO, "workspace_region": "us-east-1"},
),
# An explicit warm preset that the template defines flows through to
# the coder argv unchanged, alongside all optional params.
@@ -982,7 +982,6 @@ class TestWorkspaceCreation:
"posthog-linux",
"Default (warm)",
{
- "disk_size": "100",
"repo": _REPO,
"workspace_region": "us-east-1",
"git_name": "PostHog Engineer",
@@ -995,7 +994,7 @@ class TestWorkspaceCreation:
["Default (warm)"],
"posthog-microvm",
"none",
- {"disk_size": "100", "repo": _REPO, "workspace_region": "us-east-1"},
+ {"repo": _REPO, "workspace_region": "us-east-1"},
),
# Resolution fallback to "none" is exhaustively covered by
# TestTemplatePresetResolution; one case here is enough to prove
@@ -1006,7 +1005,7 @@ class TestWorkspaceCreation:
["Cold only"],
"posthog-microvm",
"none",
- {"disk_size": "100", "repo": _REPO, "workspace_region": "us-east-1"},
+ {"repo": _REPO, "workspace_region": "us-east-1"},
),
# A non-default region is forwarded verbatim as workspace_region.
(
@@ -1014,7 +1013,7 @@ class TestWorkspaceCreation:
["Default (warm)"],
"posthog-linux",
"none",
- {"disk_size": "100", "repo": _REPO, "workspace_region": "eu-central-1"},
+ {"repo": _REPO, "workspace_region": "eu-central-1"},
),
],
ids=[
@@ -1038,7 +1037,7 @@ class TestWorkspaceCreation:
monkeypatch.setattr(coder, "_run_build", _fake_run_build_capturing(captured))
monkeypatch.setattr(coder, "_list_template_presets", lambda template: list(available_presets))
- coder.create_workspace("devbox-test-user", 100, **kwargs)
+ coder.create_workspace("devbox-test-user", None, **kwargs)
args = captured["args"]
assert args[:3] == ["coder", "create", "devbox-test-user"]
@@ -1592,7 +1591,7 @@ class TestDevboxCommands:
assert result.exit_code == 0
assert captured == {
"name": "devbox-test-user",
- "disk_size": "100",
+ "disk_size": "None",
"git_name": None,
"git_email": None,
"dotfiles_uri": None,
@@ -1603,8 +1602,6 @@ class TestDevboxCommands:
}
def test_devbox_start_forwards_larger_disk_size(self, monkeypatch: pytest.MonkeyPatch) -> None:
- # Guards that --disk 200 is an accepted choice and reaches create_workspace;
- # regresses if the choice list drifts from the Coder template's disk_size options.
captured: dict[str, str | None] = {}
monkeypatch.setattr(devbox_cli, "ensure_runtime_ready", lambda: None)