[Bug]: opencode-go provider streaming — API calls complete on provider side but gateway never receives stream termination signal#93708
Conversation
Treat configured terminal finish reasons as stream completion while preserving trailing usage chunks so opencode-go DeepSeek streams cannot hang after the provider has completed.
|
ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 16, 2026, 1:06 PM ET / 17:06 UTC. Summary PR surface: Source +202, Tests +412. Total +614 across 15 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Stored data model Merge readiness This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 617f97d4b984. Evidence reviewedPR surface: Source +202, Tests +412. Total +614 across 15 files. View PR surface stats
What I checked:
Likely related people:
How this review workflow works
|
|
Closing this implementation, while keeping #93610 open for the provider failure. The report may be real, but this patch is not the best mergeable fix: it adds two shared model/config/catalog compatibility fields, changes both OpenAI-compatible streaming implementations, has failing required lint/test-type checks, and has no live opencode-go/DeepSeek reproduction proving the proposed terminal signal and 50 ms grace window match the provider contract. The next fix should start provider-owned and include live provider proof. A generic shared seam is reconsiderable only if live evidence shows the behavior is a reusable provider-family contract, with docs and all required checks green. |
Summary
finish_reasonmapped to no OpenClaw completion state when the SSE socket stayed open.finish_reasonstream completion, preserves trailing usage chunks when configured, and aborts the underlying SDK request when the configured terminal usage grace expires.finishReasonTerminatesStreamandterminalUsageGraceMs.Linked context
Real behavior proof (required for external PRs)
finish_reasoneven when the socket stays open, continue through trailing usage-only chunks when present, and abort the request-level stream when the configured terminal usage grace expires without usage.pnpm test src/llm/providers/openai-completions.test.ts;pnpm test src/agents/openai-transport-stream.test.ts;pnpm --filter @openclaw/model-catalog-core test model-catalog-normalize.test.ts;pnpm test src/config/zod-schema.models.test.ts src/config/config-misc.test.ts -t compat;pnpm test extensions/opencode-go/index.test.ts.Gateway startup,
/readyz,/healthz, listener, or generic status output is setup/smoke evidence only. Unless the linked issue is specifically a startup/readiness/health/liveness bug, this section must exercise the issue-specific runtime path and show the corrected post-fix behavior.Tests and validation
pnpm test src/llm/providers/openai-completions.test.ts;pnpm test src/agents/openai-transport-stream.test.ts;pnpm --filter @openclaw/model-catalog-core test model-catalog-normalize.test.ts;pnpm test src/config/zod-schema.models.test.ts src/config/config-misc.test.ts -t compat;pnpm test extensions/opencode-go/index.test.ts.pnpm test extensions/opencode-go/index.test.tsverifies the bundled opencode-go extension exposes the DeepSeek compat fields.pnpm --filter @openclaw/model-catalog-core test model-catalog-normalize.test.tsand config compat schema tests cover the shared model catalog/config contract for the new compat fields.finish_reasonand no socket close could remain pending indefinitely; a terminal usage grace timeout could finish locally without aborting the already-pending SDK stream read.Risk checklist
terminalUsageGraceMsdo not receive a new implicit cutoff, and both stream implementations have regression coverage.Current review state