Skip to content

feat(asr): stop crediting the user with the other side's words on speakers - #536

Merged
GeiserX merged 4 commits into
mainfrom
feat/echo-marking
Nov 12, 2026
Merged

GeiserX merged 4 commits into
mainfrom
feat/echo-marking

Conversation

@GeiserX

@GeiserX GeiserX commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Problem

On a call without headphones, the mic hears the laptop speakers. Each sentence from the other side then shows up twice: once as a call line and once as a line from the user. Both stayed in the window, packs, shares, exports and agent answers, so the user was credited with words they never said. The log schema and the fold already hide a line marked echo, but nothing ever wrote that mark. The echo banner, which counts marked lines, could never fire.

Fix

One rule in src/core/log/echo.ts decides when a mic line is the mic hearing a call line. The rule is narrow so that a person reading back a number or a name keeps their line:

  • the mic line has at least 3 words;
  • the call line started first (or at the same time);
  • the mic line starts no later than 1.5 s after the call line ends;
  • at least 70 % of the mic line's words are in the call line.

The live path checks every new line against the other channel's lines from the last 10 s. It checks when either channel writes, because a call line can close after the mic line that heard it. A match writes a new revision with only echo: true. It never writes echo: false, and it skips a line a person has edited. The final pass applies the same rule and sets echo on the mic line's first revision. The marked line stays in the log. Only the views leave it out.

The new trap is [ECHO-1] in docs/TRAPS.md. DESIGN 3.1 step 7 now states the extra guards. The coverage line in docs/TESTING.md now points at tests that exist.

Testing

  • tests/echo.test.ts tests each limit of the rule with a case just inside it and a case just outside it: 1.5 s against 1.6 s, 7 of 10 words against 6 of 10, 3 words against 2, and a call line that starts first against one that starts 1 ms later.
  • tests/asr-live.test.ts plays the same speech on both channels through the in-thread live pipeline. It runs once with the mic line written first and once with the call line written first. In both runs the mic line gets the echo revision, stays in the log and leaves the live view. As a positive control, different speech at the same time gets no mark.
  • tests/asr-final.test.ts runs the same check through the final pass, with the same control.
  • Red before green: with the two writers taken from main, the three echo cases fail. If the live path checks only when the mic writes, the "mic line written first" case fails. If any one limit of the rule is moved, its unit test fails.
  • bun run check:static passes. The three test files pass: 90 tests, 0 failures.

…inal pass

Without headphones the mic hears the remote side, so every remote sentence
also became a line credited to the user. The fold already hides a line marked
echo, but nothing wrote the mark. One narrow rule now marks it on both paths:
at least 3 words, the call line first, the mic line within 1.5 s of its end,
and at least 70 % of its words in the call line. The line stays in the log.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between af3819c and 42a2e09.

Files selected for processing: 9

  • docs/DESIGN.md
  • docs/TESTING.md
  • docs/TRAPS.md
  • src/core/log/echo.ts
  • src/main/asr/finalize-worker.ts
  • src/main/asr/live-worker.ts
  • tests/asr-final.test.ts
  • tests/asr-live.test.ts
  • tests/echo.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

The final pass cuts the call channel at every diarized turn and the mic
channel only at pauses, so a mic line holding the echo of two remote
turns matched neither call line alone and came back in the view after
the final pass. Both paths now pool the call lines the mic line may
have heard.
@GeiserX
GeiserX merged commit ba63cda into main Nov 12, 2026
30 checks passed
@GeiserX
GeiserX deleted the feat/echo-marking branch November 12, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant