uttrflow / uttrflow/uttrflow-swift
An AI suggestion signs a mail reply with the other person's name from the quoted message
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
In a mail reply, the AI suggestion signs the message with the *other person's* name, taken from the quoted message on screen.
`uttrflow-bakeoff complete --fixtures` on `f969b41` (release, gemma3), fixture `robust/complete-mail/kind-regards/cut13` (`Sources/uttrflow-bakeoff/CatalogueRobust.swift:116-124`):
- On screen: an incoming message from a sender who signs it with their first name
- Typed: `Kind regards,`
- Expected: nothing (the line is complete)
- Drawn: `Kind regards, ` followed by **the sender's first name** (raw pass: `[stop] regards, `)
The copy guard in `MLXCandidateScorer.trimmed` only cuts a comma-separated part that repeats a screen label of at least `shortestLabelPart = 8` characters (`Sources/UttrflowLocalModel/MLXCandidateScorer.swift:240-272`). A first name is shorter, so it passes. `contextNeverCopied` covers the surroundings, but no rule covers a name that appears in them. Healing lets the line continue because `,` is not in `mayEnd`'s `.!?;` (`Sources/UttrflowLocalModel/PromptBuilder.swift:23-26`).
## Why it matters
Signing a reply with the recipient's name is an embarrassing, invented fact. It sits one Tab away at exactly the moment a person reaches for Tab to finish a sign-off.
## Acceptance criteria
- A continuation after a sign-off (`Kind regards,`, `Best,`, `Thanks,` and the like) is never a name that appears only in the on-screen message. For example, drop a continuation whose words are all found in `surroundings` but not in the person's own `recentLines`.
- `robust/complete-mail/kind-regards/cut13` yields nothing, and `mail/` hit counts do not drop.
- A unit test in `Tests/UttrflowLocalModelTests/CompletionParsingTests.swift`.
Contributor guide
Research direction
Start with MLXCandidateScorer.trimmed and the healing rules in Sources/UttrflowLocalModel/PromptBuilder.swift, then inspect Tests/UttrflowLocalModelTests/CompletionParsingTests.swift. Verify that sign-off continuations using names found only in surroundings are dropped, that robust/complete-mail/kind-regards/cut13 yields nothing, and that mail/ hit counts remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- ai, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100