Skip to content

fix(mcp-analytics): hand off for blocked installs - #252

Draft
sarahxsanders wants to merge 2 commits into
mainfrom
posthog-code/mcp-analytics-install-handoff
Draft

fix(mcp-analytics): hand off for blocked installs#252
sarahxsanders wants to merge 2 commits into
mainfrom
posthog-code/mcp-analytics-install-handoff

Conversation

@sarahxsanders

@sarahxsanders sarahxsanders commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

What it changes

This is the instruction sheet the AI agent follows to add PostHog to a project. Before, a blocked package install ended the run with an [ABORT]. This PR changes that: a sandbox-blocked install is treated as expected, not a failure. The agent finishes all the code changes and emits a non-fatal [MANUAL-STEP] line carrying the exact install command, so the run ends as a success with one step left, not an error.

It removes the manual install required abort case and rewrites STEP 3 (install) and STEP 7 (verify) so the agent never bails on a blocked install and never fakes a green summary on a project whose packages aren't installed.

Why it is a handoff, not an abort

The agent runs inside a sandbox, a locked-down space that can only write inside the project folder. That limit is deliberate, and it is a security measure. The agent is driven by an LLM, and an LLM can be steered by the text it reads, so the sandbox keeps a bad or hijacked run from touching anything outside the project you pointed it at.

In a monorepo the install has to write a shared node_modules that lives above the project folder, which is outside the sandbox, so it fails. We are not loosening that boundary. Letting installs run outside the sandbox would also let the install scripts that ship inside packages run outside it, and running unknown code with full access to your machine is exactly what the sandbox exists to prevent. So the install genuinely belongs to a human.

The old approach modeled that as an abort. But an abort is a hard stop, and the agent usually installs before it writes code, so it would bail before doing any work. Weaker models also can't reliably do "install fails, keep going anyway, then abort at the end." Making the blocked install a non-fatal [MANUAL-STEP] fixes both: the agent always finishes the code changes, and the leftover install is surfaced honestly as one remaining step.

User experience

The wizard still can't tell you "configured!" when it isn't. It finishes everything the agent can do, then hands off honestly: instead of a false success or a red error, the user gets a green success with the exact install command as the one step left.

Merge order

These three PRs are one fix in three parts. Merge in this order:

  1. wizard #920: base of the wizard stack, merge first.
  2. wizard #929: stacked on #920, merge after it.
  3. context-mill #252: release after #929, so the skill and the wizard light up together.

This PR is step 3. It is inert until #929 is live, and #929 is inert until this is, so they go together.

Nothing breaks if they land out of order. #929 and #252 are each harmless on their own; they just do nothing until both are live.

🤖 Generated with Claude Code

…omplete

A wizard run instrumented a monorepo MCP server, but `yarn add` failed
(the install had to write a hoisted node_modules outside the sandboxed
working dir → EPERM). The agent misread it as a network issue, ignored the
resulting `tsc` "Cannot find module" failure, and reported success anyway —
leaving the user a green "configured!" on a project that didn't compile.

Harden the skill so it can't fake success:
- STEP 3: if the install fails, don't hand-edit package.json; make the
  additive edits so they're ready, but the run must end at STEP 7 with the
  abort, never a success summary.
- STEP 7: a `Cannot find module '@posthog/mcp'` / unresolved `posthog`
  import means the install never happened — abort, don't patch around it.
- Abort cases: add `[ABORT] manual install required: <command>` carrying the
  exact install command.

Pairs with wizard #929, which renders this abort as a clear handoff (skill,
report, and edits are left in place so the user can finish in their own AI
tool) and, via #920, does not report it to error tracking.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

@gewenyu99 gewenyu99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff, but I am mildly concerned by using the abort pattern. Maybe this should all be come form of end state instead of "abort" because I think the agent will abort as soon as it hits the problem instead of finishing the job best it can before aborting

Comment thread context/skills/mcp-analytics/description.md Outdated
@sarahxsanders
sarahxsanders marked this pull request as draft July 20, 2026 19:51
…ot an abort

A sandbox-blocked install is expected, not a failure. Instead of aborting, the
skill now tells the agent to finish all the code changes and emit a [MANUAL-STEP]
line with the exact install command, so the run ends as a success with one step
left. Removes the manual-install abort case; rewrites STEP 3 and STEP 7.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sarahxsanders sarahxsanders changed the title fix(mcp-analytics): abort with a handoff when the SDK install can't complete fix(mcp-analytics): hand off a blocked install as a non-fatal step, not an abort Jul 20, 2026
@sarahxsanders sarahxsanders changed the title fix(mcp-analytics): hand off a blocked install as a non-fatal step, not an abort fix(mcp-analytics): hand off a blocked install as a non-fatal step Jul 20, 2026
@sarahxsanders sarahxsanders changed the title fix(mcp-analytics): hand off a blocked install as a non-fatal step fix(mcp-analytics): hand off a blocked install Jul 20, 2026
@sarahxsanders sarahxsanders changed the title fix(mcp-analytics): hand off a blocked install fix(mcp-analytics): hand off for blocked installs Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants