Skip to content

Combine Hermes messages and active-work notifications - #209

Merged
Paladin173 merged 4 commits into
mainfrom
issue-208
Nov 15, 2026
Merged

Paladin173 merged 4 commits into
mainfrom
issue-208

Conversation

@Paladin173

@Paladin173 Paladin173 commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

Hermes now uses one notification for its Settings shortcut, background WebUI work and latest browser message, rather than leaving a second idle shortcut behind.

  • The quiet shortcut appears only while Hermes is visible. Leaving the app removes it unless there is actual monitoring/reconnect work or an unread message.
  • Expand the latest message to read it and use the existing trusted WebUI Reply action. Settings becomes a compact cogwheel beside Reply, with a spoken Settings label; other states keep the normal Settings text. Android controls the final layout.
  • Pending approvals take priority. Terminal completion/failure results remain visible, service teardown preserves unread messages, and old dismiss/reply actions cannot erase newer alerts. Unread text can survive process restart, without retaining unusable inline reply actions.
  • Application Settings now has a Notifications section, a clearly explained While open or working option, and a link to this app's Android notification controls.

No new permission, JavaScript bridge, native chat history or official Webapp reply adapter. Alerts received during approval intentionally remain read-only: clearing approval does not prove that the session is idle again. Update/download and opt-in debug-capture notifications remain separate.

Fixes #208.

Testing

Final local verification on 6cdab6d56215751a4c59cc86d69de47e3ac389e5 passes:

  • .\gradlew.bat testDebugUnitTest lintDebug assembleDebug connectedDebugAndroidTest '-Pandroid.testInstrumentationRunnerArguments.class=com.hermeswebui.android.notification.HermesNotificationPresenterTest,com.hermeswebui.android.notification.NotificationReplyInstrumentationTest,com.hermeswebui.android.background.HermesSessionMonitorInstrumentationTest,com.hermeswebui.android.ui.settings.SettingsScreenTest' --no-daemon --console=plain — passed; 47 actual API 35 instrumentation cases, JVM suite, lint and debug APK build.
  • HermesNotificationPresenterTest: actual activity foreground/background/Settings/finish lifecycle, one latest-message slot across tags, stale dismissal fencing, token-specific tap identity, actual MainActivity tap delivery, quiet channel, compact Settings, and a simulated process-state reset reconciled against Android's retained notification.
  • NotificationReplyInstrumentationTest: actual RemoteInput broadcast plus loopback authenticated HTTP; exactly-once/mount/session routing, server/expiry rejection and delayed-result fencing.
  • HermesSessionMonitorInstrumentationTest: actual Android foreground service, loopback SSE/approvals, approval priority, passive-update no-repost, distinct tap route, unread-message preservation, and retained terminal failures/completions.
  • SettingsScreenTest: rendered Notifications section and actual outbound Android notification-settings intent for this package, plus existing Settings regressions.
  • python -m unittest discover -s tools\tests -p 'test_*.py' — passed, 121 tests.
  • python tools\check_markdown.py — passed, 26 files.
  • git diff --check — passed.

Mutation checks: deliberately removed the visible-activity gate, stale-dismiss token check, approval priority, message preservation during service teardown, compact action label, separate service/message PendingIntent request codes, passive-repost suppression, and correct Android Settings package target. Matching tests failed at the expected assertions. Independent review then caught unread-process-restart, unavailable-reply feedback, stale-tap and hidden-terminal-result gaps; additional restoration, token-identity and terminal-result mutations each failed at their matching assertions. All mutations were restored and the final 47-case run is green. The expired-action path now reports unavailable without posting a second notification. A transient first validation run failed because Instrumentation start-activity hooks do not intercept PendingIntent delivery; the test was corrected to observe the real resumed MainActivity instead. The older terminal test was updated to require retained completion followed by explicit dismissal rather than immediate result deletion.

Independent review: read-only review of the initial implementation reported five findings. Four were fixed; the approval-time Reply restriction is deliberate fail-closed behavior, documented above. Follow-up review of exact final SHA 6cdab6d56215751a4c59cc86d69de47e3ac389e5 found no significant issues.

API 35 CI follow-up: the first full CI run had 228 tests, one failure and two skips: the Settings cold-start fixture threw on an absent Compose root before its polling deadline. Commit d42597f6abee50a40ca9c7c06f4f847141fcd84e uses supported empty-root semantics queries for both Settings deep-link readiness checks and explicitly exercises the no-root state before launching the activity. Reverting that query flag reproduced the exact CI exception (RED); restoration passed both focused cases and .\gradlew.bat connectedDebugAndroidTest --no-daemon --console=plain (GREEN), the full unfiltered local API 35 suite: 228 tests, zero failures, two skipped. Markdown and diff checks pass. Independent exact-commit review found no significant issues. No product behavior, wait deadline, required Settings content or CI scope was weakened. Updated GitHub CI is pending; the prior API 36 run passed on the parent commit.

Manual device check: no manual physical-device check; actual API 35 emulator notification/RemoteInput/activity/service interactions ran through instrumentation.

Not covered: live authenticated WebUI conversation, physical/OEM layout or dismissal, actual OS process-kill round trip (restart fixture resets process-local state), TalkBack playback of the speech label, API 36 locally, prolonged background suspension, production update/install flows, or official Webapp direct reply. Full local API 35 now passes as recorded above. PR CI remains the authoritative source for the GitHub-hosted API 35/36 suites; it is not claimed green before readback.

  • .\gradlew.bat testDebugUnitTest --no-daemon
  • .\gradlew.bat lintDebug --no-daemon
  • .\gradlew.bat assembleDebug --no-daemon
  • python -m unittest discover -s tools/tests -p "test_*.py" and python tools/check_markdown.py
  • connectedDebugAndroidTest on an emulator, or note why it was skipped (CI runs API 35 and 36 for Android changes)

QA checklist

  • Behavior changes have the cheapest test that would have caught the regression; the new test was seen to fail with the fix reverted.
  • Injected WebUI JavaScript or a WebUI shim change was also checked with tools/qa against a real server, and the redacted report.md summary is pasted below (or marked not applicable).
  • Security rules hold: no SSL error bypass, no dashboard-config writes, non-allowlisted HTTP/HTTPS stays externalized, no new JavaScript bridge for secrets.
  • No server URL, hostname, credential, keystore, or local machine path is in the diff.
  • README.md, ROADMAP.md, ARCHITECTURE.md, and AGENTS.md are updated where behavior, setup, architecture, or workflow changed.
  • Labels applied from the release-note set (enhancement, user-facing, bug, documentation, skip-changelog).

Live QA summary (if applicable)

Not applicable to injected-script QA: no JavaScript/shim changes. No live-server acceptance claimed. Follow-up coverage limits are logged in #208.

🤖 Generated with GitHub Copilot

Paladin173 and others added 2 commits November 15, 2026 12:12
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Paladin173

Copy link
Copy Markdown
Collaborator Author

API 35 readiness failure corrected

The failing Settings cold-start fixture queried semantics before any Compose root existed, so its polling predicate threw immediately instead of waiting. Commit d42597f6abee50a40ca9c7c06f4f847141fcd84e uses Compose's supported empty-root query mode for the cold-start and adjacent warm Settings deep-link checks. The exact Settings content and 20-second deadline remain required; no broad exception handling, app behavior change or CI suite narrowing was added.

Regression evidence: the cold-start fixture now first queries before activity launch. Restoring the original default query produced the same No compose hierarchies found failure (RED); restoring the empty-root mode passed (GREEN).

Verification: .\gradlew.bat connectedDebugAndroidTest --no-daemon --console=plain passed the complete unfiltered local API 35 suite: 228 tests, 0 failures, 2 skipped. Both targeted Settings deep-link cases also passed. python tools\check_markdown.py and git diff --check passed. Independent read-only review of exact commit d42597f6abee50a40ca9c7c06f4f847141fcd84e found no significant issues.

Not covered: no new physical-device or live-server check. The original full API 36 CI suite passed on the parent commit; the updated CI run must be read back separately. This fixes the test's missing-root readiness handling, not a proven product-side Settings defect.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Paladin173

Copy link
Copy Markdown
Collaborator Author

Full CI follow-up

The corrected full API 35 job passed in run 43751655661 on d42597f6abee50a40ca9c7c06f4f847141fcd84e. The same run exposed one API 36 failure in processRestartPreservesUnreadTextButRemovesDeadReplyActions: the readback waited for unchanged message text, so it could return before Android applied the replacement action list.

Commit e6d3965c07816027de891792c5af8d9172449097 waits for both exact retained text and removal of dead RemoteInput actions, then keeps the original explicit postcondition. No arbitrary sleep, retry wrapper, production change or narrowed CI scope.

Verification: the complete HermesNotificationPresenterTest class passes on an actual API 36 emulator. Deliberately removing production removal of dead actions makes the restart regression fail (RED); restoring it passes (GREEN). Markdown/diff checks pass; independent read-only review of the exact correction SHA found no significant issues. The preceding full local API 35 suite passed all 228 cases with zero failures and two skips.

The new full API 35/36 CI run is pending; neither merge nor release is claimed.

@Paladin173
Paladin173 merged commit 6e90d4b into main Nov 15, 2026
12 checks passed
@Paladin173
Paladin173 deleted the issue-208 branch November 15, 2026 19:49
@Paladin173 Paladin173 mentioned this pull request Nov 15, 2026
7 of 11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request user-facing User-facing change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Combine Hermes notifications and show Settings only while open or working

1 participant