Skip to content

fix(cli): Homebrew post-install writes setup into a throwaway HOME, so completions and agent skills are never installed #1545

Closed

Description

@dippi

Problem

Installing via the documented Homebrew path does not set up shell completions or the agent skill, even though the formula's post-install runs sentry cli setup. The docs state the Homebrew install does this:

  • apps/cli-docs/src/content/docs/agentic-usage.md: "The curl installer and Homebrew run sentry cli setup, which installs agent skills into detected agent root directories (~/.claude, ~/.agents)."
  • apps/cli-docs/src/content/docs/getting-started.mdx (Installation → Package Managers): "Unlike the install script and Homebrew, package manager installs don't set up shell completions or agent skills."

Both are false for the Homebrew path: on a fresh install neither ~/.local/share/zsh/site-functions/_sentry nor ~/.agents/skills/sentry-cli/SKILL.md exists.

Reproduction

brew install getsentry/tools/sentry

ls ~/.agents/skills/sentry-cli/SKILL.md        # ENOENT
ls ~/.local/share/zsh/site-functions/_sentry   # ENOENT

# Running the formula's own command by hand (same flags) works and installs everything:
sentry cli setup --method brew --no-modify-path
# Recorded installation method: brew
# Completions: Installed to /Users/<me>/.local/share/zsh/site-functions/_sentry
# Agent skills: Installed to /Users/<me>/.agents/skills/sentry-cli/SKILL.md

Cause

The formula template in getsentry/toolkit (.craft.yml, lines 80-82) defines:

def post_install
  system bin/"sentry", "cli", "setup", "--method", "brew", "--no-modify-path"
end

Homebrew runs post_install under an isolated temporary HOME that it deletes afterwards, so anything written there is discarded. Library/Homebrew/formula.rb → run_post_install:

Dir.mktmpdir("#{name}-postinstall-", HOMEBREW_TEMP) do |home|
  postinstall_home = Pathname(home)
  new_env.merge!(common_sandbox_env(postinstall_home))
  setup_home postinstall_home
  ...

common_sandbox_env sets HOME (and XDG_CONFIG_HOME) to that temp dir. Three distinct effects follow:

  1. Completions are written but thrown away. sentry cli setup writes $HOME/.local/share/zsh/site-functions/_sentry into the temp HOME, which is deleted on exit.
  2. Agent skills are never written at all. Skill install only targets ~/.agents / ~/.claude, and agent-root detection (packages/cli/src/lib/agent-skills.ts) finds neither inside the empty temp HOME, so it skips.
  3. The install-method record is lost too. setInstallInfo({ method: "brew" }) writes $XDG_CONFIG_HOME/sentry/cli.db, also under the temp dir.

sentry cli setup is not at fault — it faithfully writes to the HOME it is given.

Impact

  • Documented behavior is broken: Homebrew users silently get no completions and no agent skill, and must know to run sentry cli setup manually (undocumented for this path).
  • When users upgrade the standard Homebrew way (brew upgrade), the same sandboxed post_install runs, so completions and skills are never created or refreshed.

Evidence

  • Homebrew post-install log ~/Library/Logs/Homebrew/sentry/post_install.01.sentry.log shows a temp home:

    Completions: Installed to /private/tmp/s-XXXXXX/sentry-postinstall-.../.local/share/zsh/site-functions/_sentry
          Add to your .zshrc: fpath=("/private/tmp/.../site-functions" $fpath)
    

    (no "Agent skills" line — detection found no agent root in the temp HOME).

  • On the same machine, the Cellar install is timestamped 17:39, while ~/.agents/skills/sentry-cli/SKILL.md and ~/.local/share/zsh/site-functions/_sentry are stamped 17:44:57 — i.e. they appeared only after the manual sentry cli setup.

  • brew also emits Warning: Calling post_install is deprecated! Use post_install_steps instead.

  • Environment: macOS Apple Silicon, Homebrew 7.0.10-14-g1bb6afa, sentry 0.47.0, formula getsentry/tools/sentry.

Possible fixes

  • Completions: install them Homebrew-natively from inside install, which places them in Homebrew's shared completion dirs (already on users' fpath) and needs no $HOME:

    generate_completions_from_executable(bin/"sentry", "cli", "completion", shells: [:bash, :zsh, :fish])
  • Agent skills + install metadata: these must live in $HOME, so post_install cannot do it. Drop it and add a def caveats block telling users to run sentry cli setup (and to re-run it after brew upgrade). Update apps/cli-docs/.../agentic-usage.md and getting-started.mdx to reflect the manual step for the Homebrew path.

  • Migrating post_install → post_install_steps would silence the deprecation warning but not fix the behavior, since those steps run under the same temp HOME.

Activity

  1. linear-code commented on Oct 19, 2026

    @linear-code
  2. added a commit that references this issue on Nov 1, 2026
    36d7aa5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions