Repository navigation
fix(decopilot): instrument silent failure points in /stream publish path - #3951
Merged
pedrofrxncx merged 1 commit intoJun 16, 2026
Merged
Conversation
The live /stream path has several silent forks where a degraded JetStream client makes a run complete + persist (consumeHarnessStream is upstream of the NATS pump) while delivering ZERO chunks to the client and emitting no error — matching 'stream stuck, message saved, no logs' reports. Instrument every blind spot: - nats-stream-buffer: log init ready/degraded/skipped; warn when pump or createTailStream no-op because the JetStream client is null; per-run published-chunk count behind DECOPILOT_STREAM_TRACE. - dispatch-run: warn when dispatchRunAndWait takes the direct-drain fallback (createTailStream null) and never pumps to the subject. - routes /stream: always log the null-tail 204 (degraded buffer); behind DECOPILOT_STREAM_TRACE log deliverPolicy + run age + delivered chunk count to confirm the deliverPolicy/cross-run replay race. No behavior change — logging only.
pedrofrxncx
enabled auto-merge (squash)
June 16, 2026 15:44
decocms Bot
pushed a commit
that referenced
this pull request
Jun 16, 2026
PR: #3951 fix(decopilot): instrument silent failure points in /stream publish path Bump type: patch - decocms (apps/mesh/package.json): 3.27.1 -> 3.27.2
Collaborator
Author
|
Branch now also carries the actual fix (commit |
This was referenced Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Reports of: a decopilot run where the live
/streamis stuck — zero chunks arrive — yet the assistant message is saved, and there are no error logs on client or server. On reload, the order breaks (run 1's response renders under run 2's user message, run 1 shows "No response was generated"); a second reload fixes it.Root cause family: persistence and live streaming are decoupled.
consumeHarnessStreampersists the message upstream of the NATSpump(). So when the JetStream client is degraded on a pod, the run completes + persists while nothing is published to the subject — and every fork that handles this is silent:NatsStreamBuffer.pump()returns early whenthis.jsis null (no log) → chunks never published.NatsStreamBuffer.createTailStream()returnsnullwhenthis.jsis null (no log).dispatchRunAndWaitfalls back to draininguiStreamdirectly whencreateTailStreamreturns null — never pumps to the subject (silent)./streamreturns a bare204on null tail (silent).this.jsis cached atinit()and only refreshed via theonReady/reconnect path; a NATS blip ([NatsProvider] Disconnected,console.log— noterror, easy to miss) can leave an in-flight run publishing into a void.What
Logging only — no behavior change.
initlogsready/degraded (js=null)/skipped;pumpandcreateTailStreamwarnwhen they no-op on a null JetStream client; per-run published-chunk count behindDECOPILOT_STREAM_TRACE=1.warn(producer-fallback-no-pump) whendispatchRunAndWaittakes the direct-drain fallback and never pumps./stream: always log the null-tail204(tail-unavailable-204); behindDECOPILOT_STREAM_TRACE=1logdeliverPolicy+ run age + delivered chunk count (tail-open/tail-closed) to confirm the deliverPolicy / cross-run replay race.All structured logs share
msg: "decopilot-stream-diag"for grepping.How to use in the affected env
grep "NatsProvider"forDisconnected/Reconnectednear the incident.grep "decopilot-stream-diag"—producer-fallback-no-pumporpump: JetStream client unavailable⇒ producer published nothing;tail-unavailable-204⇒ consumer pod's buffer degraded.DECOPILOT_STREAM_TRACE=1to correlatepump-done publishedChunks=N(producer) againsttail-closed deliveredChunks=0(consumer).Testing
bun test nats-stream-buffer.test.ts— 23 pass.bun run checkclean on changed files (pre-existingct/playwright-dep errors unrelated).🤖 Generated with Claude Code
Summary by cubic
Add diagnostic logging to Decopilot
/streamto surface silent JetStream degradation where runs persist but no chunks are delivered. No behavior changes; this makes “stream stuck, message saved, no logs” debuggable.nats-stream-buffer: init logsready/degraded (js=null)/skipped; warn whenpump()orcreateTailStream()no-op due to missing JetStream; per-run publish counts behindDECOPILOT_STREAM_TRACE=1.dispatch-run: warn when the direct-drain fallback is used (producer-fallback-no-pump)./streamroute: always log null-tail204(tail-unavailable-204); withDECOPILOT_STREAM_TRACE=1logdeliverPolicy, run age, and delivered chunk counts (tail-open/tail-closed).msg: "decopilot-stream-diag"for easy grepping.Written for commit 1af9fe5. Summary will update on new commits.