-
-
Notifications
You must be signed in to change notification settings - Fork 53.1k
Description
Date: 2026-01-02
Severity: High (Blocks build)
Status: Unresolved
Upstream Issue: https://github.com/steipete/clawdis (not yet reported)
Summary
After pulling the latest updates from the Clawdis main branch (commit fabad7aa), the build fails due to a broken pnpm patch file for the @mariozechner/pi-ai dependency. The patch file fails to apply with "hunk header integrity check failed" error.
Environment
- Clawdis Version: 2.0.0-beta4
- Node Version: >=22.12.0 (as per package.json)
- pnpm Version: 10.23.0
- Platform: macOS (Darwin 25.2.0)
- Installation Path:
~/.clawdis-src
Steps to Reproduce
- Start with a working Clawdis installation at commit
5c7c1af4 - Pull latest updates from upstream:
git -C ~/.clawdis-src pull origin main - Attempt to install dependencies:
pnpm --dir ~/.clawdis-src install
Error Output
ERR_PNPM_INVALID_PATCH Applying patch "/Users/username/.clawdis-src/patches/@mariozechner__pi-ai.patch" failed: hunk header integrity check failed
Root Cause Analysis
The patch file patches/@mariozechner__pi-ai.patch was updated in the upstream pull (88 line changes), but the patch hunks no longer match the actual code in the @mariozechner/pi-ai@0.31.1 package from npm.
This suggests:
- The patch was regenerated against a different version of the dependency, OR
- The dependency version was updated but the patch wasn't regenerated, OR
- There's a mismatch between the patch file and the actual package structure
Impact
Build Failures
Without the patch applied, TypeScript compilation fails with 29+ type errors:
src/agents/clawdis-tools.ts(1758,32): error TS2345: Argument of type '"reactions"' is not assignable to parameter of type 'never'.
src/agents/clawdis-tools.ts(1772,32): error TS2345: Argument of type '"reactions"' is not assignable to parameter of type 'never'.
// ... 27 more similar errors
src/tui/message-list.ts(59,11): error TS2552: Cannot find name 'MessageEntry'. Did you mean 'MessageEvent'?Additional Issues
Also discovered that discord-api-types was missing as an explicit dependency, causing additional build errors:
src/discord/send.ts(2,32): error TS2307: Cannot find module 'discord-api-types/payloads/v10' or its corresponding type declarations.Workarounds Attempted
❌ Failed Attempts
- Remove node_modules and reinstall - Patch still fails
- Temporarily remove patch from package.json - Build fails with type errors
- Disable
noEmitOnErrorin tsconfig.json - Build still exits with error code - Add missing discord-api-types - Fixed discord errors but core type errors remain
- Regenerate patch with
pnpm patch- Cannot create workspace because patch application fails
✅ Working Workarounds
Option 1: Use Existing Pre-Update Build (Recommended)
The previous build from commit 5c7c1af4 still works:
# Existing binary works fine
clawdis --version # → 2.0.0-beta5
clawdis gatewayPros:
- No changes needed
- Fully functional
- Custom skills load correctly from
~/.clawdis/skills/
Cons:
- Doesn't include latest features from the update
Option 2: Development Mode with tsx
Run TypeScript directly without compilation:
pnpm --dir ~/.clawdis-src clawdis gatewayPros:
- Gets latest code features
- Bypasses compilation errors
Cons:
- Slightly slower startup
- Requires running via pnpm command
Option 3: Rollback to Previous Commit
git -C ~/.clawdis-src reset --hard 5c7c1af4
pnpm --dir ~/.clawdis-src install
pnpm --dir ~/.clawdis-src run buildPros:
- Clean, working build
Cons:
- Loses all updates from the pull
Related Files
~/.clawdis-src/patches/@mariozechner__pi-ai.patch- Broken patch file (3.6KB)~/.clawdis-src/package.json- Patch configuration (lines 137-140)~/.clawdis-src/src/agents/clawdis-tools.ts- File with type errors (lines 1758-2235)~/.clawdis-src/src/discord/send.ts- Missing discord-api-types imports~/.clawdis-src/src/tui/message-list.ts- Missing MessageEntry type (line 59)
Commits Involved
- Before:
5c7c1af4- Working build - After:
fabad7aa- Broken build (426 files changed, +36,581 insertions, -4,010 deletions)
Temporary Changes Made
To enable workarounds, the following temporary modifications were made:
-
Added missing dependency:
pnpm --dir ~/.clawdis-src -w install discord-api-types # Added: discord-api-types ^0.38.37
-
Modified tsconfig.json:
"noEmitOnError": false // Changed from true
-
Modified package.json (reverted):
- Temporarily removed
@mariozechner/pi-aifrompatchedDependencies - Later restored to preserve patch configuration
- Temporarily removed
Recommendations for Upstream
- Regenerate the patch file against the current version of
@mariozechner/pi-ai@0.31.1 - Add discord-api-types as explicit dependency in package.json
- Verify patch application in CI/CD before merging
- Document patch purpose - Add comments explaining what the patch fixes
How to Regenerate Patch (For Maintainers)
# Remove the broken patch temporarily from package.json
# Then create a new patch:
pnpm patch @mariozechner/pi-ai
# Edit files in the temporary directory shown
# Save changes:
pnpm patch-commit /path/to/temp/dir