Skip to content

Fix one-click deploy: valid WASM, icp-cli manifest, wasm auto-discovery#64

Merged
johnnyclem merged 1 commit into
mainfrom
fix/one-click-deploy
Jul 13, 2026
Merged

Fix one-click deploy: valid WASM, icp-cli manifest, wasm auto-discovery#64
johnnyclem merged 1 commit into
mainfrom
fix/one-click-deploy

Conversation

@johnnyclem

Copy link
Copy Markdown
Owner

Fixes the init → package → deploy --network local onboarding flow, which failed at every step past packaging.

Root causes found

  1. generateWasm emitted structurally invalid WASM — the replica rejected it with IC0505 ("Failed to decode wasm module ... offset 0xb"). The hand-rolled encoder had a missing custom-section name-length prefix, wrong func-type encodings (no result count), 4 exports pointing at only 2 declared functions, malformed memory/code/data sections, and unsigned LEB where signed is required.
  2. deploy routed to icp-cli with no project manifest and no project root — icp-cli walked up the directory tree and choked on unrelated icp.yaml files (e.g. AgentVault's own internal-format one), and could never deploy a bare WASM anyway.
  3. init's next-steps said deploy --network local but the wasm argument was required.

Changes

  • Rewrote the WASM section encoding in compiler.ts; every generated module is now checked with WebAssembly.validate before being returned, and validateWasmFile runs full engine validation instead of magic-byte checks.
  • agentvault package now writes an icp-cli-compatible icp.yaml (script build step copying the packaged WASM — avoids the remote recipe registry, whose templates aren't compatible with all icp-cli binary versions). Marker-guarded: user-managed manifests are never overwritten.
  • deployWithIcpCli pins --project-root-override to the agent project, generates the manifest if missing, and auto-starts the local network in the background when it isn't running.
  • deploy's wasm argument is now optional — auto-discovers dist/<name>.wasm via agent.json.
  • Version bumped to 1.0.6 (1.0.5 on npm lacks these fixes).

Verification

  • 1,516 tests pass (16 new: manifest generation, icp-cli deploy path, WASM validity/instantiation).
  • Full E2E from a packed tarball in a clean directory with icp-cli 0.1.0 and no dfx:
    npx agentvault init clem-agent --template minimalpackage ./deploy --network local --yes deploys a canister to the auto-started local network (Canister ID 4ld2s-rd777-77775-aaaaq-cai).

🤖 Generated with Claude Code

…oot pinning, wasm auto-discovery

- generateWasm emitted structurally invalid modules (missing custom-section
  name length, wrong func-type encoding, exports pointing at undeclared
  functions, malformed code/memory/data sections) — rewritten to emit
  spec-valid WASM, guarded by WebAssembly.validate; validateWasmFile now
  runs full engine validation instead of magic-byte checks
- deploy via icp-cli now generates an icp.yaml manifest for the packaged
  WASM, pins --project-root-override so unrelated parent manifests are
  never picked up, and auto-starts the local network in the background
- deploy's wasm argument is optional: auto-discovers dist/<name>.wasm via
  agent.json, matching the init onboarding instructions
- agentvault package writes the icp.yaml manifest (marker-guarded, never
  overwrites user-managed manifests)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-vault Canceled Canceled Jul 13, 2026 7:21pm
agentvault Ready Ready Preview, Comment Jul 13, 2026 7:21pm

@johnnyclem
johnnyclem merged commit f533d74 into main Jul 13, 2026
4 of 5 checks passed
@johnnyclem
johnnyclem deleted the fix/one-click-deploy branch July 13, 2026 23:27
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.

1 participant