Repository navigation
fix(agent): redact internal terminal errors - #18743
Conversation
Classify asynchronous compile and persistence failures before Runner emits them, preserving causes for server logs while adapters return a stable public message. Refs infiniflow#15743
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds typed internal run errors that preserve causes for logging while emitting a fixed public message. Canvas runners classify terminal errors, service paths wrap compile and persistence failures, and response adapters redact internal details in streaming and non-streaming outputs. ChangesInternal run error redaction
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The change redacts backend details from internal terminal failures while preserving actionable workflow errors and diagnostic causes; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant AgentService
participant CanvasRunner
participant SSEAdapter
participant Client
AgentService->>CanvasRunner: return NewInternalRunError(cause)
CanvasRunner->>CanvasRunner: preserve cause and classify terminal error
CanvasRunner->>SSEAdapter: emit kind=internal with sanitized message
SSEAdapter->>Client: return redacted streaming or non-streaming error
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
Summary
Follow-up to #18316 and #18579.
Agent compile and persistence failures can occur after HTTP streaming starts, bypassing synchronous handler error mapping and exposing backend details in ordinary SSE and OpenAI-compatible responses.
This PR:
errors.Isand server logs;Refs #15743.
Testing
CGO_ENABLED=0 go test -count=1 -run "TestRunnerRedactsInternalRunError|TestRunErrorEventPreservesPublicMessage" ./internal/agent/canvasCGO_ENABLED=0 go test -count=1 -run "TestWriteChatbotRunEvent_RedactsInternalError|TestRunAgent_RealCanvas_CompileFails" ./internal/serviceCGO_ENABLED=0 go test -count=1 -run "TestAgentChatCompletions_OpenAICompat_(NonStreamRedactsInternalRunnerError|StreamRedactsInternalRunnerError|NonStreamReturnsRunnerError|StreamSurfacesRunnerError)" ./internal/handlerCGO_ENABLED=0 go vet ./internal/agent/canvas ./internal/service ./internal/handler