feat(workspace-events): add agent tool error event - #6689
feat(workspace-events): add agent tool error event#6689BillLeoutsakosvl346 wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Trace span building now derives tool errors from multiple provider shapes via The log trace detail panel labels spans with Reviewed by Cursor Bugbot for commit 1bd73bd. Bugbot is set up for automated code reviews on this repo. Configure here. |
File breakdownTool-error detection and trace constructionThese files determine whether an Agent tool failed and how that failure is represented:
Logs displayThese files control how handled failures appear in the trace interface:
Workspace-event behavior and payloadThese files define and deliver the new event:
Trigger editorThese files expose the event when configuring a Sim Workspace Events trigger:
No database migration, API route, provider implementation, or new infrastructure was added. |
Greptile SummaryThis PR adds workspace events for Agent tool failures while preserving successful Agent and workflow status for recovered failures.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/logs/execution/trace-spans/span-factory.ts | Recognizes explicit and nested tool-failure shapes, creates handled error spans, and bounds recorded error messages. |
| apps/sim/lib/workspace-events/emitter.ts | Collects failed tool spans directly beneath Agent spans and dispatches scoped agent_tool_error events. |
| apps/sim/lib/workspace-events/payload.ts | Adds the bounded agent_tool_error wire payload while preserving the common event schema. |
| apps/sim/lib/workspace-events/constants.ts | Registers the new event type and conditionally exposes its run and tool-error fields. |
| apps/sim/triggers/sim/workspace-event.ts | Makes Agent Tool Error selectable in the workspace-event trigger editor. |
| apps/sim/app/workspace/[workspaceId]/logs/components/log-details/utils.ts | Prevents handled descendant failures from incorrectly marking successful parent traces as errored. |
Sequence Diagram
sequenceDiagram
participant Tool as Agent Tool
participant Agent as Agent Execution
participant Trace as Trace Span Builder
participant Emitter as Workspace Event Emitter
participant Subscriber as Subscriber Workflow
Tool-->>Agent: Failure result
Agent-->>Trace: Successful Agent log with failed tool call
Trace->>Trace: Create error tool span
Trace->>Trace: Mark errorHandled when Agent succeeded
Trace-->>Emitter: Persisted trace spans
Emitter->>Emitter: Collect Agent tool errors
Emitter-->>Subscriber: agent_tool_error payload
Reviews (2): Last reviewed commit: "fix(logs): recognize nested tool failure..." | Re-trigger Greptile
Summary
agent_tool_errorSim Workspace Event with bounded, safe tool failure metadataValidation
always_fail: handled errorbun run --cwd apps/sim test -- lib/workspace-events/*.test.ts lib/logs/execution/trace-spans/trace-spans.test.ts triggers/sim/workspace-event.test.tsbunx tsc --noEmit -p apps/sim/tsconfig.jsonbun run check:api-validationbun run check:trigger-block-cyclebun run check:utilsbun run check:source-text