Skip to content

fix(qqbot): add timeout to speech transcription requests - #102028

Merged
steipete merged 1 commit into
openclaw:mainfrom
Alix-007:alix/qqbot-stt-fetch-timeout
Jul 9, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
Alix-007:alix/qqbot-stt-fetch-timeout

Conversation

@Alix-007

@Alix-007 Alix-007 commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

QQBot voice-message handling could wait indefinitely when an OpenAI-compatible STT endpoint accepted the transcription request but never responded.

Why This Change Was Made

The transcription POST now carries a timer-safe deadline through the existing fetchWithSsrFGuard boundary. The implementation uses only existing public timeoutSeconds settings:

  • plugin-specific STT uses models.providers.<id>.timeoutSeconds;
  • framework audio STT uses model, audio, then provider precedence;
  • otherwise the request uses the existing 60-second media-audio default.

This avoids a QQBot-only timeout key and removes the earlier duplicated timeout parsing and test harness.

User Impact

A stalled STT provider no longer blocks the QQBot inbound attachment path indefinitely. Slow self-hosted providers can raise an existing provider or media timeout setting. Timeout failures keep the established platform-ASR or transcription-failed fallback behavior.

Evidence

  • Blacksmith Testbox tbx_01kx3bajwrmdeepkwxd0390qnf: pnpm test extensions/qqbot/src/engine/utils/stt.test.ts extensions/qqbot/src/config.test.ts extensions/qqbot/src/manifest-schema.test.ts passed, 27/27 tests.
  • Same Testbox: pnpm test ... src/infra/net/fetch-guard.ssrf.test.ts passed the guarded-fetch suite, 91/91 tests.
  • Same Testbox: node scripts/test-live.mjs -- extensions/qqbot/src/engine/utils/stt.live.test.ts passed a temporary real HTTP scenario in which the server received the multipart POST and never replied; the request rejected after the configured one-second deadline.
  • Same Testbox: pnpm check:changed passed extension production/test typechecks, lint, docs checks, and architecture guards.
  • Fresh Codex autoreview: no actionable findings, confidence 0.93.
  • git diff --check passed.

Real behavior proof

The live probe exercised the exported resolveSTTConfig and transcribeAudio path against a real loopback HTTP server that accepted the request and deliberately never sent a response. The rewritten path rejected with TimeoutError after the configured deadline instead of remaining pending.

Live QQ platform traffic and a third-party STT account were not used; the provider hang itself was reproduced with the no-response server.

@openclaw-barnacle openclaw-barnacle Bot added channel: qqbot size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 8, 2026
@clawsweeper

clawsweeper Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 8:18 AM ET / 12:18 UTC.

Summary
The PR adds QQBot STT request timeout resolution from existing provider/audio timeout settings, passes it to the guarded transcription fetch, updates focused tests, and documents the precedence.

PR surface: Source +28, Tests +10, Docs +5. Total +43 across 3 files.

Reproducibility: yes. source-level: current main calls the QQBot STT guarded fetch without timeoutMs, and the PR proof describes a no-response loopback server that now rejects at the configured deadline instead of staying pending.

Review metrics: 1 noteworthy metric.

  • QQBot STT timeout surface: 1 default added, 0 QQBot timeout keys added. The PR changes upgrade behavior by adding a fallback deadline while avoiding a new channel-specific config surface.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Maintainers should accept or tune the 60-second fallback deadline before merge.

Risk before merge

  • [P1] Merging changes QQBot STT from unbounded to a 60-second default deadline; slow self-hosted or cold-starting transcription endpoints that previously completed after more than 60 seconds will now fall back unless users raise an existing provider or media timeoutSeconds setting.

Maintainer options:

  1. Accept the bounded STT default (recommended)
    Maintainers can own the compatibility tradeoff and land the existing timeout path with release-note context for slow STT providers.
  2. Tune the fallback before merge
    If 60 seconds is too aggressive for QQBot voice traffic, adjust the fallback timeout and update the regression expectations before landing.
  3. Pause for real-provider proof
    If loopback proof is not enough to choose a user-facing timeout, pause this PR until real STT provider behavior confirms the deadline.

Next step before merge

  • No automated repair is needed; the remaining action is maintainer acceptance or tuning of the compatibility-sensitive 60-second default.

Maintainer decision needed

  • Question: Should QQBot STT adopt this PR's 60-second default request deadline for existing users, or should the fallback deadline be tuned before merge?
  • Rationale: The implementation is narrow and uses existing config surfaces, but choosing any default deadline intentionally changes slow-provider behavior that was previously unbounded.
  • Likely owner: Sliverp — Sliverp introduced the QQBot channel feature and has the strongest historical signal for QQBot channel behavior defaults.
  • Options:
    • Accept the 60-second default (recommended): Merge this path as-is and rely on existing provider/media timeoutSeconds settings for slower self-hosted STT endpoints.
    • Tune the fallback first: Change DEFAULT_STT_TIMEOUT_MS to an owner-approved value and update the focused expectations before landing.
    • Pause for live provider evidence: Wait for QQBot or third-party STT proof if maintainers want real-provider data before choosing the default deadline.

Security
Cleared: The diff changes QQBot STT runtime/tests/docs through the existing guarded-fetch path and adds no dependencies, workflow changes, package scripts, permissions, or new secret handling.

Review details

Best possible solution:

Land the bounded QQBot STT fetch through existing provider/media timeoutSeconds configuration after maintainers accept the 60-second default as the upgrade behavior.

Do we have a high-confidence way to reproduce the issue?

Yes, source-level: current main calls the QQBot STT guarded fetch without timeoutMs, and the PR proof describes a no-response loopback server that now rejects at the configured deadline instead of staying pending.

Is this the best way to solve the issue?

Yes, with a merge-risk caveat. Reusing fetchWithSsrFGuard and existing provider/media timeoutSeconds settings is the narrow owner-boundary fix; adding QQBot-only timeout keys would duplicate the config contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f786efddcd88.

Label changes

Label justifications:

  • P2: This is a focused QQBot channel bug fix with limited blast radius and clear maintainer merge-risk ownership.
  • merge-risk: 🚨 compatibility: Existing slow STT endpoints that relied on an unbounded transcription request may now abort at the new default deadline unless configured with a longer existing timeout.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides terminal/Testbox proof for a real loopback HTTP server that accepts the STT request and never responds, showing the configured timeout path rejects instead of hanging.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides terminal/Testbox proof for a real loopback HTTP server that accepts the STT request and never responds, showing the configured timeout path rejects instead of hanging.
Evidence reviewed

PR surface:

Source +28, Tests +10, Docs +5. Total +43 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 30 2 +28
Tests 1 11 1 +10
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 46 3 +43

What I checked:

  • Current main lacks STT request deadline: Current main resolves QQBot STT config without a timeout and calls fetchWithSsrFGuard for the transcription POST without timeoutMs, leaving a no-response endpoint unbounded at this call site. (extensions/qqbot/src/engine/utils/stt.ts:90, f786efddcd88)
  • PR head passes resolved timeout into guarded fetch: The PR head adds DEFAULT_STT_TIMEOUT_MS, resolves provider/media timeoutSeconds through finiteSecondsToTimerSafeMilliseconds, and passes sttCfg.timeoutMs into fetchWithSsrFGuard. (extensions/qqbot/src/engine/utils/stt.ts:117, 3a8ab782afa1)
  • Guarded fetch owns abort and cleanup behavior: fetchWithSsrFGuardInternal builds a timeout abort signal from params.timeoutMs, attaches the signal to fetch, and releases cleanup on thrown fetch errors, so the PR reuses the existing network boundary. (src/infra/net/fetch-guard.ts:451, f786efddcd88)
  • Existing fallback path catches STT timeout failures: processVoiceAttachment catches transcribeAudio errors and falls back to asr_refer_text or the existing transcription-failed sentinel, so timeout failures use the established QQBot fallback path. (extensions/qqbot/src/engine/gateway/inbound-attachments.ts:357, f786efddcd88)
  • Config contract supports reused timeout fields: models.providers.*.timeoutSeconds and tools.media.audio timeoutSeconds are existing positive integer config fields, while the QQBot STT schema remains strict and does not gain a QQBot-only timeout key. (src/config/zod-schema.core.ts:531, f786efddcd88)
  • Docs match the implemented precedence: The PR docs state the 60-second default and the plugin/provider/media timeout precedence that the PR head implements. Public docs: docs/channels/qqbot.md. (docs/channels/qqbot.md:262, 3a8ab782afa1)

Likely related people:

  • Sliverp: Introduced the QQ channel feature and later worked on QQBot SSRF URL handling, which makes this the strongest historical signal for QQBot channel behavior decisions. (role: feature owner; confidence: high; commits: bf6f506dfae6, ddb7a8dd80b8; files: extensions/qqbot/src, docs/channels/qqbot.md)
  • Vincent Koc: Added the current QQBot STT module, config schema, plugin manifest, and docs into the current main layout during the recent diagnostic truncation refactor. (role: recent area contributor; confidence: high; commits: 0ac8933721f7, 6e443a20c816, 9502642f471f; files: extensions/qqbot/src/engine/utils/stt.ts, extensions/qqbot/src/config-schema.ts, docs/channels/qqbot.md)
  • Mingkuan: Authored QQBot config-schema passthrough work and lazy-load fixes near the config boundary that this PR intentionally avoids expanding. (role: config schema contributor; confidence: medium; commits: 005b629b6d8f, c15cfeb21ce4; files: extensions/qqbot/src/config-schema.ts, extensions/qqbot/openclaw.plugin.json)
  • steipete: Recent QQBot config/test cleanup history and the latest PR head authoring make steipete a practical reviewer for the final merge-risk/default choice. (role: recent area contributor; confidence: medium; commits: f8dbd7dd6991, 13d1fc077bfd, 3a8ab782afa1; files: extensions/qqbot/src/config.test.ts, extensions/qqbot/src/engine/utils/stt.ts, extensions/qqbot/src/config-schema.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (7 earlier review cycles)
  • reviewed 2026-07-08T04:53:33.435Z sha 40b825e4e7650ece7cdfd53fe608fcffb306a207 :: needs changes before merge. :: [P2] Align the new timeout keys with QQBot config schemas
  • reviewed 2026-07-08T05:30:01.481Z sha 8a93c903897d36f1d0af2a1def5f76dd76558728 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T05:41:55.853Z sha 8a93c903897d36f1d0af2a1def5f76dd76558728 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T06:39:26.665Z sha 4c62cec976155852bb96a4950dc7d21499cacdcc :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T08:37:12.029Z sha 3265ee90f9d3d7f4de5d1c6e404b4b6b1c40f85e :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T08:49:27.484Z sha 3265ee90f9d3d7f4de5d1c6e404b4b6b1c40f85e :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T09:23:19.550Z sha 2c4a32961dcdfba0aae049fdf860aaf9297c9991 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 8, 2026
@LauraGPT

LauraGPT commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Reviewed from the downstream self-hosted STT angle. This is useful for local/private OpenAI-compatible transcription servers such as FunASR/SenseVoice deployments, where a request can connect successfully but then hang during model warmup, GPU queueing, or a stalled backend worker.

The current direction looks right to me because the deadline now flows through the existing provider/audio timeout config rather than introducing QQBot-only STT timeout keys. Two compatibility details are worth preserving through the final review:

  • keep the timeout override reachable through the documented provider/audio model config path, so users with slower LAN/GPU endpoints can raise it above the 30s default without changing QQBot schema;
  • keep timeout errors distinct from provider 4xx/5xx responses in logs/user-facing fallback, because a slow local endpoint usually needs queue/warmup tuning, while an HTTP error usually means auth/model/route configuration.

No FunASR/SenseVoice-specific blocker from my pass; the loopback server test that accepts the POST and never responds is the right regression shape for stalled self-hosted transcription endpoints.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 8, 2026
@steipete steipete self-assigned this Jul 9, 2026
@steipete
steipete force-pushed the alix/qqbot-stt-fetch-timeout branch from 2c4a329 to 3a8ab78 Compare July 9, 2026 11:57
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS and removed size: M labels Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Maintainer rewrite and verification complete.

The branch is now one focused commit with 46 additions and 3 deletions, replacing the original 265-line timeout harness. The runtime uses the supported timeoutSeconds contract, keeps provider/model/audio/default precedence explicit, converts seconds through the shared timer-safe helper, and documents the 60-second fallback.

Validation:

  • Blacksmith Testbox tbx_01kx3bajwrmdeepkwxd0390qnf: QQBot STT/config/manifest tests, 27/27 passed.
  • Blacksmith Testbox: fetch-guard SSRF suite, 91/91 passed.
  • Live loopback proof: the real multipart STT request reached a server that accepted the upload and never replied; the production path aborted after the configured 1 second, 1/1 passed.
  • Full remote pnpm check:changed: production/test tsgo, lint, docs, and architecture guards passed.
  • Fresh autoreview: no actionable findings, confidence 0.93.
  • Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/29016532640 passed at 3a8ab782afa1d06cf8b98bf8eb6c0e1c65b95095.

Proof gap: no credentialed third-party QQ/STT endpoint was used; the network behavior was exercised against a real loopback server through the production request path.

@steipete
steipete merged commit 64e8088 into openclaw:main Jul 9, 2026
111 of 113 checks passed
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: qqbot docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants