fix(executor): pattern match more errors to prevent swallow#2802
fix(executor): pattern match more errors to prevent swallow#2802
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR improves error handling by using a centralized error extraction system that pattern-matches multiple API error formats, preventing error message swallowing. The main change refactors Additionally, the PR includes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Client/Agent
participant Utils as tools/utils.ts
participant API as External API
participant Extractor as error-extractors.ts
Client->>Utils: executeRequest(toolId, tool, params)
Utils->>API: fetch(url, method, headers, body)
alt API responds with error
API-->>Utils: Response (!ok)
Note over Utils: Try to parse error response
Utils->>Utils: Try JSON parse
alt JSON parse succeeds
Note over Utils: errorData = JSON object
else JSON parse fails
Utils->>Utils: Try text parse
alt Text parse succeeds
Note over Utils: errorData = plain text string
else Text parse fails
Note over Utils: errorData = null
end
end
Utils->>Extractor: extractErrorMessage({status, statusText, data})
Note over Extractor: Iterate through error patterns:<br/>1. GraphQL errors<br/>2. Twitter errors<br/>3. Standard message<br/>4. Plain text data<br/>5. HTTP status text
alt Pattern matches
Extractor-->>Utils: Extracted error message
else No pattern matches
Extractor-->>Utils: "Request failed with status {status}"
end
Utils->>Utils: throw new Error(message)
Utils-->>Client: ToolResponse { success: false, error }
else API responds successfully
API-->>Utils: Response (ok)
Utils->>Utils: transformResponse(response)
Utils-->>Client: ToolResponse { success: true, output }
end
|
There was a problem hiding this comment.
Additional Comments (2)
-
apps/sim/stores/panel/copilot/store.ts, line 1226-1240 (link)style: removed auto-allowed tools behavior that previously auto-executed certain integration tools
Verify that workflows using
exa_*orgoogle_calendar_*tools still work correctly with the new user confirmation requirement. Was the auto-allowed tools feature intentionally removed, or should some tools still auto-execute without user confirmation? -
apps/sim/stores/panel/copilot/store.ts, line 1866-1874 (link)style: changed from blocking
awaitto non-blockingPromise.resolve().then()for sub-agent tool executionThis could cause issues if subsequent code expects the tool to complete before continuing. The promise chain is fire-and-forget, so errors are logged but not propagated. Is this intentional to improve responsiveness, or could this lead to race conditions where UI updates before tools finish?
25 files reviewed, 2 comments
Summary
Pattern match more error types to reduce swallow
Type of Change
Testing
Manual
Checklist