← Back to Pull requests

Fix notification regressions from #527 (bugfix) #544

Closed
unknown closed this pull request without merging on Nov 27, 2026 03:28 UTC
View on GitHub
unknown unknown commented on Nov 27, 2026 01:21 UTC
Author

Follow-up to #527, which merged without Reviewer's review fixes. This carries those fixes, rebased onto what merged in fac6d963 and on current master. Each commit is one regression or gap found in the review, with its test. Every new test fails without its fix (checked by reverting each fix locally) and passes with it.

Fixes

1. Notifications: a Bot Chat silence no longer re-sends the previous reply. On a legacy (tui_gateway) gateway, Bot Chat's message.complete is {"text": ""} for a silence (tui_gateway/prompt_turn.py _bot_mode_delivery_text). The reducer drops the turn's empty bubble, so the old reply is last again and was notified a second time.
Test: ReplyActivityTest.aBotChatSilenceDoesNotBringBackThePreviousReply, aTurnsOwnReplyIsNew.
2. Notifications: a watched turn that ended before the attach still says it finished. SessionWatcher has no reply text for such a turn. #527's early return in postReply dropped that notification. WatchedTurnEnd.text is now nullable, where null means not known, and that case says "Finished.". An empty text that was at hand (a silence) still posts nothing.
Tests: SessionWatcherTest.aTurnThatEndedBeforeTheAttachStillSaysItFinished (updated), ChatNotificationsTest.aWatchedTurnWhoseReplyWasntAtHandSaysItFinished, aWatchedTurnThatEndedInSilenceStaysUntold.
3. Notifications: a reply read back on a reconnect is still told. On a reconnect, loadHistory() publishes the finished reply while running is still true, so the check against the state just before the end suppressed a real reply. The check now compares with the chat as it was when the turn started, on Android (ChatNotifier) and desktop (DesktopNotifier).
Tests: ReplyActivityTest.aReplyReadBackOnAReconnectIsNewAgainstTheTurnsStart, DesktopNotifierTest.aReplyReadBackOnAReconnectBeforeTheTurnEndsIsStillTold.
4. Notifications: a reply that is only a picture still notifies. A caption-less ![](url) reply has a blank preview, and postReply returned early. It now says "Finished.". Other markup that renders as nothing, such as [](/document), still posts nothing, as master's test expects.
Test: ChatNotificationsTest.aReplyThatIsOnlyAPictureSaysItFinished.
5. Bots: the unread check no longer brings back an older roster or reads past the last look. This was adapted to master's async unread worker, which already caps paging at 5 pages.
- Roster reads that overlap and answer out of order no longer let an older roster replace a newer one.
- The history scan stops at the first page that reaches the last look, since pages go back in time.
- A history that can't be read before the bot's badge was ever decided falls back to the roster activity. A scan that runs out of pages still leaves the badge as it was.
Tests (new BotsViewModel unread tests, MockEngine for REST and a fake JSON-RPC transport): BotsViewModelTakenTest.anOlderRosterReadThatAnswersLastIsDropped, aPageThatReachesTheLastLookEndsTheScan, aHistoryThatCantBeReadBeforeAnyBadgeGoesByTheActivity.
6. Chat: the unread line's KDoc says a reply needs words to count. Docs only.
7. Notifications: a silence after a mid-turn history read doesn't re-send the old reply. A history read during the turn re-keys the old reply from live-N to its row id. A reply this turn didn't stream, under a key the turn start doesn't have, now counts as the old one when its content matches.
Test: ReplyActivityTest.aSilenceAfterAHistoryReadDoesNotBringBackThePreviousReplyUnderItsRowKey.

Testing

  • The CONTRIBUTING "Tests" command plus :desktopApp:compileKotlinJvm :desktopApp:jvmTest passes locally, with lint clean.

  • The race test uses a virtual-time delay well under the RPC timeout. It passed 5 reruns in a row.

  • Not tested on the emulator. Slot 0's package manager was hung, and slot 1 couldn't start beside it. Fixes 1 and 7 (legacy message.complete with empty text) and fix 3 (reconnect) are proven by unit tests that drive the reducer and notifier with the gateway's payloads.

  • Gateway-facing behaviour is unchanged for legacy and session-authority gateways. No new calls are made.

  • There's no ROADMAP item for this bugfix, as with #527.
  • Review follow-ups (rebased on master)

    8. Bots: an older roster read changes nothing. It is dropped before it marks a bot's chat as known, its failure (or one from the gateway before a switch) shows no error, and a read asked before or during a pin, hide or delete can't undo it on screen. Tests: anOlderRosterReadThatFailsLastShowsNoError, aRosterReadAskedBeforeAPinDoesNotUndoIt.
    9. Bots: the activity guess is only for a chat not read here. It compares the chat's id, so a failed read of a chat read before keeps its badge, and a fresh chat goes by the activity. Tests: aFreshChatWhoseHistoryCantBeReadGoesByTheActivity, aChatReadBeforeKeepsItsBadgeWhenItsHistoryCantBeReadAgain.
    10. Notifications: a same-words reply read back on a reconnect is told. An unstreamed reply under a new key is new when the chat has more finished replies with those words than at the turn's start. Times can't decide it, because a history read dates the old reply by the turn's later steps. Test: aReplyReadBackOnAReconnectWithTheSameWordsAsTheLastIsNew.
    11. Notifications: a Bot Chat message that is only a picture says "Finished.", as postReply now does. Two different pictures aren't deduped as one. Tests: aBotMessageThatIsOnlyAPictureStillPosts, twoPicturesFromTwoPathsAreTwoMessages.

    Each new test fails without its fix.

    Emulator (hermes-agent v0.23.4, legacy dashboard path, fake model)

  • Ordinary chat, app in the background: a silent turn and a tool-only turn post nothing; a reply posts its text; a reply that is only a picture posts "Finished.".

  • Bot Chat (message.complete text is empty for a silence): a silent turn and a tool-only turn post nothing and the old reply isn't sent again; a picture-only message posts "Finished.".

  • Reconnect (gateway port cut while the app is in the background): a reply that finished while offline is told once on reconnect; an idle reconnect posts nothing; a silent turn across a reconnect posts nothing.

  • Bots roster: a tool-only turn while away leaves no unread dot; a reply while away gets one.

  • On this gateway, master also passes the Bot Chat silent and tool-only turns and the reply told after a reconnect: its event order never reaches the states fixes 1 and 3 handle. Those fixes, and 7, stay covered by unit tests.

  • The roster's unread dot after a reply sometimes doesn't show, on master too (2 of 5 runs): the gateway's last_active sometimes lags behind the reply. That predates this PR.
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: Giton22 Review duration: 126m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #544"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%