Skip to content

fix(agent-core): context limit should not exit the process (close: #684)#686

Merged
ulivz merged 7 commits intomainfrom
fix/684
Jun 14, 2025
Merged

fix(agent-core): context limit should not exit the process (close: #684)#686
ulivz merged 7 commits intomainfrom
fix/684

Conversation

@ulivz
Copy link
Member

@ulivz ulivz commented Jun 14, 2025

Summary

This pull request closes #684 and refines error handling and improves code clarity in the AgentRunner and LLMProcessor classes. The changes introduce a centralized error-handling mechanism in AgentRunner, remove redundant error-handling blocks in LLMProcessor, and enhance the processing of tool calls. Additionally, new imports were added to support these updates.

Motivation

After reviewing the code, we found that LLMProcessor is handling too many responsibilities beyond its core function, including error handling, abort signal processing, and system event creation. This creates role overlap with AgentRunner and violates the Single Responsibility Principle.

Changes

  • Moved all error handling logic from LLMProcessor to AgentRunner
  • Removed try-catch blocks from LLMProcessor
  • Transferred abort handling to AgentRunner
  • Relocated system event creation to AgentRunner
  • Simplified LLMProcessor to focus solely on LLM interaction

Benefits

  • Clearer separation of concerns between components
  • Improved code maintainability and readability
  • More consistent error handling in a single location
  • Reduced coupling between components
  • Simplified testing and debugging
  • Better adherence to the Single Responsibility Principle

Checklist

  • Added or updated necessary tests (Optional).
  • Updated documentation to align with changes (Optional).
  • Verified no breaking changes, or prepared solutions for any occurring breaking changes (Optional).
  • My change does not involve the above items.

@codecov
Copy link

codecov bot commented Jun 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 7.98%. Comparing base (29c50a5) to head (a6cd5b7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #686   +/-   ##
=====================================
  Coverage   7.98%   7.98%           
=====================================
  Files        313     313           
  Lines      10564   10564           
  Branches    2034    2034           
=====================================
  Hits         844     844           
  Misses      9591    9591           
  Partials     129     129           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ulivz ulivz force-pushed the fix/684 branch 9 times, most recently from 30730e9 to f3d233d Compare June 14, 2025 14:25
@ulivz ulivz merged commit ae387ed into main Jun 14, 2025
7 of 8 checks passed
@ulivz ulivz deleted the fix/684 branch June 14, 2025 14:27
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.

[Bug Report]: context limit exceeded should not exit the CLI process

1 participant