: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(hogli): remove the devbox:task command (#100502)
Raúl Negrón-Otero129ac49a9fd8
diff --git a/docs/internal/coder-workspaces.md b/docs/internal/coder-workspaces.mdindex 7a5485a73c29..e0b4a28eff4b 100644--- a/docs/internal/coder-workspaces.md+++ b/docs/internal/coder-workspaces.md@@ -26,16 +26,6 @@ hogli devbox:exec -- bash -lc 'gh auth status' # run one command on the box an**Connecting your IDE** —Open the workspace in VS Code (`hogli devbox:open --vscode`), Cursor (`--cursor`), or a browser-based editor (`--web`).-**Running a background agent task** —-Spin up a fresh devbox that runs a coding agent against a prompt, without taking over your current session:--```bash-hogli devbox:task "fix CI on PR #1234"-cat prompt.txt | hogli devbox:task # or pipe the prompt via stdin-```--See the upstream [Coder Tasks docs](https://coder.com/docs/ai-coder/tasks) for the execution model.-**Running the dev stack in detached mode** —Start the PostHog dev stack in the background without an interactive terminal:@@ -150,6 +140,6 @@ Common secrets include `CLAUDE_CODE_OAUTH_TOKEN`, `GH_TOKEN`, and `OP_SERVICE_AC- Laptop to workspace access uses `coder ssh` and `coder config-ssh` (configured automatically during setup)- Git inside the workspace should use HTTPS via Coder external auth — do not set up SSH Git inside the workspace-- Claude auth is stored as a Coder user secret named `CLAUDE_CODE_OAUTH_TOKEN` (requires Coder 2.33+). Run `hogli devbox:setup --configure-claude` to set or replace it. `devbox:task` warns when the secret is unset.+- Claude auth is stored as a Coder user secret named `CLAUDE_CODE_OAUTH_TOKEN` (requires Coder 2.33+). Run `hogli devbox:setup --configure-claude` to set or replace it.`go/coder` is a convenient shortcut for humans, but the canonical deployment URL is `https://coder.dev.posthog.dev`.diff --git a/hogli.yaml b/hogli.yamlindex 9165a1fdb75c..687455f6477e 100644--- a/hogli.yaml+++ b/hogli.yaml@@ -213,11 +213,6 @@ devbox:devbox:sync:click: hogli_commands.devbox.sync:cmd_syncdescription: Mirror your local PostHog checkout to a devbox- devbox:task:- click: hogli_commands.devbox.cli:devbox_task- description: Run a background agent task on a fresh devbox- # exec-replaces the process (os.execvp): completed events can't fire- untracked: truedevbox:secret:list:click: hogli_commands.devbox.cli:devbox_secret_listdescription: List your Coder user secretsdiff --git a/tools/hogli-commands/hogli_commands/devbox/cli.py b/tools/hogli-commands/hogli_commands/devbox/cli.pyindex 05e14a7324ce..22b95b0a08ce 100644--- a/tools/hogli-commands/hogli_commands/devbox/cli.py+++ b/tools/hogli-commands/hogli_commands/devbox/cli.py@@ -44,7 +44,6 @@ from .coder import (coder_installed,coder_reachable,coder_ssh_alias_configured,- create_task,create_workspace,delete_user_secret,delete_workspace,@@ -948,7 +947,7 @@ def maybe_configure_claude_secret(configure_claude: bool | None, *, known_secretclick.echo()click.echo(click.style("Claude Code: migrating Keychain token to a Coder user secret", bold=True))click.echo(" hogli now stores the Claude OAuth token as a Coder user secret so that")- click.echo(" workspaces -- and devbox:task runs -- pick it up automatically.")+ click.echo(" workspaces pick it up automatically.")if click.confirm("Migrate the existing Keychain entry now?", default=True):upsert_user_secret(CLAUDE_CODE_OAUTH_ENV,@@ -964,7 +963,7 @@ def maybe_configure_claude_secret(configure_claude: bool | None, *, known_secretclick.echo()click.echo(click.style("Claude Code (optional)", bold=True))- click.echo(" Workspaces and devbox:task runs can use Claude Code if you provide an OAuth token.")+ click.echo(" Workspaces can use Claude Code if you provide an OAuth token.")click.echo(" The token will be stored as a Coder user secret and injected as")click.echo(f" ${CLAUDE_CODE_OAUTH_ENV} into every workspace you start.")click.echo(" To generate one, run `claude setup-token` in another terminal.")@@ -1750,51 +1749,6 @@ def devbox_logs(workspace: str | None, follow: bool) -> None:logs_replace(name, follow)[email protected](name="devbox:task", short_help="Run a background agent task on a fresh devbox")[email protected]("prompt", required=False)[email protected]("--name", "task_name", default=None, help="Task name (auto-generated if omitted)")[email protected]("-q", "--quiet", is_flag=True, help="Only print the created task's ID")- "-t",- "--template",- default=DEFAULT_TEMPLATE,- show_default=True,- help="Coder workspace template to run the task on",-)-def devbox_task(prompt: str | None, task_name: str | None, quiet: bool, template: str) -> None:- """Start a background Coder task on the chosen workspace template.-- The Coder deployment provisions a fresh workspace per task and hands the- prompt to the agent configured in the template. Pass the prompt as a- positional argument or pipe it via stdin.-- \b- Examples:- hogli devbox:task "fix CI on PR #1234"- cat prompt.txt | hogli devbox:task- """- if prompt is None and click.get_text_stream("stdin").isatty():- raise click.UsageError(- "Provide a prompt as an argument, or pipe it via stdin.\n"- 'Example: hogli devbox:task "document the ingestion pipeline"'- )- ensure_runtime_ready()- if server_supports_user_secrets() and not has_claude_oauth_secret():- click.echo(- click.style(- f"Warning: no '{CLAUDE_CODE_OAUTH_ENV}' Coder user secret set; the task will run without Claude auth.",- fg="yellow",- ),- err=True,- )- click.echo(- " Run `hogli devbox:setup --configure-claude` (or `hogli devbox:secret:set "- f"{CLAUDE_CODE_OAUTH_ENV}`) to set it.",- err=True,- )- create_task(prompt, task_name=task_name, quiet=quiet, template=template)--def _ensure_user_secrets_supported() -> None:"""Fail fast when the Coder server does not support user secrets."""if server_supports_user_secrets():diff --git a/tools/hogli-commands/hogli_commands/devbox/coder.py b/tools/hogli-commands/hogli_commands/devbox/coder.pyindex e7c87fd88bca..5d2e281ab2c3 100644--- a/tools/hogli-commands/hogli_commands/devbox/coder.py+++ b/tools/hogli-commands/hogli_commands/devbox/coder.py@@ -101,10 +101,9 @@ _RESERVED_LABEL_SUFFIXES: tuple[str, ...] = tuple(s for s in REGION_NAME_SUFFIXE# Per-user Coder secret holding the SSH public key used to sign commits inside# workspaces. Injected as the POSTHOG_GIT_SIGNING_KEY env var on every workspace-# start (including coder task runs); the workspace template reads it to populate-# user.signingkey. The matching private key never leaves 1Password. The `GIT_`-# prefix is reserved by Coder, so the workspace-side env name cannot start with-# it.+# start; the workspace template reads it to populate user.signingkey. The+# matching private key never leaves 1Password. The `GIT_` prefix is reserved by+# Coder, so the workspace-side env name cannot start with it.GIT_SIGNING_KEY_SECRET = "POSTHOG_GIT_SIGNING_KEY"@@ -1642,32 +1641,6 @@ def logs_replace(name: str, follow: bool) -> None:_run_or_exit(args)-def create_task(- prompt: str | None,- *,- task_name: str | None = None,- quiet: bool = False,- template: str = DEFAULT_TEMPLATE,-) -> None:- """Create a Coder task on the given workspace template.-- When ``prompt`` is None, ``--stdin`` is passed so coder reads the prompt- from the parent process's stdin; otherwise it is forwarded as the- positional input argument. Execs into the coder CLI so stdin, stdout,- and the exit code flow through unchanged.- """- args = ["coder", "task", "create", "--template", template]- if task_name:- args += ["--name", task_name]- if quiet:- args.append("--quiet")- if prompt is None:- args.append("--stdin")- else:- args.append(prompt)- _run_or_exit(args)--def open_in_browser(name: str) -> None:"""Open the workspace dashboard in the default browser."""username = get_username()diff --git a/tools/hogli-commands/hogli_commands/tests/test_devbox.py b/tools/hogli-commands/hogli_commands/tests/test_devbox.pyindex b3b5e10618f7..caa0a347dff4 100644--- a/tools/hogli-commands/hogli_commands/tests/test_devbox.py+++ b/tools/hogli-commands/hogli_commands/tests/test_devbox.py@@ -2978,44 +2978,6 @@ class TestSetupClaudeSecret:assert called == []-class TestDevboxTaskClaudeWarning:- """Test the Claude-secret warning printed by devbox:task."""-- def test_warns_when_secret_missing(self, monkeypatch: pytest.MonkeyPatch) -> None:- monkeypatch.setattr(devbox_cli, "ensure_runtime_ready", lambda: None)- monkeypatch.setattr(devbox_cli, "server_supports_user_secrets", lambda: True)- monkeypatch.setattr(devbox_cli, "has_claude_oauth_secret", lambda: False)- monkeypatch.setattr(devbox_cli, "create_task", lambda *a, **kw: None)-- result = runner.invoke(cli, ["devbox:task", "do something"])-- assert result.exit_code == 0- assert "no 'CLAUDE_CODE_OAUTH_TOKEN' Coder user secret set" in result.output-- def test_no_warning_when_secret_present(self, monkeypatch: pytest.MonkeyPatch) -> None:- monkeypatch.setattr(devbox_cli, "ensure_runtime_ready", lambda: None)- monkeypatch.setattr(devbox_cli, "server_supports_user_secrets", lambda: True)- monkeypatch.setattr(devbox_cli, "has_claude_oauth_secret", lambda: True)- monkeypatch.setattr(devbox_cli, "create_task", lambda *a, **kw: None)-- result = runner.invoke(cli, ["devbox:task", "do something"])-- assert result.exit_code == 0- assert "no 'CLAUDE_CODE_OAUTH_TOKEN' Coder user secret set" not in result.output-- def test_no_warning_when_server_unsupported(self, monkeypatch: pytest.MonkeyPatch) -> None:- monkeypatch.setattr(devbox_cli, "ensure_runtime_ready", lambda: None)- monkeypatch.setattr(devbox_cli, "server_supports_user_secrets", lambda: False)- called: list[bool] = []- monkeypatch.setattr(devbox_cli, "has_claude_oauth_secret", lambda: called.append(True) or False)- monkeypatch.setattr(devbox_cli, "create_task", lambda *a, **kw: None)-- result = runner.invoke(cli, ["devbox:task", "do something"])-- assert result.exit_code == 0- assert called == []--class TestDevboxSecretCommands:"""Test the devbox:secret:list / set / rm wrappers."""@@ -3095,123 +3057,6 @@ class TestDevboxSecretCommands:assert captured == ["GH_TOKEN"]-class TestCreateTask:- """Test the coder task create argv assembly."""-- @pytest.mark.parametrize(- "prompt, task_name, quiet, expected_tail",- [- ("fix CI on PR #1234", None, False, ["fix CI on PR #1234"]),- (None, None, False, ["--stdin"]),- ("do the thing", "my-task", True, ["--name", "my-task", "--quiet", "do the thing"]),- ],- )- def test_create_task_argv(- self,- monkeypatch: pytest.MonkeyPatch,- prompt: str | None,- task_name: str | None,- quiet: bool,- expected_tail: list[str],- ) -> None:- captured: list[list[str]] = []- monkeypatch.setattr(coder, "_run_or_exit", lambda args: captured.append(args))-- coder.create_task(prompt, task_name=task_name, quiet=quiet)-- assert captured == [["coder", "task", "create", "--template", "posthog-linux", *expected_tail]]-- def test_create_task_argv_uses_selected_template(self, monkeypatch: pytest.MonkeyPatch) -> None:- captured: list[list[str]] = []- monkeypatch.setattr(coder, "_run_or_exit", lambda args: captured.append(args))-- coder.create_task("do it", template="posthog-microvm")-- assert captured == [["coder", "task", "create", "--template", "posthog-microvm", "do it"]]---class TestDevboxTaskCommand:- """Test the devbox:task Click command."""-- @pytest.mark.parametrize(- "cli_args, expected",- [- (- ["devbox:task", "fix CI on PR #1234"],- {"prompt": "fix CI on PR #1234", "task_name": None, "quiet": False, "template": "posthog-linux"},- ),- (- ["devbox:task", "--name", "my-task", "-q", "do it"],- {"prompt": "do it", "task_name": "my-task", "quiet": True, "template": "posthog-linux"},- ),- (- ["devbox:task", "-t", "posthog-microvm", "do it"],- {"prompt": "do it", "task_name": None, "quiet": False, "template": "posthog-microvm"},- ),- (- ["devbox:task", "--template", "posthog-microvm", "do it"],- {"prompt": "do it", "task_name": None, "quiet": False, "template": "posthog-microvm"},- ),- ],- )- def test_options_forwarded_to_create_task(- self,- monkeypatch: pytest.MonkeyPatch,- cli_args: list[str],- expected: dict[str, object],- ) -> None:- captured: dict[str, object] = {}-- monkeypatch.setattr(devbox_cli, "ensure_runtime_ready", lambda: None)- monkeypatch.setattr(- devbox_cli,- "create_task",- lambda prompt, task_name=None, quiet=False, template="posthog-linux": captured.update(- {"prompt": prompt, "task_name": task_name, "quiet": quiet, "template": template}- ),- )-- result = runner.invoke(cli, cli_args)-- assert result.exit_code == 0- assert captured == expected-- def test_no_prompt_on_tty_errors(self, monkeypatch: pytest.MonkeyPatch) -> None:- monkeypatch.setattr(devbox_cli, "ensure_runtime_ready", lambda: None)-- class FakeTTY:- def isatty(self) -> bool:- return True-- monkeypatch.setattr(devbox_cli.click, "get_text_stream", lambda stream: FakeTTY())-- called: list[bool] = []- monkeypatch.setattr(devbox_cli, "create_task", lambda *a, **kw: called.append(True))-- result = runner.invoke(cli, ["devbox:task"])-- assert result.exit_code != 0- assert "Provide a prompt" in result.output- assert called == []-- def test_piped_stdin_passes_none_as_prompt(self, monkeypatch: pytest.MonkeyPatch) -> None:- captured: dict[str, object] = {}-- monkeypatch.setattr(devbox_cli, "ensure_runtime_ready", lambda: None)- monkeypatch.setattr(- devbox_cli,- "create_task",- lambda prompt, task_name=None, quiet=False, template="posthog-linux": captured.update(- {"prompt": prompt, "task_name": task_name, "quiet": quiet, "template": template}- ),- )-- result = runner.invoke(cli, ["devbox:task"], input="piped prompt\n")-- assert result.exit_code == 0- assert captured == {"prompt": None, "task_name": None, "quiet": False, "template": "posthog-linux"}--class TestResolveLocalSigningKey:"""Test reading user.signingkey from the engineer's local git config."""