Skip to content

Fix dictation prompt role separation#392

Open
sdhilip200 wants to merge 1 commit into
altic-dev:mainfrom
sdhilip200:codex/fix-dictation-prompt-messages
Open

Fix dictation prompt role separation#392
sdhilip200 wants to merge 1 commit into
altic-dev:mainfrom
sdhilip200:codex/fix-dictation-prompt-messages

Conversation

@sdhilip200

Copy link
Copy Markdown

Description

Fixes dictation post-processing prompt composition so cleanup instructions are sent as the system message and the transcript is sent separately as tagged user content. Legacy custom prompts that still use ${transcript} continue to render with replacement behavior.

Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update

Related Issues

Testing

  • Tested on Intel Mac
  • Tested on Apple Silicon Mac
  • Tested on macOS 26.2
  • Ran linter locally: swiftlint --strict --config .swiftlint.yml Sources
  • Ran formatter locally: swiftformat --config .swiftformat Sources
  • Built locally: sh build_incremental.sh

Additional validation run locally:

  • xcodebuild clean build -project Fluid.xcodeproj -scheme Fluid -destination platform=macOS,arch=arm64 -derivedDataPath /private/tmp/FluidVoiceDerivedData CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -quiet
  • xcodebuild test -project Fluid.xcodeproj -scheme Fluid -destination platform=macOS,arch=arm64 -derivedDataPath /private/tmp/FluidVoiceDerivedData CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -quiet
  • git diff --check

Notes

  • The SwiftPM lockfile updates modelcontextprotocol/swift-sdk to 0.12.1 because the previously pinned 0.10.2 fails to compile under Xcode 26.5 / Swift 6 strict-concurrency checking.
  • sh build_incremental.sh currently fails in this checkout because it references build_dev.sh, which is not present in the repository. Direct xcodebuild build and test commands passed instead.
  • Full swiftformat --config .swiftformat Sources was not committed because it rewrites broad pre-existing formatting drift outside this focused bugfix.

Screenshots / Video

N/A - no UI changes.

@sdhilip200
sdhilip200 force-pushed the codex/fix-dictation-prompt-messages branch from 0e90bff to b9b0ba5 Compare July 26, 2026 20:30
@sdhilip200

Copy link
Copy Markdown
Author

Rebased onto current \ and resolved the conflict in \ by preserving the newer package pins alongside this change. Force-pushed the updated branch. I attempted , but this machine is currently blocked by a local Swift toolchain/SDK mismatch plus cache permission errors, so I couldn’t complete runtime verification here.

@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown

Greptile Summary

Updates dictation prompt composition while preserving legacy transcript templates.

  • Sends cleanup instructions as a system message and wraps the transcript as tagged user content.
  • Preserves single-user-message substitution for prompts containing ${transcript}.
  • Applies the role separation consistently to interactive and service-based dictation processing.
  • Adds coverage for transcript-only user-message rendering.
  • Updates the Xcode SwiftPM resolution with swift-sdk 0.12.1 and its transitive dependencies.

Confidence Score: 4/5

The PR is safe to merge, with a non-blocking gap in coverage for complete message-role composition.

The dictation paths consistently separate instructions from transcript content and preserve legacy placeholder behavior, but the added test validates only transcript rendering rather than the final system and user message arrays.

Files Needing Attention: Tests/FluidDictationIntegrationTests/DictationE2ETests.swift

Fix All in Codex

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
Tests/FluidDictationIntegrationTests/DictationE2ETests.swift:1468-1477
**Cover complete message composition**

This test exercises only `renderDictationUserMessage`, so it does not verify that ordinary prompts become system messages or that `${transcript}` templates continue to omit the system role. Add coverage for the complete message array in both cases to protect the role-separation behavior this change introduces.

Reviews (1): Last reviewed commit: "Fix dictation post-processing prompt rol..." | Re-trigger Greptile

Comment on lines +1468 to +1477
func testDictationUserMessageWrapsTranscriptWithoutPromptInstructions() {
let userMessage = SettingsStore.renderDictationUserMessage(
promptText: "Clean up this transcript and output only the edited text.",
transcript: "hello fluid voice"
)

XCTAssertEqual(userMessage, "<transcript>\nhello fluid voice\n</transcript>")
XCTAssertFalse(userMessage.contains("Clean up this transcript"))
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Cover complete message composition

This test exercises only renderDictationUserMessage, so it does not verify that ordinary prompts become system messages or that ${transcript} templates continue to omit the system role. Add coverage for the complete message array in both cases to protect the role-separation behavior this change introduces.

Knowledge Base Used: AI Enhancement Pipeline

Prompt To Fix With AI
This is a comment left during a code review.
Path: Tests/FluidDictationIntegrationTests/DictationE2ETests.swift
Line: 1468-1477

Comment:
**Cover complete message composition**

This test exercises only `renderDictationUserMessage`, so it does not verify that ordinary prompts become system messages or that `${transcript}` templates continue to omit the system role. Add coverage for the complete message array in both cases to protect the role-separation behavior this change introduces.

**Knowledge Base Used:** [AI Enhancement Pipeline](https://app.greptile.com/altic/-/custom-context/knowledge-base/altic-dev/fluidvoice/-/docs/ai-enhancement.md)

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex

@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: b9b0ba5974

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

let trimmedPrompt = promptText.trimmingCharacters(in: .whitespacesAndNewlines)
if trimmedPrompt.isEmpty { return transcript }
return promptText + "\n\n" + transcript
return "<transcript>\n\(transcript)\n</transcript>"

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 Update the custom-prompt request-body test for separated roles

For every non-placeholder custom prompt, this return value no longer contains promptText, but testCustomPromptOnly_omitsBasePromptFromEffectivePromptAndRequestBody in LLMClientRequestBodyTests.swift still constructs a request containing only this user message and then asserts that the message contents include profile.prompt. That test is part of the FluidDictationIntegrationTests target and will now fail deterministically; update it to construct the new system-plus-user message layout.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant