Skip to content

Commit d505aef

Browse files
ruiren_microsoftCopilot
andcommitted
Fix issues from PR #613 review feedback
- Fix start() holding mutex across FFI call: release lock before native core call, add 'starting' transitional state to prevent concurrent start() races (mirrors Rust PR feedback about mutex-across-channel-send deadlock) - Remove codex.md review artifact from repo (reviewer feedback) - Expose active_settings() getter for frozen settings snapshot - Break stop() into drain_push_queue_and_thread(), send_native_stop(), enqueue_final_result() helpers for readability - Improve error messages with more context - Add 2 new tests: StartError_RevertsToNotStarted_CanRetry, ActiveSettings_ExposedAfterStart - Update SettingsFrozenAfterStart test to verify via active_settings() - All 62 tests passing (59 unit + 3 E2E) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3a11f3c commit d505aef

4 files changed

Lines changed: 173 additions & 193 deletions

File tree

sdk/cpp/codex.md

Lines changed: 0 additions & 100 deletions
This file was deleted.

sdk/cpp/include/foundry_local/live_audio_transcription_session.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,21 @@ class LiveAudioTranscriptionSession {
9999
/// Check if the session has been stopped.
100100
bool is_stopped() const;
101101

102+
/// Get the frozen settings snapshot that was active when start() was called.
103+
/// Only valid after start() has been called.
104+
const LiveAudioTranscriptionOptions& active_settings() const { return active_settings_; }
105+
102106
private:
103-
enum class State { not_started, started, stopping, stopped, failed };
107+
enum class State { not_started, starting, started, stopping, stopped, failed };
104108

105109
void push_loop();
106110
void transition_to(State new_state);
107111

112+
// Helpers extracted from stop() for readability
113+
void drain_push_queue_and_thread();
114+
detail::CoreInteropResponse send_native_stop(const std::string& handle);
115+
void enqueue_final_result(const detail::CoreInteropResponse& response);
116+
108117
std::string model_id_;
109118
std::shared_ptr<detail::CoreInterop> core_interop_;
110119

@@ -114,7 +123,7 @@ class LiveAudioTranscriptionSession {
114123
std::string session_handle_;
115124
std::string error_message_;
116125

117-
// Frozen settings snapshot
126+
// Frozen settings snapshot (exposed via active_settings())
118127
LiveAudioTranscriptionOptions active_settings_;
119128

120129
// User-configurable settings (frozen at start)

0 commit comments

Comments
 (0)