openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

feat(meetings): calendar-triggered auto-join prompt + Meeting Assistant settings UI

Open YellowSnnowmann opened this issue 5 months ago • 1 comments

Summary

  • Watch Google Calendar in the heartbeat planner and proactively prompt the user to add OpenHuman to upcoming Meet calls, gated by heartbeat.notify_meetings.
  • Fix lost Meet URL: PendingEvent now carries a dedicated meeting_url (separate from deep_link, which may point at a calendar details page), extracted from hangoutLink / conferenceData / location.
  • Route by auto_join_policy: Never → skip, Always → auto-join + transparency notification, AskEachTime → CoreNotificationCard with Join (listen) / Join (active) / Skip / Always-join actions.
  • New RPC openhuman.agent_meetings_notification_action ({notification_id, action_id, payload} → {ok}) handling join / skip / always_join.
  • New Meeting Assistant settings panel (auto-join, auto-summarize, listen-only default, transcript ingestion), persisted via MeetSettingsPatch.
  • New DomainEvents MeetingSessionCreated + MeetingAutoJoinTriggered; full i18n across all 14 locales.

Problem

collect_calendar_meetings stored htmlLink in deep_link when an event had both links, so the Meet URL was lost and the assistant could never act on an upcoming call. There was also no UI to control auto-join / auto-summarize / listen-only / transcript-ingestion behavior.

Solution

  • Detection (core): collect_calendar_events_recursive extracts the join URL via extract_meeting_url_from_map (matches known meeting host patterns through is_meeting_url) and populates PendingEvent.meeting_url. agent_meetings/calendar.rs adds auto_join_policy_owns_notification + handle_calendar_meeting_candidate to filter Meet meetings and route by policy.
  • Prompt flow: planner forwards imminent meetings to the auto-join policy, suppressing the generic plain card when the AskEachTime prompt owns the notification. Honors the ~30-min lead window + happening-now check; reuses existing dedup (fingerprint/overlap_key).
  • Action handling: handle_notification_action (ops.rs) resolves join (listen-only + correlation_id), skip (session → Ended), always_join (flip config + join).
  • Frontend: CoreNotificationCard renders localized action buttons (ACTION_LABEL_KEYS, primary/secondary styling) and dispatches over callCoreRpc; actions threaded through nativeNotifications/service.ts.
  • Settings: MeetSettingsPatch extended with auto_join_policy / auto_summarize_policy / listen_only_default / ingest_backend_transcripts; MeetingSettingsPanel wired into settings route registry + nav. Default ask_each_time — no silent joins.

Submission Checklist

  • [x] Tests added or updated — Rust: URL extraction (happy + Hangout/conferenceData/Zoom-location edge cases), policy routing branches (ask/always/never), notification-action variants, events_tests.rs, ops_tests.rs. Vitest: CoreNotificationCard.test.tsx (button states + read state + RPC dispatch), MeetingSettingsPanel.test.tsx (each toggle/radio reads+writes config), config.test.ts, nativeNotifications/service.test.ts.
  • [x] Diff coverage ≥ 80% — run pnpm test:coverage + pnpm test:rust locally to confirm.
  • [x] Coverage matrix updated — update docs/TEST-COVERAGE-MATRIX.md (or mark N/A).
  • [x] All affected feature IDs listed under ## Related.
  • [x] No new external network dependencies introduced (mock backend used).
  • [x] Manual smoke checklist updated if this touches release-cut surfaces.
  • [x] Linked issues closed via Closes #NNNN in ## Related.

Impact

  • Platform: desktop (Tauri). Calendar detection runs in the core heartbeat; no new network deps.
  • Privacy/security: auto-join opt-in, default ask_each_time; Always still posts a transparency notification. Listen-only configurable. No secrets/PII logged (namespaced debug).
  • Migration: new config fields default-initialized; existing configs unaffected.

Related

  • Closes: #3507
  • Closes: #3511
  • Part of epic #3505 / #3522 (PR-1 + PR-5).
  • Follow-up PR(s)/TODOs: confirm docs/TEST-COVERAGE-MATRIX.md rows.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added actionable meeting notifications (join modes, skip, and related auto-join options), including “read” handling to prevent re-clicking after success.
    • Introduced a Meetings settings panel for automatic joining, post-call summarization, listen-only default, and backend transcript ingestion, and surfaced core actionable notifications in the notification center.
  • Localization
    • Added meeting notification and Meetings settings translations across all supported languages.
  • Tests
    • Added coverage for notification action behavior and meeting settings loading, saving, error states, and non-Tauri fallback.

YellowSnnowmann avatar Jun 16 '26 12:06 YellowSnnowmann

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3099a773-ea5e-4b46-a08c-6c831e456887

📥 Commits

Reviewing files that changed from the base of the PR and between ea341a8bfcede93d3b66a4571a0b2e14fec647c2 and 62584f30932a3dbd7736f4f03a3b2554787c506f.

📒 Files selected for processing (5)
  • app/src/lib/i18n/fr.ts
  • app/src/lib/i18n/pt.ts
  • app/src/lib/i18n/ru.ts
  • src/openhuman/agent_meetings/calendar.rs
  • src/openhuman/subconscious/heartbeat/planner/mod.rs
✅ Files skipped from review due to trivial changes (2)
  • app/src/lib/i18n/pt.ts
  • app/src/lib/i18n/fr.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/lib/i18n/ru.ts

📝 Walkthrough

Walkthrough

Implements Meeting Assistant PR-1 (calendar auto-join prompt) and PR-5 (settings UI). The backend gains meeting URL extraction in the heartbeat planner, a refactored calendar auto-join policy handler publishing MeetingSessionCreated/MeetingAutoJoinTriggered domain events, and an expanded MeetSettings config RPC surface. The frontend adds CoreNotificationCard with action buttons, a clearNotificationActions Redux action, a new MeetingSettingsPanel, and i18n strings across 14 locales.

Changes

Meeting Assistant: calendar auto-join, notification actions UI, and settings panel

Layer / File(s) Summary
Backend: expanded MeetSettings config contract and RPC handlers
src/openhuman/config/schemas/helpers.rs, src/openhuman/config/schemas/schema_defs.rs, src/openhuman/config/schemas/controllers.rs, src/openhuman/config/ops/ui.rs, src/openhuman/config/ops_tests.rs
MeetSettingsUpdate/MeetSettingsPatch extended with auto_join_policy, auto_summarize_policy, listen_only_default, and ingest_backend_transcripts; schema inputs/outputs expanded; controllers validate and map policy strings to enums, returning errors on invalid values; apply_meet_settings conditionally applies all new fields; ops tests cover full-patch and no-op branches.
Backend: MeetingSessionCreated and MeetingAutoJoinTriggered domain events
src/core/event_bus/events.rs, src/core/event_bus/events_tests.rs
Two new DomainEvent variants added with their payload fields; both routed to agent_meetings domain; variant_name() extended; domain routing and stable-name regression tests added.
Backend: PendingEvent.meeting_url and heartbeat planner URL extraction
src/openhuman/subconscious/heartbeat/planner/types.rs, src/openhuman/subconscious/heartbeat/planner/collectors.rs, src/openhuman/subconscious/heartbeat/planner/persistence.rs
PendingEvent gains optional meeting_url; collectors extract it from hangoutLink, conferenceData.entryPoints[].uri, or free-form location text using host-pattern allowlist; persistence serializes it; cron/notification collectors initialize to None; unit tests cover all extraction and rejection paths.
Backend: calendar auto-join policy orchestration
src/openhuman/agent_meetings/calendar.rs
handle_calendar_meeting_candidate extracted as public async function returning ownership flag; auto_join_policy_owns_notification predicate added; Never returns false, Always publishes MeetingAutoJoinTriggered and spawns join with listen_only_default, AskEachTime deduplicates by meet URL, creates MeetingSession, publishes MeetingSessionCreated, emits CoreNotificationEvent with join/skip/always-join actions; unit tests cover ownership predicate for all policies.
Frontend: expanded MeetSettings RPC types and Tauri command wrappers
app/src/utils/tauriCommands/config.ts, app/src/utils/tauriCommands/config.test.ts, app/src/test/setup.ts
MeetAutoJoinPolicy, MeetAutoSummarizePolicy, MeetSettings, MeetSettingsUpdate exported; openhumanUpdateMeetSettings and openhumanGetMeetSettings updated to use the new shapes; tests and global mock cover the full settings payload.
Frontend: notification actions Redux model and service pass-through
app/src/store/notificationSlice.ts, app/src/lib/nativeNotifications/service.ts, app/src/lib/nativeNotifications/__tests__/service.test.ts
clearNotificationActions reducer added to clear actions by notification id; CoreNotificationPayload extended with optional actions; service passes p.actions through on core_notification events and in test helper; service test verifies actions preserved in Redux store.
Frontend: CoreNotificationCard and NotificationCenter integration
app/src/components/notifications/CoreNotificationCard.tsx, app/src/components/notifications/CoreNotificationCard.test.tsx, app/src/components/notifications/NotificationCenter.tsx
CoreNotificationCard renders action buttons from ACTION_LABEL_KEYS i18n map, disables all buttons during in-flight RPC, dispatches markRead/clearNotificationActions on success, shows localized error on failure; NotificationCenter filters coreActionItems and renders cards at top; empty-state condition updated; tests cover all interaction paths including RPC dispatch, Redux state mutations, disabled state, empty actions, and unread indicator.
Frontend: MeetingSettingsPanel, routing, and settings registry
app/src/components/settings/panels/MeetingSettingsPanel.tsx, app/src/components/settings/panels/__tests__/MeetingSettingsPanel.test.tsx, app/src/pages/Settings.tsx, app/src/components/settings/settingsRouteRegistry.ts, app/src/components/settings/hooks/useSettingsNavigation.ts, app/src/components/settings/layout/settingsNavIcons.tsx
MeetingSettingsPanel loads/persists four settings via Tauri with sequence-ref ordering guard; renders policy selects and boolean toggles; non-Tauri and loading branches included; wired into Settings router and SETTINGS_ROUTE_REGISTRY under connections nav group; SettingsRoute union and nav icons updated; tests cover load, change handlers, non-Tauri, errors, and saved states.
Frontend: i18n translations across 14 locales
app/src/lib/i18n/en.ts, app/src/lib/i18n/ar.ts, app/src/lib/i18n/bn.ts, app/src/lib/i18n/de.ts, app/src/lib/i18n/es.ts, app/src/lib/i18n/fr.ts, app/src/lib/i18n/hi.ts, app/src/lib/i18n/id.ts, app/src/lib/i18n/it.ts, app/src/lib/i18n/ko.ts, app/src/lib/i18n/pl.ts, app/src/lib/i18n/pt.ts, app/src/lib/i18n/ru.ts, app/src/lib/i18n/zh-CN.ts
notifications.meeting.* and settings.meetings.* keys added covering join modes (listen-only vs active), skip/always-join options, action error message, auto-join/auto-summarize policies, listen-only mode, and transcript ingestion descriptions.

Sequence Diagram(s)

sequenceDiagram
  participant Heartbeat as Heartbeat Planner
  participant Collectors as extract_meeting_url_from_map
  participant Calendar as handle_calendar_meeting_candidate
  participant EventBus as DomainEvent Bus
  participant Redux as Redux / NotificationSlice
  participant Card as CoreNotificationCard
  participant RPC as agent_meetings_notification_action

  Heartbeat->>Collectors: collect_calendar_meetings(events)
  Collectors-->>Heartbeat: PendingEvent { meeting_url: Some(...) }
  Heartbeat->>Calendar: handle_calendar_meeting_candidate(meet_url, title)
  alt AskEachTime policy
    Calendar->>EventBus: publish MeetingSessionCreated
    Calendar->>Redux: dispatch CoreNotificationEvent { actions: [join, skip, alwaysJoin] }
    Calendar-->>Heartbeat: owns_notification = true
    Redux-->>Card: render action buttons
    Card->>RPC: openhuman.agent_meetings_notification_action { action_id, payload }
    RPC-->>Card: ok
    Card->>Redux: dispatch markRead + clearNotificationActions
  else Always policy
    Calendar->>EventBus: publish MeetingAutoJoinTriggered
    Calendar->>Calendar: spawn auto_join_meeting(listen_only_default)
    Calendar-->>Heartbeat: owns_notification = true
  else Never policy
    Calendar-->>Heartbeat: owns_notification = false
  end

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • tinyhumansai/openhuman#3516: Introduced the NotificationAction/NotificationItem.actions data model and CoreNotificationEvent.actions backend support that this PR's CoreNotificationCard and Redux clearNotificationActions directly consume.
  • tinyhumansai/openhuman#3575: Both PRs extend SettingsRoute in useSettingsNavigation.ts with new route literals and add entries to SETTINGS_ROUTE_REGISTRY.
  • tinyhumansai/openhuman#3363: Both PRs modify the agent-meetings join flow through agent_meetings/ops.rs and meet settings schemas, touching the same call plumbing and event handling paths for meeting session orchestration.

Suggested reviewers

  • graycyrus
  • sanil-23

🐇 Hippity-hop, a meeting's in sight, The calendar pings — join left or right! "Ask each time," the rabbit proclaims, Skip, always-join — or just listen to frames. Config saves, the buttons appear, OpenHuman hops in… the meeting is here! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main feature being implemented: calendar-triggered auto-join prompt functionality and Meeting Assistant settings UI, which aligns with the primary objectives and changes in the codebase.
Linked Issues check ✅ Passed The pull request successfully implements all major objectives from issues #3507 and #3511, including the bug fix for lost Meet URLs, auto-join policy routing, notification actions, settings panel with full i18n support across 14 locales, and comprehensive test coverage for both backend and frontend components.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue objectives: meeting URL extraction, auto-join policy implementation, notification actions, settings UI, i18n translations, and supporting infrastructure. No extraneous or unrelated modifications are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Jun 16 '26 12:06 coderabbitai[bot]

Code review — calendar-triggered auto-join + Meeting Assistant settings

Walkthrough. Adds a calendar-driven Meet auto-join flow: the heartbeat planner forwards imminent meetings to handle_calendar_meeting_candidate, which routes by auto_join_policy (Never/Always/AskEachTime), surfaces an actionable CoreNotificationCard in AskEachTime mode, and wires up a new Meeting Assistant settings panel + agent_meetings_notification_action RPC. The work is well-tested (URL extraction edge cases, policy ownership, payload builders, notification-action variants, settings apply, Vitest for the card/panel/service) and i18n parity is complete (27 keys × 14 locales). Overall solid; a few correctness/consistency items below.

Changed-files summary (highlights)

Area Files Notes
Core routing agent_meetings/calendar.rs, agent_meetings/ops.rs candidate handler, policy routing, action handler, payload builders
Heartbeat planner/{mod,collectors,types,persistence}.rs meeting_url plumbing + forwarding/suppression
Config config/ops/ui.rs, config/schemas/{controllers,helpers,schema_defs}.rs MeetSettingsPatch extension + RPC
Frontend CoreNotificationCard.tsx, MeetingSettingsPanel.tsx, notificationSlice.ts, nativeNotifications/service.ts, settings wiring actionable card + settings panel
i18n 14 locale files full parity

Major

1. Always policy has no per-meeting dedup → duplicate bot:join. handle_calendar_meeting_candidate (calendar.rs, Always branch) spawns auto_join_meeting with a fresh correlation_id every call and creates no session — unlike the AskEachTime branch, which dedups via store::get_session_by_meet_url. The same imminent meeting reaches this function from multiple callers:

  • The heartbeat planner forwards on two allow_external stages — final_call (0–10 min) and starting_now (0 to −10 min) in planner/plan.rs:34-57. Each is a distinct dedupe_key (keyed on stage), so mark_sent lets both through across ticks.
  • The live Composio MeetCalendarSubscriber also calls it directly.

Net effect with auto_join_policy = Always: the bot can be told to join the same meeting 2+ times with different correlation IDs (so the backend can't dedup by correlation). Suggest mirroring the AskEachTime dedup in the Always branch — e.g. create/check a session (or a meet_url-keyed marker) before spawning the join:

AutoJoinPolicy::Always => {
    if let Ok(Some(existing)) = store::get_session_by_meet_url(&config, &meet_url) {
        if existing.status != MeetingSessionStatus::Ended {
            tracing::debug!(meeting_id = %existing.id, "[meet:calendar] already auto-joined — skipping");
            return false;
        }
    }
    // ...create a session, then spawn auto_join_meeting...
}

Major (pre-existing, now load-bearing)

2. Composio path extract_meet_url leaks free-form location strings — the exact case collectors.rs just fixed. collectors.rs correctly added extract_meeting_url_from_text so a location like "Zoom Meeting: https://zoom.us/j/123" yields only the parseable URL (with a comment explaining that returning the whole string produces a meeting_url the join handler rejects). But the sibling Composio path extract_meet_url in calendar.rs:574-579 still returns the whole location string:

if let Some(loc) = root.get("location").and_then(|v| v.as_str()) {
    if is_meeting_url(loc) {
        return Some(loc.to_string());   // returns "Zoom Meeting: https://zoom.us/j/123"
    }
}

That string becomes the meetUrl in the AskEachTime action payload; when the user clicks Join, handle_notification_action → handle_join → validate_meeting_url runs url::Url::parse and fails. The buttons silently never work for Zoom/Teams-in-location events arriving via Composio. Reuse the same token-scan helper here (see nitpick #3 for de-dup).

Minor / nitpicks

3. MEETING_HOST_PATTERNS + is_meeting_url triplicated. Now defined in calendar.rs:532-541, collectors.rs:436-441, and as ALLOWED_HOSTS in ops.rs:21-26. Consider a single shared helper (and have both extractors funnel free-form text through one extract_meeting_url_from_text), which would also fix #2 for free.

4. extract_meeting_url_from_text doesn't strip a trailing period. The trim set covers ()[]<>,;"' but not ., so …link: https://zoom.us/j/123. keeps the trailing dot (which url::Url::parse accepts as path), yielding a slightly-off URL. Add . to the trim set.

Questions

  • For Never, the generic "meeting starting" plain card still fires (by design per the doc comment). Intended that a user who set Never still gets heads-up cards? (Seems fine, just confirming.)

Looks good

  • AskEachTime session-dedup, fail-closed fallbacks (config-load failure / session-create failure → plain reminder, returns false so the planner still notifies), and the effective_listen_only "no anchor ⇒ listen-only" safety rule are all well-reasoned and tested.
  • CoreNotificationCard guards double-clicks (pendingActionId) and clears actions after success to prevent re-firing bot:join/always_join.
  • auto_join_policy / auto_summarize_policy RPC parsing rejects unknown values with a clear error.
  • i18n parity complete; settings route/icon/registry wiring consistent.

Read-only review — no changes pushed.

sanil-23 avatar Jun 17 '26 07:06 sanil-23

Addressed all four items from sanil-23's review (pending commit + push):

Major #1 — Always policy dedup: Added store::get_session_by_meet_url guard before spawning auto_join_meeting. If a non-Ended session already exists for the URL, we return early. Also create a Joined session (keyed by correlation_id) before spawning, so subsequent heartbeat ticks and Composio re-fires find the existing entry and skip. Session-create failure logs a warning but proceeds (best-effort dedup).

Major #2 — extract_meet_url location leaks free-form string: The location branch now calls extract_meeting_url_from_text (a new local helper mirroring the one in collectors.rs) instead of returning the raw loc string. Free-form locations like "Zoom Meeting: https://zoom.us/j/123" now yield only the parseable URL.

Minor #3 — MEETING_HOST_PATTERNS triplicated: Intentionally deferred as a follow-up refactor — consolidating across calendar.rs, collectors.rs, and ops.rs would cross domain boundaries and is pure cleanup. The correctness fixes (#1 and #2) are self-contained.

Minor #4 — extract_meeting_url_from_text missing trailing period: Added . to the trim_matches set in both collectors.rs and the new calendar.rs copy.

New tests cover: free-form label+URL extraction, paren/bracket stripping, trailing-period stripping, non-meeting locations, and the integration-level extract_meet_url with free-form location fields.

YellowSnnowmann avatar Jun 17 '26 08:06 YellowSnnowmann

I re-checked the current head (af621dff) against the blocking review items. The two correctness blockers appear addressed in code now:\n\n- Always-policy duplicate joins: src/openhuman/agent_meetings/calendar.rs now checks store::get_session_by_meet_url(&config, &meet_url) before spawning ot:join, and skips when an active non-ended session exists.\n- Composio free-form location: xtract_meet_url now routes the location field through xtract_meeting_url_from_text, returning only a parseable http(s) meeting URL token. There are tests for free-form Zoom and Teams location strings.\n\nCurrent CI on #3721 is green, including Rust Quality, Rust Core/Tauri Coverage, Rust E2E, Frontend Quality/Coverage, Playwright shards, and Coverage Gate. The only unresolved GraphQL thread I see is the MeetingSettingsPanel rollback comment, which the current head also addresses with rollback callbacks and tests per the author reply.\n\nRequesting a reviewer re-check on the stale CHANGES_REQUESTED state.

Felyx-Fu avatar Jun 17 '26 10:06 Felyx-Fu