Skip to content

fix(skills): survive missing unzip and missing temp dir on Windows - #807

Merged
gewenyu99 merged 4 commits into
mainfrom
posthog-code/skill-install-windows-fallback
Jul 6, 2026
Merged

gewenyu99 merged 4 commits into
mainfrom
posthog-code/skill-install-windows-fallback

Conversation

@gewenyu99

@gewenyu99 gewenyu99 commented Jul 6, 2026 •

Copy link
Copy Markdown
Collaborator

Windows machines often have no unzip. Sometimes the temp folder does not exist. Skill installs failed, and the failures were invisible.

Changes:

  • Try unzip, then tar, then PowerShell Expand-Archive to extract skills.
  • Create the temp folder before downloading.
  • Create the log folder before writing, so posthog-wizard.log works on Windows.
  • Send a "skill install failed" event with the platform and the error.
  • Report agent-path install failures to error tracking. They were invisible before.
  • Report log-write failures to error tracking too.
  • New tests.

Skill installs shell out to `unzip`, which stock Windows doesn't have, and
download the zip into a temp dir that isn't guaranteed to exist — so every
Windows run silently loses its skill (agent path) or dies at install
(wizard-native path). The verbose log lives in the same maybe-missing temp
dir, so those runs leave no log either.

- extract with the first tool that works: unzip → tar (bsdtar on Windows
  10+/macOS reads zip) → PowerShell Expand-Archive (win32 last resort)
- create the temp dir before curl downloads the skill zip
- create the log directory on first write failure instead of dropping every
  log line silently
- make the failure observable: `wizard: skill install failed` analytics
  event from downloadSkill (both paths), captureException on the agent's
  install_skill tool path (previously invisible), and error_detail +
  platform on the wizard-native WizardError so error tracking can separate
  missing-tool failures from network failures

Generated-By: PostHog Code
Task-Id: bcb96bcb-e37f-421d-841d-738647c73b8e
@github-actions

github-actions Bot commented Jul 6, 2026

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 error-tracking-upload-source-maps
  • /wizard-ci mcp-analytics
  • /wizard-ci misc
  • /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 error-tracking-upload-source-maps/android
  • /wizard-ci error-tracking-upload-source-maps/cicd-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-nested-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-single-stage-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-gitlab-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-pnpm-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-raw-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-ssh-vps-node-raw
  • /wizard-ci error-tracking-upload-source-maps/flutter
  • /wizard-ci error-tracking-upload-source-maps/ios
  • /wizard-ci error-tracking-upload-source-maps/next
  • /wizard-ci error-tracking-upload-source-maps/next-no-posthog
  • /wizard-ci error-tracking-upload-source-maps/node-raw
  • /wizard-ci error-tracking-upload-source-maps/node-rollup
  • /wizard-ci error-tracking-upload-source-maps/node-rollup-typescript-plugin
  • /wizard-ci error-tracking-upload-source-maps/node-webpack
  • /wizard-ci error-tracking-upload-source-maps/nuxt-3-6
  • /wizard-ci error-tracking-upload-source-maps/nuxt-4-3
  • /wizard-ci error-tracking-upload-source-maps/react-native
  • /wizard-ci error-tracking-upload-source-maps/react-vite
  • /wizard-ci error-tracking-upload-source-maps/rust
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

gewenyu99 added 2 commits July 6, 2026 16:48
…g them

When a log write still fails after the mkdir retry there's no log file to
complain in — captureException once per process (source: log-file-write,
with log_path + platform). Dynamic import of analytics because it logs
through this module; a static import back would be a cycle.

Generated-By: PostHog Code
Task-Id: bcb96bcb-e37f-421d-841d-738647c73b8e
Generated-By: PostHog Code
Task-Id: bcb96bcb-e37f-421d-841d-738647c73b8e

@sarahxsanders sarahxsanders 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.

tested on my windows PC

@sarahxsanders
sarahxsanders marked this pull request as ready for review July 6, 2026 21:32
@gewenyu99
gewenyu99 enabled auto-merge (squash) July 6, 2026 21:37
@gewenyu99
gewenyu99 merged commit 2595fc0 into main Jul 6, 2026
16 checks passed
@gewenyu99
gewenyu99 deleted the posthog-code/skill-install-windows-fallback branch July 6, 2026 21:39
gewenyu99 added a commit that referenced this pull request Jul 7, 2026
… capture-and-continue on skill install failure

Reworks three pieces of this PR per review:

1. rm .posthog-events.json shouldn't be fence-blocked (it isn't on anthropic): Bash sits in BASE_ALLOWED_TOOLS, so the claude-agent-sdk auto-approves it and canUseTool is never consulted — the install/build allowlist only ever bites on pi, where this rm was the #1 denial. wizardCanUseTool now allows exactly `rm [-f] [./].posthog-events.json` (after the operator checks, so chaining still dies), and the "don't delete it" prompt note is gone. The pi host-side cleanup stays as a safety net.

2. The read-before-write pi note treated a self-inflicted problem as a harness fence: pi's write/edit have NO read requirement (verified in pi 0.79.8 source — write is mkdir+writeFile, edit fuzzy-matches oldText; no read tracking exists). The wizard's own shared prompt line ("You must read a file immediately before attempting to write it, even if you have previously read it") is what sent agents to read nonexistent paths. That line now states the accurate rule — read existing files before editing/overwriting; never read a path that doesn't exist yet — and the pi note is deleted.

3. install_skill failure no longer halts. A freestyled integration beats an outright failure, but the run must be measurable: new [SKILL-INSTALL-FAILED] signal, STEP 2 tells the agent to emit it and continue from its own knowledge (noting the missing skill in the setup report), and both harnesses capture a `wizard: agent continued without skill` event with the detail — complementing the tool-level `wizard: skill install failed` event from #807.

Generated-By: PostHog Code
Task-Id: bcb96bcb-e37f-421d-841d-738647c73b8e
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