Skip to content

refactor(tts): resolve caption eligibility from settings - #188326

Merged
vincentkoc merged 2 commits into
mainfrom
refactor/speech-s19-caption-settings
Oct 30, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
refactor/speech-s19-caption-settings

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Related: #188252

What Problem This Solves

Caption eligibility computes status-display details although it only needs the existing live TTS settings decision.

User Impact

No intended user-visible behavior or shipped public-contract change.

Why This Change Was Made

Read TTS settings directly after channel-capability and source-config final-mode gates. Preserve prepared preferences, session/agent/channel/account inputs and off/tagged/inbound predicates. Remove the forwarding terminal-payload helper and use the existing payload owner at its sole caller. Remove the obsolete fake status projection from dispatch fixtures and supply real speech-mode config inputs; all existing assertions remain.

Nine net production lines and 23 net test/support lines removed. No new case, option, cache or runtime owner.

Evidence

  • Native formatting, whitespace checks and normal commit hooks passed. Fresh independent exact full-range local ClawSweeper review completed without actionable findings. Root inspected the full production/fixture cutover, including distinct source-mode versus live-settings precedence. Existing caption, settings, payload, delivery, tagged and stream tests retain behavior ownership.
  • Runtime tests, types, lint and required build/API checks are supplied by the exact-head CI run linked below. Personal worktrees are code-only because dependency reuse is unqualified; no local runtime or timing pass is claimed.

CI attempt 41056015197 exposed one retired mock-export baseline entry and an ACP speech fixture missing real TTS configuration after removal of the status mock. The appended repair removes only that baseline entry and enables TTS in the affected case, preserving every assertion.

Fresh independent full-range source review covers all nine files and both commits at replacement head 7409b2c3f87e63df7238012094b5f31ad65fe6d1, with no actionable findings. Native formatting, whitespace checks and the normal commit hook passed. Replacement-head hosted CI passed, including the selected owning suites, native mock-export checker, types and lint; no local runtime pass is claimed. Evidence: https://github.com/openclaw/openclaw/actions/runs/41060673639. Overall reduction remains nine production lines, 23 test/support lines and one baseline entry.

Native landing evidence: required CI run 41060673639 passed for reviewed head 7409b2c. Root inspected the full source cutover and fresh independent full-range review with no actionable findings. Personal dependency-backed execution remains unrun; exact-head CI supplies executable tests, types and lint proof. No intentional behavior or shipped contract change.

@vincentkoc vincentkoc self-assigned this Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review October 30, 2026 12:31
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR resolves caption eligibility directly from TTS settings and removes a forwarding helper and obsolete test mocks.

Example: Telegram uses tts.auto="always" and final mode for the answer "Hello from block streaming."

  • Before: Eligibility builds status-display details before deferring text for a captioned voice reply.
  • After: Eligibility reads the same settings directly, preserving the captioned voice reply.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The production reduction is sound, but the fixture cutover is incomplete and exact-head validation fails for source-attributable reasons.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored behavior-preserving refactor is outside the contributor proof gate; the body claims no live runtime proof, and existing dispatch tests provide supporting coverage.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Partial
User problem: No intended user-visible change; caption eligibility unnecessarily computes status-display details.
Reason: The maintainer-authored direction removes redundant work and a forwarding wrapper while preserving existing owners and contracts; Related correctly reflects the broader campaign.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this maintainer-authored PR open: the production simplification is useful, but incomplete fixture migration causes two actionable CI failures.

Priority: P3
Reviewed head: 7fa022b702b578605a2ac213d41b613505a92bca

Before merge

  • Enable TTS explicitly in the ACP streaming speech fixture (P2) - Removing the shared status-config mock also changes dispatch-acp-finalize.ts and dispatch-acp-payload.ts in these tests. The existing "generates final-mode TTS audio after ACP block streaming completes" case constructs createLiveAcpConfig(256), which has no TTS settings. The real settings owner therefore resolves off, finalizeAcpTurnOutput skips synthesis, and the expected audio payload is absent. The exact-head changed-node check reports this failure at abort-and-dedupe.test-utils.ts:1084. Add tts.auto="always" to that speech case's configuration while retaining its assertions.
  • Prune the baseline entry for the removed status mock (P3) - The deleted status-config mock still has an exact-factory entry in config/test-mock-exports-baseline.txt:2368. scripts/check-test-mock-exports.mts rejects removed entries until the shrinking baseline is regenerated, so this deletion leaves check:test-mock-exports failing; the exact-head baseline-ratchets annotations identify that check. Regenerate the baseline with the supported prune command and include the resulting deletion.

Findings

  • [P2] Enable TTS explicitly in the ACP streaming speech fixture — src/auto-reply/reply/dispatch-from-config.shared.test-harness.ts:628
  • [P3] Prune the baseline entry for the removed status mock — src/auto-reply/reply/dispatch-from-config.shared.test-harness.ts:628
Agent review details

How this fits together

Reply dispatch combines channel capabilities, scoped TTS settings, preferences, and session mode to decide whether streamed answer text waits for final speech delivery.

flowchart LR
  A[Incoming conversation] --> B[Reply dispatch]
  C[Channel capabilities] --> D[Caption eligibility]
  E[TTS settings and preferences] --> D
  D --> B
  B --> F[Final speech or text fallback]
  F --> G[Channel delivery]
Loading

Technical review

Best possible solution:

Keep the direct settings lookup, enable TTS explicitly in the affected ACP fixture, and regenerate the shrinking mock baseline.

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

This PR proposes an internal refactor rather than a product bug fix; source inspection establishes equivalent production eligibility decisions.

Is this the best way to solve the issue?

The direct settings call and existing payload predicate are the smallest complete production change, but removing a shared mock requires migrating its ACP consumer and baseline too.

Full review comments:

  • [P2] Enable TTS explicitly in the ACP streaming speech fixture — src/auto-reply/reply/dispatch-from-config.shared.test-harness.ts:628
    Removing the shared status-config mock also changes dispatch-acp-finalize.ts and dispatch-acp-payload.ts in these tests. The existing "generates final-mode TTS audio after ACP block streaming completes" case constructs createLiveAcpConfig(256), which has no TTS settings. The real settings owner therefore resolves off, finalizeAcpTurnOutput skips synthesis, and the expected audio payload is absent. The exact-head changed-node check reports this failure at abort-and-dedupe.test-utils.ts:1084. Add tts.auto="always" to that speech case's configuration while retaining its assertions.
    Confidence: 0.99
  • [P3] Prune the baseline entry for the removed status mock — src/auto-reply/reply/dispatch-from-config.shared.test-harness.ts:628
    The deleted status-config mock still has an exact-factory entry in config/test-mock-exports-baseline.txt:2368. scripts/check-test-mock-exports.mts rejects removed entries until the shrinking baseline is regenerated, so this deletion leaves check:test-mock-exports failing; the exact-head baseline-ratchets annotations identify that check. Regenerate the baseline with the supported prune command and include the resulting deletion.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 994e7aec6812.

Provenance checked

  • Caption eligibility and terminal-payload forwarding keeps the original intent (b8f6086: Defer eligible Telegram final-mode answer text until synthesis settles, then deliver a captioned voice note or safe text fallback.)
  • Prepared preference inputs keeps the original intent (f71ea0f: Carry the worker-prepared machine preference path through dispatch while preserving scoped precedence and fresh preference-file reads.)
  • Shared fake TTS status projection changes intended behavior with a stated reason (b8f6086: Provide enabled speech settings for caption and ACP dispatch fixtures; the replacement migrates caption cases but leaves one ACP speech case dependent on the removed default.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm check:test-mock-exports
  • pnpm test src/auto-reply/reply/dispatch-from-config.lifecycle.test.ts src/auto-reply/reply/dispatch-from-config.delivery.test.ts src/auto-reply/reply/dispatch-from-config.tagged-tts.test.ts src/auto-reply/reply/dispatch-from-config.tts-stream.test.ts
  • git diff --check

What I checked:

Likely related people:

  • Jerry-Xin: Raw commit b8f6086 adds src/tts/captioned-final.ts:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b8f6086411cf; files: src/tts/captioned-final.ts)

PR surface

Source -9, Tests -23. Total -32 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 8 17 -9
Tests 5 24 47 -23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 32 64 -32

Labels

Label changes:

  • add P3: This is behavior-preserving internal cleanup; the established defects affect test fixtures and validation rather than shipped user behavior.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is behavior-preserving internal cleanup; the established defects affect test fixtures and validation rather than shipped user behavior.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 30, 2026, 8:48 AM ET / 12:48 UTC.

@vincentkoc
vincentkoc merged commit fa286a7 into main Oct 30, 2026
135 of 136 checks passed
@vincentkoc
vincentkoc deleted the refactor/speech-s19-caption-settings branch October 30, 2026 14:29
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant