Repository navigation
fix(gateway): preserve provider details on chat error events - #135102
Conversation
Expose a closed, bounded errorDetail object from sanitized provider observations. Preserve the observation through direct and deferred terminal ownership, and redact provider error types at the observation boundary. Project before lifecycle publication as well as chat delivery so raw bodies, previews, and hashes stay out of both event streams. Document the additive protocol-v4 field and cover schema bounds, redaction, clean runs, retry cleanup, and lifecycle-to-gateway delivery. Discovery source: NetEase Youdao's LobsterAI patch stack (https://github.com/netease-youdao/LobsterAI). The arbitrary-key payload spreading mechanism was not adopted.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 6:42 AM ET / 10:42 UTC. ClawSweeper reviewWhat this changesThis PR adds an optional, bounded and redacted Merge readinessKeep open for explicit maintainer acceptance of the new public Gateway v4 diagnostic contract. The implementation is bounded and source-supported, with no actionable patch defect found. Priority: P2 Review scores
Verification
How this fits togetherAgent lifecycle code records a failed provider attempt, then Gateway projects that terminal event into chat updates for subscribed clients. This change carries a small sanitized diagnostic subset across that boundary. flowchart LR
A[Provider failure] --> B[Agent lifecycle]
B --> C[Sanitized observation]
C --> D[Terminal owner]
D --> E[Gateway chat event]
E --> F[Subscribed clients]
Decision needed
Why: The patch is technically coherent, but it deliberately expands the diagnostics exposed to every compatible chat-event client. Before merge
Agent review detailsSecurityNone. PR surfaceSource +77, Tests +246, Docs +11, Other +4. Total +338 across 14 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Accept the optional closed Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main's failed-chat schema and Gateway terminal builder omit this diagnostic object, while the PR exercises the proposed failure path. No live provider outage was run in this read-only review. Is this the best way to solve the issue? Yes, pending product acceptance: projecting one closed allowlist at the lifecycle owner and again at Gateway avoids reparsing user-facing text and covers direct and deferred terminal paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d394da816e24. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Protocol-contract acceptance note: the additive optional |
|
Merged via squash.
|
…w#135102) * fix(gateway): preserve provider details on chat error events Expose a closed, bounded errorDetail object from sanitized provider observations. Preserve the observation through direct and deferred terminal ownership, and redact provider error types at the observation boundary. Project before lifecycle publication as well as chat delivery so raw bodies, previews, and hashes stay out of both event streams. Document the additive protocol-v4 field and cover schema bounds, redaction, clean runs, retry cleanup, and lifecycle-to-gateway delivery. Discovery source: NetEase Youdao's LobsterAI patch stack (https://github.com/netease-youdao/LobsterAI). The arbitrary-key payload spreading mechanism was not adopted. * chore(protocol): regenerate Swift gateway models for errorDetail
What Problem This Solves
Chat clients could not distinguish a provider HTTP outage from other failed runs without Gateway logs, although the lifecycle producer already recorded sanitized diagnostic facts.
Why This Change Was Made
Preserve those facts at the lifecycle owner, including deferred command/auto-reply terminals, and expose one bounded, closed allowlist through
errorDetail. Apply the same projection before lifecycle publication and at the chat builder so raw log diagnostics cannot escape through either stream. Reuse the existing credential redactor, including for provider error types.Discovery source: NetEase Youdao's LobsterAI patch stack (github.com/netease-youdao/LobsterAI). Its arbitrary-key payload-spreading mechanism was not adopted.
User Impact
Clients can inspect optional provider/model, failure classifications, HTTP status, and a credential-redacted message preview on failed chat events. Existing coarse error kind/message behavior is unchanged. No configuration or protocol-version bump. The protocol reference documents the additive field; Control UI presentation remains a named follow-up.
Evidence
278 tests passed across eight existing files, covering the closed/all-optional schema, bounds, redaction, direct/command/reply lifecycle-to-Gateway delivery, clean-run omission, and retry cleanup. The protocol package build and built-entry-point smoke passed, as did focused lint, formatting, whitespace checks, and fresh scoped-clean Codex autoreview. The full
pnpm check:changedgate passed with exit code 0. Production net +77 implements the requested closed protocol capability and lifecycle ownership handoff; tests net +246 and docs +11. No live provider outage was induced; proof uses synthetic provider failure through real lifecycle and Gateway handlers.