Skip to content

feat: error-interception-middleware (2/3) - #1126

Open
myk1yt wants to merge 3 commits into
Zoo-Code-Org:mainfrom
myk1yt:pr/b02-error-runtime-v2
Open

feat: error-interception-middleware (2/3)#1126
myk1yt wants to merge 3 commits into
Zoo-Code-Org:mainfrom
myk1yt:pr/b02-error-runtime-v2

Conversation

@myk1yt

@myk1yt myk1yt commented Aug 4, 2026

Copy link
Copy Markdown

Stack Position

Description

스크린샷 2026-07-30 171807 스크린샷 2026-07-30 171827

Full Feature Description

  • Feature Branch: feat/error-interception-middleware
  • Feature Name: Error Interception Middleware
  • Purpose: Resolves the problem where errors occurring at tool, parser, validation, and provider boundaries are delivered only as unstructured strings, causing the model to repeat the same incorrect call or leaving users unable to determine the cause and recovery method. Classifies errors into stable categories, retry policies, and occurrence-aware recovery dispositions without losing the original error, converting them into structured recovery guidance.
  • Full Change Description: B01 defines the classification category, signal, result, pattern priority, and guidance payload contracts. B02 adds the interception runtime that validates and transforms classifier results and manages task-scoped occurrence/error state. B03 connects this runtime to assistant-message presentation exactly once, showing recoverable messages to both the user and the model.
  • Impact Scope: Affects all of src/core/tools/error-interception and the final integration point presentAssistantMessage.ts. Maintained as an internal middleware boundary without changing public provider/tool contracts.
  • Errors and Edge Cases: Unknown errors are treated as UNCLASSIFIED while preserving the original text and cause. On transformation or structural validation failure, falls back to the original error. If presentation itself fails, interception is not recursively invoked. Repeated occurrences of the same fingerprint escalate to correct_once, change_strategy, await_user, etc. based on occurrence count, without producing duplicate messages. Metadata does not include sensitive values such as commands, absolute paths, or raw arguments.
  • Testing Method: Run B01's category precedence, known/unknown classification, and redaction tests, B02's transformation/validation/state reset/recursion tests, and B03's one-time integration and legacy behavior regression tests. Manually trigger known tool errors and unclassified errors respectively, verifying that structured guidance is shown only once and that original technical information and the normal task error path are preserved.

Why Split Into 17 PRs

Instead of submitting this feature as a single unified PR, it was split into individual PRs because as code size grows, safely reviewing a PR becomes very difficult. The feature was broken into mutually exclusive individual PRs so that each can be reviewed independently.

What This PR Specifically Changes

Adds interceptor, message transformer, structural validator, task-scoped occurrence/error state, and original error fallback using B01 contracts. Does not change presentAssistantMessage.ts.

Included Files

  • src/core/tools/error-interception/ToolErrorInterceptor.ts
  • src/core/tools/error-interception/StructuralValidator.ts
  • src/core/tools/error-interception/TaskErrorState.ts
  • src/core/tools/error-interception/MessageTransformer.ts
  • Direct unit tests for the same module

Exclusion Scope

  • src/core/assistant-message/presentAssistantMessage.ts and B03 integration test
  • Duplicate changes to contracts/classifier already merged in B01
  • All items in the common removal rules

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@myk1yt, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 36632ade-6c34-4c2d-a3f3-2fe331bba010

📥 Commits

Reviewing files that changed from the base of the PR and between 7918f6b and 2a2c75f.

📒 Files selected for processing (14)
  • codecov.yml
  • src/core/tools/error-interception/ErrorClassifier.ts
  • src/core/tools/error-interception/MessageTransformer.ts
  • src/core/tools/error-interception/StructuralValidator.ts
  • src/core/tools/error-interception/TaskErrorState.ts
  • src/core/tools/error-interception/ToolErrorInterceptor.ts
  • src/core/tools/error-interception/__tests__/ErrorClassifier.spec.ts
  • src/core/tools/error-interception/__tests__/MessageTransformer.spec.ts
  • src/core/tools/error-interception/__tests__/StructuralValidator.spec.ts
  • src/core/tools/error-interception/__tests__/TaskErrorState.spec.ts
  • src/core/tools/error-interception/__tests__/ToolErrorInterceptor.spec.ts
  • src/core/tools/error-interception/errorPatterns.ts
  • src/core/tools/error-interception/index.ts
  • src/core/tools/error-interception/types.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Aug 4, 2026
Patch coverage checks were blocking 10+ PRs with 80%/70% thresholds.
Changed to informational: true so patch coverage is reported but not
a required status check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant