fix(worker): analyze native worker aborts#1833
Conversation
|
Someone is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
Retire timed-out parse workers instead of force-terminating native parser state, and skip Monaco generated worker bundles by default while preserving explicit .gitnexusignore negation overrides. Constraint: Node native tree-sitter bindings can abort the process when a timed-out worker is terminated while inside parser state. Rejected: Falling back to sequential parsing for native stalls | it can move the same native crash onto the main thread. Confidence: high Scope-risk: moderate Directive: Keep timeout recovery from force-terminating workers until they return to JS or exit naturally. Tested: npm test; npx tsc --noEmit; npm run build; targeted analyze on /Users/wangxc/Code/keep; gitnexus detect_changes --scope staged Not-tested: Node 22 LTS runtime and non-macOS platforms
851ba93 to
a497311
Compare
|
CI Gate is currently blocked because |
|
Claude finished @magyargergo's task in 7m 40s —— View job Production-Readiness Review — PR #1833
|
|
@ChamHerry could you please look into claude's findings? |
Keep timeout recovery from immediately terminating workers that may still be inside native parser state, while making terminal pool shutdown own retired worker cleanup so long-lived processes do not accumulate retired threads. Constraint: Claude review on PR abhigyanpatwari#1833 required retiredWorkers cleanup in pool.terminate() and tripBreaker() without regressing no-immediate-terminate timeout safety. Rejected: clearing the retiredWorkers set without terminating | would remove JS bookkeeping while leaking the underlying worker thread. Confidence: high Scope-risk: moderate Directive: Preserve the distinction between recoverable timeout retirement and terminal pool shutdown; do not reintroduce immediate terminate in removeWorkerFromSlot(..., 'retire'). Tested: npx vitest run test/unit/worker-pool-timeout-retire.test.ts; npx vitest run test/unit/worker-pool-timeout-retire.test.ts test/unit/worker-pool-resilience.test.ts test/unit/worker-pool-cumulative-timeout.test.ts test/unit/worker-pool-slot-generation.test.ts; npx tsc --noEmit; npm run build; npx prettier --check src/core/ingestion/workers/worker-pool.ts test/unit/worker-pool-timeout-retire.test.ts ../docs/todo/pr-1833-retired-worker-cleanup-plan.md; npx eslint src/core/ingestion/workers/worker-pool.ts test/unit/worker-pool-timeout-retire.test.ts; gitnexus detect_changes --scope staged. Not-tested: npm test full suite did not complete green in this environment; two runs each had one unrelated test/unit/hooks.test.ts parseHookOutput null failure, and each failed hook test passed when rerun in isolation.
|
Addressed Claude findings F1/F2 in commit Changes:
Validation:
Note: I also ran the full |
Co-authored-by: Cursor <cursoragent@cursor.com>
CI Report✅ All checks passed Pipeline Status
Test Results
✅ All 9917 tests passed 4 test(s) skipped — expand for details
Code CoverageTests
📋 View full run · Generated by CI |
|
I need to merge #1838 and update this PR afterward |
Summary
monaco-workers) by default, while keeping.gitnexusignorenegation overrides available for explicit opt-in.Root cause
gitnexus analyzecould abort withlibc++abi: terminating due to uncaught exception of type Napi::Errorwhen parsing generated Monaco worker bundles. Retrying/terminating worker threads while native parser frames were still active could make the abort process-fatal.Validation
npm test— 9432 passed, 1 skippednpx tsc --noEmitnpm run buildnpx prettier --check src/config/ignore-service.ts src/core/ingestion/workers/worker-pool.ts test/unit/ignore-service.test.ts test/unit/worker-pool-timeout-retire.test.tsnpx eslint src/config/ignore-service.ts src/core/ingestion/workers/worker-pool.ts test/unit/ignore-service.test.ts test/unit/worker-pool-timeout-retire.test.ts— 0 errors; existing warnings remain intest/unit/ignore-service.test.tsnode gitnexus/dist/cli/index.js analyze --index-only --workers 4 --worker-timeout 5 /Users/wangxc/Code/keepsucceeded withRepository indexed successfullygitnexus detect_changes --scope stagedshowed high risk due worker-pool handler flows; changed files were limited to the intended fix/test scope.Notes
Local unrelated working-tree changes were intentionally excluded from this PR:
.mcp.jsondeletion andCLAUDE.mdmodification.