Repository navigation
fix(providers): prevent idle timeouts during hidden reasoning - #114997
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 2:43 AM ET / 06:43 UTC. ClawSweeper reviewWhat this changesThe PR reports each valid OpenAI-compatible completion chunk as model-request activity in both streaming implementations so hidden reasoning chunks can prevent false idle timeouts without emitting private reasoning. Merge readiness⛔ Blocked until stronger real behavior proof is added - 5 items remain Keep this PR open for maintainer review. The patch is a plausible, narrowly scoped repair for the broader OpenAI-compatible stream-progress contract, but its cited loopback proof does not establish the original Priority: P1 Review scores
Verification
How this fits togetherOpenAI-compatible provider streams are decoded by either the built-in AI provider or the managed transport, then passed to agent execution. The agent idle watchdog listens for model-request activity to distinguish active provider output from a genuinely stalled model call. flowchart LR
Provider[OpenAI-compatible provider] --> Chunks[Streaming completion chunks]
Chunks --> BuiltIn[Built-in provider parser]
Chunks --> Transport[Managed transport parser]
BuiltIn --> Activity[Model request activity]
Transport --> Activity
Activity --> Watchdog[Agent idle watchdog]
BuiltIn --> Reply[Visible assistant reply]
Transport --> Reply
Decision needed
Why: The patch intentionally changes the generic definition of provider progress beyond the originally reported local endpoint, while current main already treats the reported local route differently; that contract choice requires maintainer intent. Before merge
Agent review detailsSecurityNone. PR surfaceSource +7, Tests +143. Total +150 across 4 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the two-path activity notification if maintainers confirm that valid provider chunks are the intended cross-provider progress signal, then rebase and provide redacted after-fix evidence through a non-local OpenAI-compatible endpoint or an explicit test configuration that exercises the default watchdog path. Do we have a high-confidence way to reproduce the issue? No high-confidence current-main reproduction of the original local route was established: current source gives loopback and Is this the best way to solve the issue? Unclear. Reporting valid hidden-reasoning chunks as activity is the narrowest shared repair across the two OpenAI-compatible stream paths, but the best final contract depends on maintainer confirmation that valid chunks—not only visible/tool output—should reset the generic watchdog. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f0ef1c6d33e4. LabelsLabel changes:
Label 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)
|
|
Maintainer-requested landing follow-up for the latest ClawSweeper rank-up moves at reviewed head
All 232 focused tests, |
|
Merged via squash.
|
Closes #113323.
What Problem This Solves
Fixes an issue where users running a local OpenAI-compatible reasoning model would lose active agent turns to
LLM idle timeoutwhile the provider was continuously streaming hidden reasoning. The failure affects providers such as vLLM when the model is configured with reasoning disabled but its server still sends reasoning-only chat-completion chunks before the visible answer.Why This Change Was Made
Notify the existing model-request activity channel for every valid streamed OpenAI-compatible completion chunk, in both the built-in provider and the managed transport. This lets the existing idle watchdog observe genuine provider progress without emitting hidden thinking, weakening timeouts, changing model configuration, expanding the plugin SDK, or adding provider-specific policy. Regression coverage handles the current vLLM
reasoningfield and legacyreasoning_content/reasoning_textvariants. The stream shape is checked against the pinned[email protected]implementation and vLLM's documented streaming reasoning output.User Impact
Local and OpenAI-compatible reasoning models can finish a long thinking phase and return their normal visible reply without a false idle timeout. Private reasoning remains private, genuine silent-provider timeouts still fire, and configured timeout and fallback behavior remain unchanged.
Evidence
tbx_01kykmwgs3356cawv0yc4vkhyw: four hidden reasoning chunks produced zero model-activity notifications, and a real127.0.0.1HTTP/SSE provider hit the production idle watchdog while reasoning chunks were still arriving.reasoningandreasoning_content, returnsOK, emits no thinking, and never fires the idle callback.pnpm test packages/ai/src/providers/openai-completions.test.ts— 59 passing tests, including three hidden reasoning field variants.pnpm test src/agents/openai-transport-stream.streaming.test.ts— 46 passing tests, including both real HTTP/SSE provider reproductions.pnpm test src/agents/embedded-agent-runner/run/llm-idle-timeout.test.ts— 123 passing watchdog regressions.pnpm test packages/ai/src/provider-transport-parity.test.ts— 4 passing provider/transport parity tests.pnpm check:changed— passed formatting, core and test TypeScript, typed lint, plugin/SDK boundaries, dependency and environment guards, SQLite/storage guards, and runtime import-cycle checks on the same Testbox..agents/skills/autoreview/scripts/autoreview --mode uncommitted --stream-engine-output— clean; no actionable findings.AI-assisted implementation and review.