Skip to content

refactor(ui): use optimistic actions for read-aloud playback - #180433

Merged
steipete merged 5 commits into
mainfrom
solid2/chat-d-read-aloud-replacement-v2
Oct 22, 2026
Merged

steipete merged 5 commits into
mainfrom
solid2/chat-d-read-aloud-replacement-v2

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Whole-scope CHAT-D census, fc43063b639f → fbce70775a7c. Raw cleanup/owner APIs include named exceptions; unlanded families remain counted.

Family Files Production LOC I1 I2 raw I3 I4 I5 I6 I7 raw I8 I9 I10 raw
attachments 34 4225 0 4 2 0 1 0 0 0 0 0
automations 7 1670 0 0 0 1 0 0 0 0 0 0
cards 11 2205 0 0 0 0 0 0 0 0 0 0
context 2 542 0 1 0 0 0 0 0 0 0 0
details 18 4903 0 0 0 0 0 1 0 0 0 0
header-navigation 12 4138 0 0 0 0 0 1 0 0 0 0
indicators-other 65 7905 0 1 1 0 0 0 0 0 0 3
media_previews 23 3709 → 3727 0 1 2 1 → 0 0 1 0 0 0 0
panels_files_sidebar 26 6595 0 2 0 1 0 1 0 0 0 0
publication 3 843 0 0 1 1 0 0 0 0 0 0
pull_request_ci 10 2338 0 0 0 0 0 0 0 0 0 0
questions 13 2564 0 0 0 0 0 0 0 0 0 0
review_diff 17 4051 0 1 1 0 0 1 0 0 0 0
sharing 6 2098 0 0 0 0 0 0 0 0 0 0
sidebar 10 3398 0 0 0 1 0 0 0 0 0 0
source_previews 1 144 0 0 0 0 0 0 0 0 0 0
tools 7 1552 0 0 0 0 0 0 0 0 0 0
workspace 16 4845 0 0 0 0 0 1 0 0 0 0

Total files: 281; production LOC: 57725 → 57743.
I1–I10: 0, 10, 7, 5 → 4, 1, 6, 0, 0, 0, 3.

What Problem This Solves

The read-aloud button manually synchronized playback progress on start, stop, completion, and failure. A Solid action now owns the optimistic playback presentation while the existing speech-playback owner retains audio admission, cancellation, and stale synthesis disposal.

Audio preparation still starts synchronously inside the native click before any await, preserving Safari user activation. A plain synchronous admission flag handles immediate start/stop clicks before presentation settles. Playback completion automatically retires the optimistic state, and synthesis errors remain visible and retryable.

This replaces #179854 with the same focused three-file change integrated with current main. The old PR's ambiguous managed-checkout metadata is preserved; the replacement uses a fresh native workflow destination.

Evidence

Proof Result
Frozen install PASS; Node 24.22.1, pnpm 12.15.0
UI types PASS; default tsrs
Direct read-aloud / reconnect tests 15 + 1 PASS; pinned Bun, one worker, one run each
Targeted lint PASS on all three changed files
Independent P0–P2 review PASS; complete three-file diff, no actionable findings
Production Knip Same 13 unused heartbeat files as exact main base fc43063; no UI findings, no ignores added
Paired production build / strict performance PASS; same machine, Node 24.22.1 / pnpm 12.15.0, matching build-input fingerprints
Synthetic screenshots Ready and pending synthesis, 1440×960; all four captures inspected and synthetic-only; each before/after pair is byte-identical
Full CI PASS: 39745296256, exact head fbce707, with ci:full

Production LOC: 125 → 143 (+18). Direct test LOC: 350 → 378 (+28). The additional lines preserve synchronous audio admission while an explicit action presents progress. No new owner, dependency, tag, class, route, or lazy import boundary.

Touched-file checklist I1–I10: 0→0, 0→0, 0→0, 1→0, 0→0, 0→0, 0→0, 0→0, 0→0, 0→0. Retained generation and admission fields are cancellation identity and synchronous operation admission, not parallel rendered progress.

Paired build measurements

Base fc43063b639f99fffa03ab9585446b551bd31a75 and head fbce70775a7c815274e3c17f99d6e4447e1dfe13 use fixed metadata and disabled compile/build caches. Every lazy boundary is retained.

Gzip metric Before After
Startup JavaScript 316,042 B / 7 requests 315,616 B / 7 requests
Startup CSS 40,894 B / 1 request 40,894 B / 1 request
Chat boot JavaScript 1,438,111 B / 26 requests 1,437,710 B / 26 requests
New-session boot JavaScript 1,015,657 B / 21 requests 1,015,223 B / 21 requests

The attached ready and pending images each represent their byte-identical before/after pair. Captures use only synthetic data and an isolated Chromium instance.

Inherited local Knip findings

Exact base and head both report these same 13 unused files: src/auto-reply/heartbeat-reply-payload.ts; src/infra/heartbeat-active-hours.ts, heartbeat-delivery-normalization.ts, heartbeat-dispatch.ts, heartbeat-runner-config.ts, heartbeat-runner-execution.ts, heartbeat-runner-prompt.ts, heartbeat-runner-run.ts, heartbeat-runner-scheduler.ts, heartbeat-runner-session.ts, heartbeat-runner.ts, heartbeat-session-publication.ts, and heartbeat-wake-policy.ts. This records the local static-analysis result; it is not a waiver for any new CI failure.

Before / after

The independently captured pairs are byte-identical, so each row reuses its uploaded image.

State Before After
Ready Ready before Ready after
Pending synthesis Pending before Pending after

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T08:09:48.091052Z fbce707 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces manually synchronized read-aloud presentation with a Solid optimistic action while preserving the existing audio playback owner.

Example: Read aloud for “Local voice is working.”

  • Before: The component manually sets and clears the Stop reading presentation.
  • After: An optimistic action presents Stop reading until playback settles.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation is sound on inspection; browser evidence covers presentation states but provides limited confidence in the complete playback lifecycle.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate is waived by the supplied maintainer-authored classification; inspected Chromium screenshots demonstrate ready and pending presentation, while completion, cancellation, retry, and Safari activation are supported by source and reported mocked tests rather than live playback evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Read-aloud presentation must remain aligned with playback completion, cancellation, and failure.
Reason: The supplied maintainer-authored direction and merged feature history support this narrow Solid conversion without changing provider selection, configuration, or playback policy.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it is an owner-directed, focused refactor with no actionable correctness or security findings.

Priority: P3
Reviewed head: fbce70775a7c815274e3c17f99d6e4447e1dfe13

Before merge

None.

Findings

None.

Agent review details

How this fits together

The chat message action passes text to GatewaySpeechPlayback, which requests Gateway synthesis and plays returned audio; Solid owns the button presentation.

flowchart LR
  A[Chat message] --> B[Read aloud control]
  B --> C[Speech playback owner]
  C --> D[Gateway synthesis]
  D --> E[Browser audio]
  C --> F[Optimistic presentation]
  F --> B
Loading

Technical review

Best possible solution:

Retain the existing speech owner and use the focused optimistic action solely for playback presentation.

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

This is primarily a behavior-preserving refactor; source inspection establishes the affected path, and no target code was executed during this read-only review.

Is this the best way to solve the issue?

The implementation follows the existing Solid action recipe, preserves synchronous gesture-time audio preparation, and keeps cancellation and stale-response disposal in their established owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Playback progress, gesture-time preparation, and errors keeps the original intent (c4649b0: Configured Gateway speech replaced ignored speech configuration while preserving browser playback, cancellation, and visible failures.)
  • Reconnect and identity retirement keeps the original intent (2d7d89f: Downloaded speech should survive a transient disconnect while identity and confirmed access changes retire playback.)
  • Settled lifetime cleanup keeps the original intent (24ff459: Pair teardown with Solid settled lifetimes while retaining existing admission and cancellation owners.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced change: The pinned introduction diff changes only the read-aloud component and its two direct test files; audio preparation remains before the first await, and existing client, permission, and connection-generation checks remain. (ui/src/pages/chat/components/chat-read-aloud.tsx:79, fbce70775a7c)
  • Current main: Fetched main still uses the manually maintained playing signal, so this refactor is not already implemented there. (ui/src/pages/chat/components/chat-read-aloud.tsx:29, d08aeb1d984a)
  • Existing cancellation owner: GatewaySpeechPlayback already resolves cancellation independently of pending synthesis and discards stale responses; the optimistic action waits on that existing operation rather than introducing another playback lifecycle. (ui/src/lib/speech-playback.ts:66, fbce70775a7c)
  • Replacement relationship: The body explicitly replaces refactor(ui): use optimistic actions for chat read aloud #179854, whose three reviewed files are byte-identical to this head. (fbce70775a7c)
  • Inspected visual evidence: All four prepared screenshots were inspected locally; the current PR's ready and pending images show the volume and stop icons respectively, using synthetic chat content. (fbce70775a7c)
  • Validation status: The latest read showed no failed check runs; cancelled automation runs remain, and the aggregate CI status is pending, so a completed green aggregate is not claimed. (fbce70775a7c)

Likely related people:

  • Peter Steinberger: Raw commit c4649b0 adds ui/src/pages/chat/components/chat-read-aloud.tsx:22 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c4649b0a64a6; files: ui/src/pages/chat/components/chat-read-aloud.tsx)

PR surface

Source +18, Tests +28. Total +46 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 44 26 +18
Tests 2 32 4 +28
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 76 30 +46

Review metrics

Metric Value Why it matters
Production versus test growth Production +18 lines; direct tests +28 lines Growth separates synchronous operation admission from optimistic rendering and adds distinct stop/restart and failure-retry coverage.

Root-cause cluster

Relationship: canonical
Canonical: #180433
Summary: This PR explicitly replaces the earlier PR with the same focused implementation.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P3: This is a localized presentation refactor preserving the existing user workflow, without an established urgent production failure.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a localized presentation refactor preserving the existing user workflow, without an established urgent production failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 22, 2026, 4:22 AM ET / 08:22 UTC.

@steipete
steipete merged commit feb2fc1 into main Oct 22, 2026
113 of 119 checks passed
@steipete
steipete deleted the solid2/chat-d-read-aloud-replacement-v2 branch October 22, 2026 08:34
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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.

1 participant