Skip to content

Keep recording when the echo-cancelled microphone writer falls behind (#1412) - #1414

Closed
chandima wants to merge 4 commits into
altic-dev:mainfrom
chandima:fix/fluidmeet-keep-recording-when-aec-writer-falls-behind
Closed

chandima wants to merge 4 commits into
altic-dev:mainfrom
chandima:fix/fluidmeet-keep-recording-when-aec-writer-falls-behind

Conversation

@chandima

@chandima chandima commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

When FluidMeet records the microphone through software echo cancellation (AEC3), one refused writer enqueue ends the whole meeting with "AEC microphone pipeline failed closed (writerQueueFull)". The writer queue holds 128 samples. On this path a sample is one 10 ms AEC frame, so a stall of about 1.3 s, or a burst from the stream joiner, is enough to end the meeting. The raw capture path already handles the same overflow by dropping the sample.

Cause: MeetingAECOutputCommitter.enqueueOrFail correctly demotes the track to unprotected and closes transcript admission, and then also calls reportTerminalFailure(.writerQueueFull). Overflows on the sequenced promotion, raw-demotion and safety-era commands are reported as terminal too.

Change (MeetingAECOutputCommitter, plus three writer changes in MeetingAudioChunkWriter added after review):

  • enqueueOrFail becomes enqueueOrDemote. On overflow it still bumps the generation, sets unprotected, invalidates the transcript gate and queues the fail-closed safety era. It no longer reports a terminal failure, so the frame is dropped and recording continues.
  • A promotion that overflows did not persist its era, and the track may still end in an older protected era. It now queues the same fail-closed safety era before any later raw sample can land, instead of stopping.
  • For commitRaw and persistSafetyEra, a queueFull completion is no longer terminal. The writer's existing emergency run (failOverflowedSequencedCommand) has already applied the unprotected era ahead of every later sample on the serial queue.
  • Other writer errors (metadataPersistence, writerNotAccepting) remain terminal, so a demotion that can't be recorded still stops the meeting.
  • The writer's emergency run now completes with the manifest write error when it can't save the unprotected era, instead of always reporting queueFull (6d1a0d4, following review). A failed save therefore stays on the terminal metadataPersistence path.
  • While an emergency demotion is pending, the writer refuses commands that are not fail-closed (only the committer's promotions) with queueFull (4097f27, following review). The writer folds later demotions into that pending run, so no promotion may queue behind it. The committer treats the refusal like any promotion overflow and tries again on the next frame. The capture engine's own demotions are fail-closed and unaffected.
  • An overflowing sequenced command counts as a dropped sample only when it carries audio (198e2c1, following review). One lost frame followed by its metadata-only safety cut was reported as two dropped samples, including on the plain-overflow path on main.

Safety is unchanged: audio is never labelled as more protected than it was. After an overflow, the next filtered frame goes through the normal durable promotion (afterPersistingMetadata plus updateIfNotInvalidated) before transcript admission reopens. This PR doesn't change the queue size.

Type of Change

  • 🐞 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 🧹 Chore
  • 📝 Documentation update

Related Issue or Discussion

Fixes #1412

Testing

Environment: public main at c81c83c (FluidVoice 1.6.13 source), macOS 27.2.1, Apple Silicon arm64, Xcode 27.2. The bug was observed in the released FluidVoice 1.6.13 build on Nov 13, 20 and 23, 2026 (session evidence in #1412).

Verification:

  1. testCommitterRecoversAfterTransientWriterOverflow (new) stalls the writer with pendingSlotLimit: 1, so a promotion takes the only slot and the next filtered frame overflows. It then releases the writer and commits another frame. It expects no terminal failure, the eras [unprotected@0, softwareEchoCancelled@2, unprotected@3, softwareEchoCancelled@4], transcript admission reopened, and exactly one live-caption frame (the re-promoted one).
  2. testCommitterWriterOverflowDemotesInMemoryWithoutStoppingCapture (was ...AndReportsQueueBound) is unchanged except that it now expects no terminal failure.
  3. testCommitterPromotionQueueFullStaysUnprotectedWithoutStoppingCapture (was ...AndReportsQueueBound) now expects the eras [unprotected, unprotected] (the conservative cut, with no protected era) and no terminal failure.
  4. With the committer change reverted and the tests kept, all three tests fail on the terminal-failure assertion. With the change applied, they pass.
  5. testCommitterStopsWhenTheEmergencyDemotionCannotBeSaved (new, 6d1a0d4) makes the track directory read-only, overflows a raw frame, and expects [.metadataPersistence]. With the emergency save back to try? and queueFull, it fails with [].
  6. testWriterRefusesPromotionWhileEmergencyDemotionIsPending (new, 4097f27) holds the emergency demotion mid-run after the raw frame has freed its slot, then offers a promotion. It expects the promotion to be refused and the eras to stay [unprotected, unprotected]. With the guard removed, the promotion is accepted and the track ends softwareEchoCancelled.
  7. Both overflow tests in items 2 and 3 also assert droppedSampleCount == 1 (198e2c1). With the old counting they fail with 2.
  8. MeetingAEC3Tests: 47 tests, 47 passed.
  9. Tests/run_ci_checks.sh with GITHUB_ACTIONS=true (unsigned, as in CI) on 198e2c1: "PASS: complete CI sequence". The Xcode step ran 2842 tests: 2779 passed, 0 failed, 63 skipped. Every skip depends on the environment, such as a signing identity or opt-in fixtures.

One earlier full run on the same code had a single failure in AudioTopologyDiagnosticsTests/testRingPublishesMonotonicEventsInOrder, which this PR doesn't touch. That test reads a process-wide trace ring that the test host's live audio-device observer also writes to. It passed 3 of 3 iterations alone, and the rerun above passed.

Checks not run:

  • Not tested on Intel.

  • Not run with a signing identity, so the signed-fixture suites were skipped.

  • The fix has not yet been exercised in a live call. The writer stall is reproduced in the unit tests by blocking the writer queue.

  • Tested on Intel Mac

  • Tested on Apple Silicon Mac

  • Tested on macOS version: 27.2.1

  • Ran linter locally: swiftlint --strict --config .swiftlint.yml Sources Tests Package.swift (SwiftLint 0.63.2, as pinned in CI: 0 violations in 622 files)

  • Ran formatter locally: swiftformat --config .swiftformat --lint Sources with SwiftFormat 0.61.1 (the CI version): 0/432 files require formatting.

  • Ran tests locally: Tests/run_ci_checks.sh as above, plus the before-and-after runs of the three tests.

Screenshots / Video

XCTest results before and after the fix

Copyable test output. The image is a generated summary of the XCTest result bundles, not an app UI screenshot. The evidence lives on a separate branch of my fork and is not part of this PR's diff.

  • No UI/visual changes; screenshots/video are not applicable.

Notes

AI use: Claude Code (Claude Opus 5.5) diagnosed the stop from my local FluidMeet session metadata and logs, wrote the fix and tests, and ran the builds, tests and lint checks reported above on my Mac. I reviewed the diff and confirmed that it is a bounded solution to fix the issue.

  • A human created this PR or reviewed and approved it before submission, understands the full diff, and takes responsibility for the change.

🤖 Generated with Claude Code

With software echo cancellation, one refused writer enqueue ended the
whole meeting with "AEC microphone pipeline failed closed
(writerQueueFull)". The queue holds 128 samples, which is about 1.3 s
of 10 ms AEC frames, so a short writer stall or a joiner burst was
enough. The raw capture path already drops the sample and carries on.

On overflow, the committer still demotes the track to unprotected,
closes transcript admission and queues the fail-closed safety era. It
now drops the frame instead of stopping capture. A promotion that
overflows queues the same safety era. A full queue on the raw-demotion
or safety-era command is not terminal either, because the writer's
emergency run has already applied the demotion. Other writer errors
still stop the meeting, and the next filtered frame must re-promote
durably before captions resume.

Fixes altic-dev#1412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T19:11:33.795971Z 198e2c1 New commits
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue remains in the reviewed changes.

Summary

Keeps recording after an AEC writer overflow while closing transcript admission and saving an unprotected era.

  • AEC writer overflow drops a frame without stopping the meeting.

Reviews (3) · Last reviewed commit: "Count only audio-carrying overflows as d..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b1c4134c6

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

chandima and others added 2 commits November 24, 2026 11:31
The writer's emergency run applied the unprotected era in memory, wrote
the manifest with try?, and always completed with queueFull. Now that
the committer keeps recording on queueFull, a failed save would have
continued the meeting while track.json still described the older
protected era.

The emergency run now completes with the write error when the manifest
can't be saved, and with queueFull only after it was saved. The
committer still ignores only queueFull, so a failed save takes the
terminal metadataPersistence path.

Related to altic-dev#1412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
While an emergency demotion waits behind older work, the writer folds
later fail-closed demotions into it. A promotion admitted behind that
emergency run could outlive it, leaving later raw audio under a
protected era once recording continues after an overflow.

While the emergency is pending, the writer now refuses commands that
are not fail-closed (only the committer's promotions) with queueFull.
The committer handles that like any promotion overflow: it stays
unprotected and tries again on the next frame, after the emergency has
run. Fail-closed demotions are unaffected.

Related to altic-dev#1412

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4097f2712a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

) { [self] result in
defer { self.endPendingCommit() }
if case let .failure(error) = result {
if case let .failure(error) = result, !Self.isQueueOverflow(error) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve rewound boundaries when coalescing safety writes

When a route/rebuild invalidation arrives while the writer remains full, MeetingAECPipeline.invalidate first flushes its raw tail, so that tail can own the one emergency demotion at its later sample PTS; the subsequent boundary command then takes failOverflowedSequencedCommand's coalesced path and returns .queueFull without running its mutation (MeetingAudioChunkWriter.swift:276-296). The new evidence beyond the previously fixed promotion race is that this boundary is deliberately rewound by 0.5 seconds (MeetingCaptureEngine.swift:3155-3163), so the pending later cut does not cover it. Suppressing the error here lets recording continue with that interval still marked softwareEchoCancelled and eligible for post-processing; coalesce the earliest cut or suppress only when the requested mutation was actually covered.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one isn't introduced by the coalesced path. applyEra never moves an era start backwards: when startSeconds isn't later than the last era's start, it only relabels the last era. In the uncontended path, the raw tail's sequenced demotion saves unprotected@S_tail first. The rewound boundary S_b < S_tail then only relabels that unprotected@S_tail era, so [S_b, S_tail) stays in the earlier protected era there too. If the boundary is later than the tail (S_b > S_tail), the pending S_tail cut is earlier and covers it. Either way the saved eras come out the same whether the boundary's mutation runs or is coalesced.

Before this PR, the coalesced boundary also returned queueFull and stopped the recording, but the saved track kept the same eras, with the same [S_b, S_tail) label. Honouring a rewound boundary after a later cut would mean changing applyEra for both paths. That's outside this fix, so I'd rather track it as a separate issue.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

FluidVoice PR build ready

Download FluidVoice-PR-1414-198e2c1d2d2b

The artifact contains the ad-hoc-signed app ZIP, Xcode archive, build manifest, and installation instructions. It expires 5 days after the build.

Install the app

  1. Extract the downloaded artifact, then extract FluidVoice-PR-1414.app.zip.

  2. Move FluidVoice Keep recording when the echo-cancelled microphone writer falls behind (#1412) #1414.app into the /Applications folder.

  3. Open Terminal and remove the download quarantine marker:

    xattr -dr com.apple.quarantine "/Applications/FluidVoice #1414.app"
    
  4. In Applications, Control-click FluidVoice Keep recording when the echo-cancelled microphone writer falls behind (#1412) #1414.app and choose Open.

  5. If macOS still blocks it, open System Settings → Privacy & Security, click Open Anyway, and confirm.

This build has its own app identity, so its permissions are separate from the release version of FluidVoice.

View workflow run

A sequenced command that overflowed always added one to the writer's
dropped-sample count, even a metadata-only safety cut. A refused
promotion followed by its compensating safety era, or a plain overflow
followed by its safety era, reported two dropped samples for one lost
frame in track health and the writerBackpressure detail.

The overflow path now counts a dropped sample only when the command
carries audio.

Related to altic-dev#1412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

This pull request has been marked stale because it has had no activity for 5 days. It will be closed in 2 days if there is no further activity. Add the keep-open or pinned label to prevent automatic closure.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Closing this pull request because it remained inactive for 2 days after being marked stale.

@github-actions github-actions Bot closed this Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] FluidMeet stops the whole recording when the echo-cancelled microphone writer falls behind

1 participant