[1128] feat: error-interception-middleware (3/3) - #47
Closed
myk1yt wants to merge 13 commits into
Closed
Conversation
…ask keys getTaskState guarded only falsy keys and the module-level getTaskErrorState/hasTaskErrorState had no guard at all, so a primitive non-null key (e.g. a string taskId, an easy mistake since InterceptorOptions.taskId is a string) still threw TypeError on WeakMap.set(). Both accessors now fail open: invalid keys get an ephemeral state that is never stored, matching the existing fail-open philosophy.
# Conflicts: # src/core/tools/error-interception/ToolErrorInterceptor.ts
…and is_error in tool error results
formatStructuredError hardcoded retryable/occurrence/disposition for every
error, telling the model that terminal failures (e.g.
TERMINAL/PROVIDER_SWITCH/003) were first-occurrence retryable errors and
encouraging retry loops.
- derive retryability from the error: terminal/shell/provider-switch
machine codes, validation errors, and user rejections are non-retryable
- count per-task occurrences of identical failures via TaskErrorState and
escalate disposition to change_strategy at the stuck-loop threshold
(await_user for user rejections)
- mark handleError tool_results with is_error, matching the sibling error
paths (validation, rejection, missing nativeArgs, unknown tool)
- emit slash-free dotted type strings and keep <error_details> JSON valid
under byte-limit pressure instead of truncating mid-document
- show a concise human message in say("error") instead of the full JSON
blob; the structured payload stays in the tool result only
…gration test (PR Zoo-Code-Org#1128) CI failure: Code QA Roo Code run 31224455758 failed @roo-code/vscode-e2e#lint with 2 errors (@typescript-eslint/no-require-imports) and 2 warnings (unused no-var-requires directives). Same legacy-rule-name issue as PR Zoo-Code-Org#1126. Run: https://github.com/Zoo-Code-Org/Zoo-Code/actions/runs/31224455758
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack Position
feat/error-interception-middlewareDescription
Full Feature Description
feat/error-interception-middlewaresrc/core/tools/error-interceptionand the final integration pointpresentAssistantMessage.ts. Maintained as an internal middleware boundary without changing public provider/tool contracts.UNCLASSIFIEDwhile 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 tocorrect_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.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
Connects the interception runtime to
presentAssistantMessage.ts. Generates a structured recovery message only once per error, preserving normal assistant content and the legacy error path.Included Files
src/core/assistant-message/presentAssistantMessage.tssrc/core/assistant-message/__tests__/presentAssistantMessage.error-interception.spec.tsExclusion Scope
Summary by CodeRabbit
Upstream PR: Zoo-Code-Org#1128