Fix: Prevent crashes from unhandled promise rejections (#221)#243
Closed
pottertech wants to merge 1 commit intoqwibitai:mainfrom
Closed
Fix: Prevent crashes from unhandled promise rejections (#221)#243pottertech wants to merge 1 commit intoqwibitai:mainfrom
pottertech wants to merge 1 commit intoqwibitai:mainfrom
Conversation
…ctions Fixes qwibitai#221 - Add process.on('unhandledRejection') handler with logging - Add process.on('uncaughtException') handler with graceful shutdown - Add top-level shutdown function for error handlers to call - Wrap streaming output callback in try/catch - Add retry tracking with exponential backoff in error handling This prevents the entire message loop from crashing when agents or containers throw unhandled errors. The system now: 1. Logs unhandled rejections and continues 2. Gracefully shuts down on uncaught exceptions 3. Handles errors in streaming callbacks safely Co-authored-by: Brodie Foxworth <brodie.foxworth@pottersquill.com>
Closed
5 tasks
Peyton-Spencer
added a commit
to omniaura/nanoclaw
that referenced
this pull request
Feb 16, 2026
…crashes Adopted from upstream PR qwibitai#243 by pottertech (Skip Potter): qwibitai#243 Fixes issue qwibitai#221 - Unhandled promise rejections crash the entire process Changes: 1. Add module-level unhandledRejection handler (prevents process crashes) 2. Add module-level uncaughtException handler (graceful shutdown) 3. Move error handler registration from main() to module level 4. Wrap streaming output callback in try/catch (prevents rejection propagation) 5. Connect shutdown function for error handlers to call Impact: - Prevents process crashes from unhandled rejections - Enables graceful shutdown on uncaught exceptions - Improves error recovery in streaming callbacks - Maintains service availability during agent errors Overlap with our Stability Audit (2026-02-14): - Our audit identified this as Issue #1 (CRITICAL) - Upstream PR qwibitai#243 provides production-tested implementation - This PR supersedes local fixes from audit Risk: LOW - Defensive programming only - No behavior changes to core logic - Proven in upstream testing Co-authored-by: Skip Potter <skippotter@Skips-MacBook-Air.local> Co-authored-by: Brodie Foxworth <brodie.foxworth@pottersquill.com>
This was referenced Feb 16, 2026
Peyton-Spencer
added a commit
to omniaura/nanoclaw
that referenced
this pull request
Feb 16, 2026
…crashes (#107) Adopted from upstream PR qwibitai#243 by pottertech (Skip Potter): qwibitai#243 Fixes issue qwibitai#221 - Unhandled promise rejections crash the entire process Changes: 1. Add module-level unhandledRejection handler (prevents process crashes) 2. Add module-level uncaughtException handler (graceful shutdown) 3. Move error handler registration from main() to module level 4. Wrap streaming output callback in try/catch (prevents rejection propagation) 5. Connect shutdown function for error handlers to call Impact: - Prevents process crashes from unhandled rejections - Enables graceful shutdown on uncaught exceptions - Improves error recovery in streaming callbacks - Maintains service availability during agent errors Overlap with our Stability Audit (2026-02-14): - Our audit identified this as Issue #1 (CRITICAL) - Upstream PR qwibitai#243 provides production-tested implementation - This PR supersedes local fixes from audit Risk: LOW - Defensive programming only - No behavior changes to core logic - Proven in upstream testing Co-authored-by: Skip Potter <skippotter@Skips-MacBook-Air.local> Co-authored-by: Brodie Foxworth <brodie.foxworth@pottersquill.com>
Collaborator
2 tasks
Collaborator
|
This was already fixed in #355 (merged). The .catch() handlers are in place. Thanks though! |
aviadr1
referenced
this pull request
in Garsson-io/nanoclaw
Mar 20, 2026
…tion, meta-aggregation (kaizen #243, #245, #246) Three improvements to kaizen skills that share a root cause: the reflection and analysis system was too abstract and too trusting of cached state. 1. **#246 — Concrete-to-abstract ladder** (highest leverage): Replace 4 abstract meta-reflection questions ("Are the skills asking the right questions?") with a 5-step concrete-to-abstract ladder that starts with specific friction and zooms out to mechanism design. Each step includes a concrete example from a real incident. 2. **#243 — Git-log verification** (quickest win): Gap analysis must now verify each recommendation against `git log` and merged PRs before declaring it low-hanging fruit. Prevents the stale-recommendation problem where already-fixed issues waste investigation time. 3. **#245 — Meta-finding aggregation** (foundational): New Phase 2.5 in gap-analysis that scans recent PR bodies for KAIZEN_IMPEDIMENTS, extracts type:"meta" findings, and reports patterns across sessions. Surfaces systemic friction that individual reflections miss. Zero hook changes — all modifications are in skill SKILL.md files only. The existing hook infrastructure (kaizen-reflect.sh, pr-kaizen-clear.sh) already supports the type:"meta" schema and doesn't embed the reflection questions that changed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 tasks
aviadr1
referenced
this pull request
in Garsson-io/nanoclaw
Mar 20, 2026
…tion, meta-aggregation (kaizen #243, #245, #246) (#228) Three improvements to kaizen skills that share a root cause: the reflection and analysis system was too abstract and too trusting of cached state. 1. **#246 — Concrete-to-abstract ladder** (highest leverage): Replace 4 abstract meta-reflection questions ("Are the skills asking the right questions?") with a 5-step concrete-to-abstract ladder that starts with specific friction and zooms out to mechanism design. Each step includes a concrete example from a real incident. 2. **#243 — Git-log verification** (quickest win): Gap analysis must now verify each recommendation against `git log` and merged PRs before declaring it low-hanging fruit. Prevents the stale-recommendation problem where already-fixed issues waste investigation time. 3. **#245 — Meta-finding aggregation** (foundational): New Phase 2.5 in gap-analysis that scans recent PR bodies for KAIZEN_IMPEDIMENTS, extracts type:"meta" findings, and reports patterns across sessions. Surfaces systemic friction that individual reflections miss. Zero hook changes — all modifications are in skill SKILL.md files only. The existing hook infrastructure (kaizen-reflect.sh, pr-kaizen-clear.sh) already supports the type:"meta" schema and doesn't embed the reflection questions that changed. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes issue #221 by adding global error handlers to prevent crashes from unhandled promise rejections.
Changes
Impact