uttrflow / uttrflow/uttrflow-swift

Context cleanup removes the timestamps needed to recognize chat conversations

Open
#795 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## Problem

The timestamp-based conversation detector works on raw screen fixtures but loses its evidence on the production context path. `Surroundings.trimmed` removes timestamp parts before `Register.infer` sees them. In a chat whose speaker names and timestamps occupy separate elements, neither timestamp-based turns nor colon-prefixed speaker turns remain. The register treats the reply as an ordinary line and omits its conversation hint.

Reviewed and reproduced on main `8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d`.

## Evidence

- [Collector cleanup](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowContext/Surroundings.swift#L186-L194) calls `Timestamps.without` on each element.
- [Coordinator](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/Uttrflow/Suggestion/SuggestionCoordinator.swift#L555-L575) passes `around.text` as generation surroundings.
- [Register](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowPredict/Register.swift#L155-L175) recognizes timed turns by finding at least two clock-bearing lines beside a message composer.

An isolated test uses the real `Surroundings.collect` with the repository's fake element tree. Its window contains separate static-text elements:

```text
Chats
Neha
10:31 AM
Standup moved, please confirm.
Arjun
10:33 AM
Confirmed.
```

The focused field is a message composer (`Message #platform`). The collected text is:

```text
Chats
Neha
Standup moved, please confirm.
Arjun
Confirmed.
```

Passing the original lines to `Register.infer` gives `isConversational == true`; passing the actual collected text gives `false`. The expected conversation assertion fails. This is the same layout covered by the existing `RegisterConversationTests` team-chat fixture, but those tests bypass the collector. All 38 selected original tests in this review batch pass; the added boundary test fails.

No live Accessibility session or model-generated reply was measured, so this reports the verified classification and prompt-hint defect, not a measured reply-quality rate.

## Acceptance

Preserve conversation evidence across collection and inference while still keeping timestamps out of generated prose. For example, carry structured turn evidence separately from cleaned prompt text. Add a collector-to-register regression for the separate-name/time layout and the inline timestamp layout already represented by the register tests. Retain the negative page-navigation cases from #454.

#454 addresses false positives on non-chat screens; this is a separate false negative introduced by cleanup before inference. Checked open and closed issues and current open PRs before filing.

Contributor guide

Open the contributing guide

Research direction

Start with the cleanup in Sources/UttrflowContext/Surroundings.swift, then trace SuggestionCoordinator.swift into Register.swift and compare the collector path with RegisterConversationTests. Run the focused collector-to-register regression and the existing conversation and #454 negative cases; done means both separate-name/time and inline-timestamp layouts retain conversation detection without putting timestamps into generated prose.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
accessibility, desktop, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.