Skip to content

Remove the provider stream throughput watchdog and the live tok/s working-line readout #1759

Description

@code-yeongyu

Summary

#1743 (issue #1739) shipped two user-facing behaviours that are being withdrawn in full:

  1. a sustained-rate watchdog that aborts an in-flight provider stream whose measured rate falls below retry.provider.minThroughputTokensPerSecond (default 8 tok/s over a 20s window), surfaced as Provider stream throughput degraded: <n> tok/s over <n>s (floor <n> tok/s);
  2. a live - N.N tok/s segment on the interactive working line, added only so that verdict was observable while it was being measured.

Both must be removed completely - code, settings, docs, changelog entry, fork-tracking notes and tests - so the tree reads as if neither had ever been written.

Why

  • The floor fires on healthy turns. A normal turn measured at 6.1 tok/s over the 20s window had its request aborted mid tool call; the transcript showed the tool call as error plus the raw watchdog string. Thinking-heavy models and gateways that batch several tokens per delta legitimately sustain rates under the shipped floor, so the guard turns a slow-but-correct answer into a hard failure and spends a fallback hop on it.
  • It cannot be softened in place. The wording is simultaneously the classifier token (packages/ai/src/utils/retry.ts), so the message cannot be reworded, and the verdict aborts the request controller, so the partial answer for that turn is discarded rather than delivered slowly.
  • The readout has no remaining purpose. With the watchdog gone, a per-delta rate on the working line is noise on every turn; end-of-turn rate is already reported by the builtin TPS extension.

Expected (ideal state)

No trace of either feature on main:

  • packages/agent/src/stream-throughput-watchdog.ts deleted, together with AgentLoopConfig.streamThroughput, AgentOptions.streamThroughput and the packages/agent/src/index.ts exports.
  • The agent-loop assistant reader back to the start-bound and idle-bound guards only.
  • isProviderStreamThroughputDegradedError, the "provider stream throughput degraded" retryable pattern, the _handleRetryableError branch, the stream_throughput_degraded session event and its interactive notice box all gone.
  • retry.provider.minThroughputTokensPerSecond / throughputWindowMs / throughputGraceMs removed from the settings type, from SettingsManager.getAgentStreamThroughputOptions(), from core/sdk.ts, from the test harness and from the docs/settings.md rows and example.
  • Working line back to Working (<elapsed> - esc to interrupt); StreamRateMeter, estimateStreamedUnits and getWorkingTokensPerSecond() gone from interactive mode.
  • Tests: packages/agent/test/agent-loop-throughput-watchdog.test.ts and packages/coding-agent/test/suite/retry-fallback-throughput-degraded.test.ts deleted; the settings-manager, working-status and interactive-mode-status (test(coding-agent): unbreak main's working-indicator status test #1748) additions reverted; the explanatory comment added to agent-loop-stream-start-timeout.test.ts restored to its previous text.
  • The CHANGELOG bullet and the changes.md sections describing the feature are deleted, not annotated: the removal is a withdrawal, not a documented change.

Acceptance criteria

  • git grep -E 'minThroughputTokensPerSecond|throughputWindowMs|throughputGraceMs|StreamRateMeter|StreamThroughputDegraded|stream-throughput-watchdog|streamThroughput|estimateStreamedUnits|stream_throughput_degraded|getWorkingTokensPerSecond' returns nothing.
  • The interactive working line renders Working (1m 12s - esc to interrupt).
  • Green: packages/agent agent-loop suites, packages/coding-agent settings-manager / interactive-mode-status / interactive-mode-working-status / test/suite retry-fallback suites, packages/ai retry suites.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions