Skip to content

fix(apex-router): prevent crash when messages is undefined#172

Open
hernandez42 wants to merge 3 commits into
OpenBMB:mainfrom
hernandez42:fix/apex-router-messages-undefined
Open

fix(apex-router): prevent crash when messages is undefined#172
hernandez42 wants to merge 3 commits into
OpenBMB:mainfrom
hernandez42:fix/apex-router-messages-undefined

Conversation

@hernandez42

Copy link
Copy Markdown

Summary

Fix runtime crash in apex-router plugin caused by accessing .length on undefined messages.

Root Cause

Cannot read properties of undefined (reading .length) in apex_router_bridge.ts.

Changes

  • plugins/apex-router/apex_router_bridge.ts: add guard in shouldDebate(), use Array.isArray() in decide()

Severity

Medium — crashes PilotDeck server, causing total service outage.

Xuanji added 3 commits June 5, 2026 13:15
Root cause: tsx wrapper does NOT forward SIGTERM to its child node process.
When McpClient.close() was called, only the tsx process received SIGTERM,
leaving the playwright-mcp node and Chromium grandchild processes orphaned.

Fix: capture the tsx PID and use kill(-pid, SIGKILL) in close() to
atomically wipe the entire process tree (tsx → node → Chromium).

This permanently fixes the playwright browser leak issue where sessions
accumulated 30+ orphaned Chromium processes over time.
- Add guard in shouldDebate() to check messages existence before accessing length
- Use Array.isArray() in decide() for safer type check on input.request.messages
- Fixes: Cannot read properties of undefined (reading 'length')
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