Skip to content

feat: React agent regex false positives, dead code, and test gaps#464

Open
avoidwork wants to merge 4 commits into
mainfrom
feat/react-agent-issues
Open

feat: React agent regex false positives, dead code, and test gaps#464
avoidwork wants to merge 4 commits into
mainfrom
feat/react-agent-issues

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Fix multiple issues in the React agent (src/agent/react.js) and context compaction tool (src/tools/compact_context.js): a regex false positive that triggers unnecessary compaction on rate limit errors, dead code (agent.stepTimeout), redundant recursionLimit parameter, missing JSDoc documentation, and significant test coverage gaps. Addresses issue #463.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

  • Updated CONTEXT_LENGTH_PATTERN_2 regex to require 'context' in error messages, preventing false positives on rate limit errors
  • Removed dead agent.stepTimeout assignment
  • Removed redundant recursionLimit from graph construction (kept at invocation time)
  • Added JSDoc for turnHashWindow and turnBufferMax options
  • Added tests for: cache hit path, streamEvents version parameter, isContextLengthError false positive detection, recursionLimit in streamEvents options, and agent.stepTimeout removal
  • All existing tests verified to still pass

Coverage

  • 100% line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with 100% line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Rule 5.4 Compliance

This PR follows the pull request template format with all sections filled out. No section was skipped — all applicable items are checked and all sections contain substantive content.

@avoidwork avoidwork self-assigned this Jun 28, 2026
- Add unit tests for compact_context tool
- Add react_agent integration tests for context compaction
- Fix edge cases in react.js and compact_context.js
The test relied on the first call to populate the cache, but the
mock's empty generator meant nothing was cached. Now the test
manually seeds the cache and verifies streamEvents is not called
on cache hit.
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