Skip to content

Conversation

@prosdev
Copy link
Collaborator

@prosdev prosdev commented Dec 6, 2025

Summary

Fixes ENOBUFS error when indexing repositories with many GitHub issues/PRs.

Problem

dev index would fail with ENOBUFS on repositories with extensive GitHub activity due to buffer overflow (default 1MB buffer, fetching 1000+ items with large bodies).

Solution

  • Increased maxBuffer: 1MB → 50MB for issue/PR fetching
  • Lowered default limit: 1000 → 500 items per type
  • Added --gh-limit <number> CLI flag for customization
  • Improved error messages with actionable suggestions

Usage

dev index                    # Default (500 items)
dev index --gh-limit 200     # Large repos
dev index --gh-limit 100     # Very active repos

Testing

  • ✅ All 1100+ tests passing
  • ✅ 23 new fetcher utility tests
  • ✅ Verified on 6,989 file repo with 1,000 issues/PRs

Changes

  • 6 commits: fix implementation, tests, documentation, changeset, website
  • Patches: @lytics/dev-agent, @lytics/dev-agent-cli, @lytics/dev-agent-subagents

Add 50MB maxBuffer to all execSync calls in GitHub fetcher to handle
large repositories with many issues/PRs. Previously, the default 1MB
buffer would overflow on repositories with extensive GitHub data.

Changes:
- Set maxBuffer to 50MB for issue/PR list commands
- Set maxBuffer to 50MB for individual issue/PR view commands
- Set maxBuffer to 10MB for repo name fetch (smaller payload)
- Add helpful error messages suggesting --gh-limit flag

Testing:
- 56 tests passing (2 test files)
- Existing functionality unchanged
- Error handling improved

Issue: Related to ENOBUFS error during repository indexing
Reduce default GitHub fetch limit from 1000 to 500 to prevent buffer
overflow on repositories with many issues/PRs. Add --gh-limit CLI flag
to allow users to customize the limit based on their repository size.

Changes:
- Lower default limit from 1000 to 500 in fetchIssues()
- Lower default limit from 1000 to 500 in fetchPullRequests()
- Add --gh-limit flag to 'dev index' command
- Pass limit option through to GitHubIndexer.index()
- Add inline comments explaining the limit reduction

CLI Usage:
- dev index --gh-limit 100  # Fetch only 100 issues/PRs
- dev index --gh-limit 1000 # Fetch up to 1000 (old default)
- dev gh index --limit 200  # Alternative command

Testing:
- 62 tests passing (3 test files)
- CLI command integration tests pass
- GitHub indexer tests pass

Issue: Related to ENOBUFS error during repository indexing
Add comprehensive unit tests for GitHub CLI fetcher functions to verify:
- Default limit is now 500 (reduced from 1000)
- Custom limits work correctly via options
- maxBuffer is set appropriately (50MB for lists, 10MB for repo name)
- Helpful error messages on ENOBUFS and maxBuffer exceeded
- All required JSON fields are included in gh CLI commands
- Buffer size management across different operation types

Test Coverage:
- 23 new tests for fetcher utilities
- Total: 79 tests passing (3 test files)
- Tests gh CLI installation/authentication detection
- Tests default and custom limit behavior
- Tests improved error handling with user guidance
- Tests buffer management strategy

Testing:
- All 79 GitHub-related tests passing
- New tests use proper mocking of execSync
- Mock returns match actual execSync behavior (strings with encoding)

Issue: Related to ENOBUFS error during repository indexing
Update documentation to reflect the fix for ENOBUFS errors during GitHub
indexing and the new default limit of 500 items.

Changes:
- TROUBLESHOOTING.md: Add comprehensive ENOBUFS troubleshooting section
  - Explain the error cause (buffer overflow)
  - Provide solutions with --gh-limit flag examples
  - Give repository size-based recommendations
  - Document batch indexing strategy

- packages/cli/README.md: Document new index command flags
  - Add --gh-limit flag documentation
  - Provide guidance for different repository sizes
  - Update index command options section

- packages/subagents/src/github/README.md: Update GitHub agent docs
  - Change default limit from 100 to 500 in configuration docs
  - Add limit recommendations based on repository size
  - Document new buffer management (50MB/10MB)
  - Add ENOBUFS error to error handling section
  - Update performance considerations with new batch sizes
  - Add ENOBUFS troubleshooting section with solutions
  - Update test coverage stats (79 total tests)

User Guidance:
- Default 500 limit works for most repos
- Large repos (200+): Use --gh-limit 100-200
- Very active repos (500+): Use --gh-limit 50-100
- Batch indexing available for very large repositories

Testing:
- All 1100+ tests passing
- Documentation accuracy verified

Issue: Related to ENOBUFS error during repository indexing
Update The Drill to reflect concise, focused PR descriptions rather than
verbose ones. Context is important but excessive noise makes PRs harder
to parse.

Principles:
- Focus on essential information
- Include the 'why' and key decisions
- Provide usage examples and verification details
- Exclude verbose change logs and obvious information

Based on PR #125 as a good example.
@prosdev prosdev merged commit 360e2cb into main Dec 6, 2025
1 check passed
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