Skip to content

Move AssemblyAI-specific workarounds out of the engine - #431

Merged
alexkroman merged 4 commits into
mainfrom
claude/admiring-galileo-fs8szf
Nov 25, 2026
Merged

alexkroman merged 4 commits into
mainfrom
claude/admiring-galileo-fs8szf

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

The engine names no speech provider, but three things in it were
AssemblyAI's: a fix for the dictation API's rewrite echoing its own
instruction, the gateway's model names, and the dictation route's
measured limits.

  • RewriteGrounding moves to BlurtAssemblyAI, beside its only caller
    (AssemblyAITranscriber.chooseTranscript).
  • LLM clients ask for a ChatModelTier (.fast, .capable) instead of a
    gateway model name; BlurtAssemblyAI maps each tier to its model
    (qwen3.5-4b-32k-fast, gemma-4-31b) and reports it on ChatReply, so
    the command log still records the model that answered.
  • SyncSTTLimits becomes RecordingLimits, Blurt's own recording policy.
    What the dictation API accepts (16 kHz, the buffered route's 20
    minutes, the ~80 ms floor) is the SDK's new DictationLimits, and
    AssemblyAITranscriber.fitsRecordingLimits checks the one against the
    other (asserted at init, pinned by RecordingLimitsTests).

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01DS5B1W1VYBwrXTmabhFEnf

The engine names no speech provider, but three things in it were
AssemblyAI's: a fix for the dictation API's rewrite echoing its own
instruction, the gateway's model names, and the dictation route's
measured limits.

- RewriteGrounding moves to BlurtAssemblyAI, beside its only caller
  (AssemblyAITranscriber.chooseTranscript).
- LLM clients ask for a ChatModelTier (.fast, .capable) instead of a
  gateway model name; BlurtAssemblyAI maps each tier to its model
  (qwen3.5-4b-32k-fast, gemma-4-31b) and reports it on ChatReply, so
  the command log still records the model that answered.
- SyncSTTLimits becomes RecordingLimits, Blurt's own recording policy.
  What the dictation API accepts (16 kHz, the buffered route's 20
  minutes, the ~80 ms floor) is the SDK's new DictationLimits, and
  AssemblyAITranscriber.fitsRecordingLimits checks the one against the
  other (asserted at init, pinned by RecordingLimitsTests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1W1VYBwrXTmabhFEnf
Continues moving AssemblyAI-specific code out of the engine.

- STTPrompt moves to BlurtAssemblyAI. Its 4096-scalar fit, the API's
  limit, is the SDK's new DictationPrompt.fitted. The developer log no
  longer rebuilds the prompt: TranscriberProtocol gains
  contextPrompt(for:), and the session logs what the transcriber
  reports sending.
- CleanupInstruction moves to BlurtAssemblyAI, beside its only caller.
- The voice catalog moves to BlurtAssemblyAI (ReadAloudVoice.assemblyAI).
  The engine keeps the ReadAloudVoice shape; SpeechSynthesizing lists
  its voices, the style stores the chosen id or nil, and the provider
  speaks its default for an id it doesn't know.
- SpeechSegmenter moves to the SDK. The engine's chunker asks the voice
  where to cut (SpeechSynthesizing.sentences(of:maxCharacters:)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1W1VYBwrXTmabhFEnf
@alexkroman
alexkroman enabled auto-merge November 25, 2026 22:52
// with and this text was never typed anywhere.
if handsBackTranscript {
seams.logTranscript(loggable, press?.resolved, .handedBack(spoken))
seams.logTranscript(loggable, press?.resolved, .handedBack(spoken), sentPrompt)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sentPrompt can contain prior dictation text, but this call passes it to transcript logging, potentially recording personal information.

Details

✨ AI Reasoning
​The sent prompt is derived from the transcription context, which can include prior dictation text. This newly passes it to transcript logging in the hand-back path, potentially recording free text that may identify a person.

🔧 How do I fix it?
Keep sensitive data such as emails, passwords, and tokens out of logs. When logging values tied to a user, prefer a safe identifier like a user ID over the raw input, and strip line breaks from any user-provided text you do log.

Reply on this comment to give feedback or ignore the issue.
More info

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Same as the thread on line 161: the hand-back entry already wrote this stt_prompt string on main (built in DictationLog.makeEntry by STTPrompt.text). Here it just comes from the transcriber. It's written only when developer mode is on.

Leaving this open for the PR author to decide.


Generated by Claude Code

// Logged once the paste has ended, so the log says whether it landed.
let outcome = await inject(expanded, security: security)
seams.logTranscript(loggable, press?.resolved, outcome)
seams.logTranscript(loggable, press?.resolved, outcome, sentPrompt)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sentPrompt can contain prior dictation text, but this call passes it to transcript logging, potentially recording personal information.

Details

✨ AI Reasoning
​The normal transcript path also supplies the prompt derived from transcription context to the logger. That context can include user-provided text, so logging it can expose personal information.

🔧 How do I fix it?
Keep sensitive data such as emails, passwords, and tokens out of logs. When logging values tied to a user, prefer a safe identifier like a user ID over the raw input, and strip line breaks from any user-provided text you do log.

Reply on this comment to give feedback or ignore the issue.
More info

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Traced: this isn't new logging. On main, DictationLog.makeEntry already writes this same string to the same stt_prompt field, built by STTPrompt.text(context:) from the same context. This PR only changes where the log gets it from: the transcriber now reports what it sent, instead of the engine rebuilding it.

The log is opt-in developer mode (DictationLog.gated returns before any write unless DeveloperModeStore.isEnabled). It's a local file the user turns on to collect a prompt-iteration corpus. A password field's dictation is never replayed into the prompt (TargetSecurity), and its transcript is withheld from the entry.

Leaving this open for the PR author to decide.


Generated by Claude Code

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Ignored this finding.

/// transcriber reports sending (`TranscriberProtocol.contextPrompt(for:)`).
var logTranscript: @Sendable (String, TranscriptionContext?, PipelinePhase, String) -> Void = {
text, context, outcome, prompt in
DictationLog.append(transcript: text, context: context, contextPrompt: prompt, outcome: outcome)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

prompt is passed to DictationLog.append as contextPrompt; it can contain prior user-provided text that identifies a person.

Details

✨ AI Reasoning
​The changed call passes prompt as contextPrompt to the dictation log. A contextual prompt can include user-provided text, such as prior transcripts, which may contain personal information. This introduces logging of that content.

🔧 How do I fix it?
Keep sensitive data such as emails, passwords, and tokens out of logs. When logging values tied to a user, prefer a safe identifier like a user ID over the raw input, and strip line breaks from any user-provided text you do log.

Reply on this comment to give feedback or ignore the issue.
More info

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Same as the thread on DictationSession+Pipeline.swift line 161: DictationLog.append already logged this value on main, rebuilding it itself. This PR passes it in from the transcriber instead. The entry's contents don't change, and the write is still gated on developer mode (DictationLog.gated).

Leaving this open for the PR author to decide.


Generated by Claude Code

…eo-fs8szf

# Conflicts:
#	Sources/BlurtEngine/Pipeline/DictationSession+Pipeline.swift
- AssemblyAITranscriber: fitsRecordingLimits sits with the other type
  properties (type_contents_order).
- DictationLog.makeEntry: contextPrompt follows `now`, so the defaulted
  parameters end the list (function_default_parameter_at_end); the
  wrapped calls take one argument per line (multiline_arguments). That
  took the file past 400 lines, so the log-removal sweep moves to
  DictationLog+Removal.swift, beside the errors and commands halves.
- Seams.logTranscript: a TranscriptLogger alias keeps the closure's
  parameters on its opening line (closure_parameter_position).
- ReadAloudVoice.init: accent has no default (function_default_parameter_at_end).
- SelectionSpeaker.voice(for:) follows the initializers (type_contents_order).
- Tests: no shadowed `context`, and a named argument in RecordedLog's
  multiline closure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1W1VYBwrXTmabhFEnf
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit c890dc5 Nov 25, 2026
22 checks passed
@alexkroman
alexkroman deleted the claude/admiring-galileo-fs8szf branch November 25, 2026 23:55
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
Three conflicts:
- DictationLog.swift: #431 moved the log-removal sweep to
  DictationLog+Removal.swift and made the logger internal for it; this PR
  had moved the withheld placeholders to DictationLog+Withholding.swift.
  Each now lives once, in its own file.
- DictationSession+Pipeline.swift: this PR's DictationLog.loggable call,
  followed by #431's sentPrompt for the log.
- DESIGN.md: main's table (#431 renamed SyncSTTLimits), with this PR's
  HopReturn row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1Vp9Andd7LBEDhGKeC
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.

2 participants