Repository navigation
Bug: Feishu API errors silently swallowed, agent receives outcome=completed on failure #119862
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Description
Description
When the Feishu API returns an error (e.g., HTTP 400 with code=230099), the gateway logs the error but still returns outcome=completed to the agent. The agent has no way to know the message was not delivered to the user.
Steps to Reproduce
- Agent generates a reply containing many markdown tables (exceeding Feishu's card table limit)
- Gateway calls Feishu API to send the message
- Feishu returns HTTP 400:
code=230099, msg="card table number over limit" - Gateway logs:
[error]: code: 230099 - Gateway returns to agent:
outcome=completed, replies=1
Expected Behavior
- Gateway should return
outcome=failedwhen Feishu API returns an error - Error details (code + message) should be included in the response
- Agent should be able to retry or notify the user
Actual Behavior
- Error is logged but not propagated to agent
outcome=completedis returned unconditionally- Agent believes the message was delivered successfully
- User receives nothing
Root Cause
In reply-dispatcher, queuedCounts is incremented on enqueue but not decremented on failure. The onError callback only logs the error without re-throwing or updating the dispatch result. The outcome is set to "completed" unconditionally at the end of the dispatch flow.
Suggested Fix
Gateway side:
- When Feishu API returns HTTP 4xx/5xx or
code != 0, setoutcome=failed - Include structured error info in response:
{outcome, error_code, error_msg} - Track
failedCountsin dispatch result
Optional hardening:
- Pre-validate card content (e.g., table count) before sending
- Add monitoring for "success reported but downstream failed" scenarios
Impact
Users may believe their messages were delivered when they were not. This affects any Feishu integration where the agent generates content that triggers API errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
Priority
None yet
Activity
clawsweeper commentedon Aug 6, 2026
Codex review: this still needs some work. Reviewed October 3, 2026, 1:55 AM ET / 05:55 UTC.
Summary
Delivery accounting and table-limit fallback have improved, but current main still records a completed processing outcome independently of delivery failure and does not expose provider error details through that outcome. The earlier repair PR closed unmerged, so the remaining reporting request merits a focused contract decision.
Likely related people: steipete and joshavant, medium-confidence routing candidates from shared delivery history.
Reproducibility: unclear. for the exact agent-facing claim: source proves that a successful agent run with failed delivery can retain completed processing diagnostics, but no live run or model-visible response was verified.
Maintainer decision needed
Why: Current code deliberately distinguishes agent execution from transport settlement; redefining completed would affect sibling channels and public consumers, while the requested model feedback has no identified entrypoint.
Next step
Resolve the shared reporting contract and identify the model-visible consumer before scoping a repair; no new fix PR should be dispatched yet.
Review details
Best possible solution:
Use the existing settled-receipt owner to expose sanitized delivery failures separately from agent-run completion, preserving duplicate-safe recovery.
Do we have a high-confidence way to reproduce the issue?
Unclear for the exact agent-facing claim: source proves that a successful agent run with failed delivery can retain completed processing diagnostics, but no live run or model-visible response was verified.
Is this the best way to solve the issue?
The proposed unconditional failed outcome is not yet the best-supported repair; extending the existing settlement contract preserves the distinction between execution failure, rejected delivery, and ambiguous delivery.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 6a565393916d.
Label changes
Label changes:
No label changes.
Label justifications:
P1: Failed channel delivery can leave users without an answer while processing diagnostics still indicate completion.impact:message-loss: The report concerns rejected Feishu replies and missing delivery feedback.Evidence reviewed
What I checked:
src/auto-reply/reply/dispatch-from-config.finalize.ts:499, 6a565393916d)src/auto-reply/reply/reply-dispatcher.ts:508, 6a565393916d)src/auto-reply/reply/reply-dispatcher.ts, eb38d5e4863a)extensions/feishu/src/reply-dispatcher.ts:1320, 7e21eebac413)extensions/feishu/src/reply-delivery-result.ts:30, 6a565393916d)Likely related people:
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.4 remaining items