Commit b857a22
fix: address PR #474 review comments — 3 fixes in Flutter voice-agent bridge
- **QEF-1 (coderabbit, P0/Major, line 318)**: Pass `handle.address` across
`Isolate.run` boundary instead of the raw `Pointer<Void>` and reconstruct it
via `RacHandle.fromAddress(...)` inside `_processVoiceTurnInIsolate`. Matches
the pattern already used by `dart_bridge_tts`, `dart_bridge_stt`,
`dart_bridge_llm`, and `dart_bridge_vlm`; passing Dart-side pointers across
isolate boundaries is unsafe.
- **QEF-3 (greptile, P2, line 109)**: Add a clarifying comment explaining why
`_initFuture` is cleared *after* `completer.complete(_handle!)` — concurrent
callers already holding a reference to `completer.future` still receive the
value normally; new callers arriving after this line hit the `_handle != null`
fast path.
- **QEF-4 (greptile outside-diff)**: Replace the plain `String` type on
`VoiceAgentModelLoadedEvent.component` with a new typed enum
`VoiceAgentComponent { stt, llm, tts }`, and update the three emit sites
(`loadSTTModel`, `loadLLMModel`, `loadTTSVoice`) accordingly. Per the project's
style guide ("never use strings directly"), the enum makes component typos a
compile-time error rather than a silently-accepted string.
Not addressed:
- **QEF-2 (greptile, P2 — `sttResultFree` should be nullable)**: Already resolved
on this branch via a different approach — `sttResultFree` was removed from
`native_functions.dart` entirely. The STT transcription path runs inside
`Isolate.run(...)` which cannot read main-isolate static state, so each spawned
isolate resolves `rac_stt_result_free` inline. The comment block at
`native_functions.dart:89-93` explicitly documents this decision.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent a0c25aa commit b857a22
1 file changed
Lines changed: 23 additions & 7 deletions
Lines changed: 23 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| |||
214 | 218 | | |
215 | 219 | | |
216 | 220 | | |
217 | | - | |
| 221 | + | |
| 222 | + | |
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
| |||
239 | 244 | | |
240 | 245 | | |
241 | 246 | | |
242 | | - | |
| 247 | + | |
| 248 | + | |
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
| |||
264 | 270 | | |
265 | 271 | | |
266 | 272 | | |
267 | | - | |
| 273 | + | |
| 274 | + | |
268 | 275 | | |
269 | 276 | | |
270 | 277 | | |
| |||
314 | 321 | | |
315 | 322 | | |
316 | 323 | | |
317 | | - | |
318 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
319 | 329 | | |
320 | 330 | | |
321 | 331 | | |
322 | 332 | | |
| 333 | + | |
323 | 334 | | |
324 | | - | |
| 335 | + | |
325 | 336 | | |
326 | 337 | | |
| 338 | + | |
| 339 | + | |
327 | 340 | | |
328 | 341 | | |
329 | 342 | | |
| |||
555 | 568 | | |
556 | 569 | | |
557 | 570 | | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
558 | 574 | | |
559 | 575 | | |
560 | | - | |
| 576 | + | |
561 | 577 | | |
562 | 578 | | |
563 | 579 | | |
| |||
0 commit comments