Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(calendar): answer an RSVP without an address as the copy's inbox (#8569)
gbirmanae1f32b9cc91
diff --git a/apps/docs/AI/mcp/tools/update-calendar-event.mdx b/apps/docs/AI/mcp/tools/update-calendar-event.mdxindex b25082af15..45d6abef8c 100644--- a/apps/docs/AI/mcp/tools/update-calendar-event.mdx+++ b/apps/docs/AI/mcp/tools/update-calendar-event.mdx@@ -12,7 +12,7 @@ Update an existing calendar event. Only the supplied fields change; omitted fielPassing `attendees` replaces the full attendee list — include everyone who should remain, not just additions. That holds when `viewerCan.removeGuests` from ListCalendarEvents is true (the user organizes the event, or the organizer lets guests modify it). When it is false, the list may only grow: pass the current attendees plus the additions; the additions are invited without touching anyone else, and dropping any guest fails. Adding guests then needs `viewerCan.inviteGuests`; otherwise the organizer doesn't let guests invite others or hides the guest list, or the event is an Outlook meeting the user doesn't organize. An empty string for `description` or `location` clears it. Fails on events from calendars the user cannot edit.-`rsvp` sets the user's own response to an invitation and is independent of the field edits — it can be the only thing this call changes. It applies at the same `scope` as the rest of the call, and only works on events the user is actually an attendee of.+`rsvp` sets the user's own response to an invitation and is independent of the field edits — it can be the only thing this call changes. It applies at the same `scope` as the rest of the call and answers as the connected inbox the event's copy belongs to, so it only works when that inbox is an attendee.## Parametersdiff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/rsvpCalendarEventRequest.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/rsvpCalendarEventRequest.tsindex c8297c3749..4d7dbefb34 100644--- a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/rsvpCalendarEventRequest.ts+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/rsvpCalendarEventRequest.ts@@ -20,7 +20,8 @@ from more than one calendar. Omit to answer on the canonical copy. */calendarId?: RsvpCalendarEventRequestCalendarId;/** Original-start key of the occurrence the response targets. */recurrenceId?: RsvpCalendarEventRequestRecurrenceId;- /** The owned connected address whose attendance is changed. Validated by the domain. */+ /** The owned connected address whose attendance is changed. Validated by the domain.+Omit to answer as the inbox the addressed copy syncs through. */respondingEmail?: RsvpCalendarEventRequestRespondingEmail;/** The response to record for the connected account. */response: AttendeeResponseStatus;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/rsvpCalendarEventRequestRespondingEmail.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/rsvpCalendarEventRequestRespondingEmail.tsindex f3c5565aa5..0944f36bc9 100644--- a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/rsvpCalendarEventRequestRespondingEmail.ts+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/rsvpCalendarEventRequestRespondingEmail.ts@@ -7,5 +7,6 @@/*** The owned connected address whose attendance is changed. Validated by the domain.+Omit to answer as the inbox the addressed copy syncs through.*/export type RsvpCalendarEventRequestRespondingEmail = string | null;diff --git a/apps/web/src/lib/service-clients/service-calendar/openapi.json b/apps/web/src/lib/service-clients/service-calendar/openapi.jsonindex ae100ebc0f..e75855d9c9 100644--- a/apps/web/src/lib/service-clients/service-calendar/openapi.json+++ b/apps/web/src/lib/service-clients/service-calendar/openapi.json@@ -1755,7 +1755,7 @@},"respondingEmail": {"type": ["string", "null"],- "description": "The owned connected address whose attendance is changed. Validated by the domain."+ "description": "The owned connected address whose attendance is changed. Validated by the domain.\nOmit to answer as the inbox the addressed copy syncs through."},"response": {"$ref": "#/components/schemas/AttendeeResponseStatus",diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts b/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.tsindex 4e4f16e1e1..edc2edeb11 100644--- a/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts+++ b/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts@@ -14823,7 +14823,7 @@ export interface UpdateBookingSettings {** Passing `attendees` replaces the full attendee list — include everyone who should remain, not just additions. That holds when `viewerCan.removeGuests` from ListCalendarEvents is true (the user organizes the event, or the organizer lets guests modify it). When it is false, the list may only grow: pass the current attendees plus the additions; the additions are invited without touching anyone else, and dropping any guest fails. Adding guests then needs `viewerCan.inviteGuests`; otherwise the organizer doesn't let guests invite others or hides the guest list, or the event is an Outlook meeting the user doesn't organize. An empty string for `description` or `location` clears it. Fails on events from calendars the user cannot edit.*- * `rsvp` sets the user's own response to an invitation and is independent of the field edits — it can be the only thing this call changes. It applies at the same `scope` as the rest of the call, and only works on events the user is actually an attendee of.+ * `rsvp` sets the user's own response to an invitation and is independent of the field edits — it can be the only thing this call changes. It applies at the same `scope` as the rest of the call and answers as the connected inbox the event's copy belongs to, so it only works when that inbox is an attendee.*/export interface UpdateCalendarEvent {/**diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.tsindex 778c2ad7c5..bdabc06c72 100644--- a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts+++ b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts@@ -1882,7 +1882,10 @@ export type RespondToCalendarEventInput = {eventId: string | number;/** Original-start key of the occurrence the response targets. */recurrenceId?: string | null | undefined;- /** The owned connected address whose attendance is changed. */+ /**+ * The owned connected address whose attendance is changed. Omit to+ * answer as the inbox the addressed copy syncs through.+ */respondingEmail?: string | null | undefined;/** The response to record. */response: GraphqlCalendarAttendeeResponseStatus;diff --git a/crates/calendar_events/AGENTS.md b/crates/calendar_events/AGENTS.mdindex 24b0fe891d..64218f3ccf 100644--- a/crates/calendar_events/AGENTS.md+++ b/crates/calendar_events/AGENTS.md@@ -73,13 +73,14 @@ reminder dispatch, team availability, and provider/Postgres persistence.`ActorInboxes::mark_event` and the copy's source link wherever a read pathmarks the viewer, and never store it. Each connected inbox gets its own copy(entity) of an event, written through that inbox's grant, so the viewer- organizes or attends a copy only as its inbox: another of their inboxes on- the same event lends it nothing, and only that inbox's row is `is_self`.- Mutations act as `CalendarEventMutationTarget::copy_inbox`. A delegate owns- no copy inbox and gets nothing beyond the no-attendees rule. `guest_policy` is- stored on the entity row (the canonical copy's values) and in each source's- projection, omitted there while it holds Google's default. Event responses always carry both; `StoredSourceProjection` strips- them so unchanged events keep comparing equal.+ organizes or attends a copy only as its inbox: another of their inboxes on the+ same event lends it nothing, and only that inbox's row is `is_self`. Mutations+ act as `CalendarEventMutationTarget::copy_inbox`, and so does an RSVP without+ a `responding_email`. A delegate owns no copy inbox and gets nothing beyond+ the no-attendees rule. `guest_policy` is stored on the entity row (the+ canonical copy's values) and in each source's projection, omitted there while+ it holds Google's default. Event responses always carry both;+ `StoredSourceProjection` strips them so unchanged events keep comparing equal.- Preserve the conservative OOO refresh hint on write outcomes and sync reports;its contract is in [team sharing](../../docs/design/calendar-team-sharing.md).diff --git a/crates/calendar_events/src/domain/mutations.rs b/crates/calendar_events/src/domain/mutations.rsindex 39370a2ae0..3f1defd94e 100644--- a/crates/calendar_events/src/domain/mutations.rs+++ b/crates/calendar_events/src/domain/mutations.rs@@ -524,14 +524,17 @@ wherelet Some(actor) = target.actor.as_ref() else {return Err(CalendarMutationError::NotAttendee);};- let selected_actor = responding_email- .as_deref()- .map(|email| {+ // Without an address, answer as the copy's own inbox, as the web does by+ // sending the copy's `is_self` row. A delegate owns no copy inbox and+ // keeps answering as their own inboxes.+ let selected_actor = match responding_email.as_deref() {+ Some(email) => Some(actor.select(email)- .ok_or(CalendarMutationError::NotAttendee)- })- .transpose()?;+ .ok_or(CalendarMutationError::NotAttendee)?,+ ),+ None => actor.through(target.email_link_id),+ };let access_token = self.fetch_token(&target.token_identity).await?;let outcome = self.providerdiff --git a/crates/calendar_events/src/domain/mutations/test.rs b/crates/calendar_events/src/domain/mutations/test.rsindex d2acc0fd10..cdd57e1e3c 100644--- a/crates/calendar_events/src/domain/mutations/test.rs+++ b/crates/calendar_events/src/domain/mutations/test.rs@@ -2247,6 +2247,41 @@ async fn rsvp_addresses_the_requester_inbox_not_the_source_calendar() {);}+#[tokio::test]+async fn rsvp_without_an_address_answers_as_the_copys_inbox() {+ let provider = FakeProvider::new(FakeProviderBehavior::Echo);+ let emails = provider.rsvp_self_emails.clone();+ let mut target = mutation_target(false);+ // Another connected inbox of the requester is also on the event.+ target.actor = ActorInboxes::from_owned(vec![+ owned(Uuid::now_v7(), "[email protected]"),+ owned(SELF_LINK, "[email protected]"),+ ]);+ service(+ FakeRepo {+ mutation_target: Some(target),+ ..FakeRepo::default()+ },+ provider,+ FakeTokens::ok(),+ )+ .respond_to_event(+ "macro|user",+ Uuid::now_v7(),+ None,+ AttendeeResponseStatus::Accepted,+ CalendarRsvpScope::All,+ None,+ )+ .await+ .unwrap();++ assert_eq!(+ emails.lock().unwrap().as_slice(),+ [vec!["[email protected]".to_string()]]+ );+}+#[tokio::test]async fn rsvp_through_a_delegated_inbox_never_hands_the_subject_email_to_the_provider() {let provider = FakeProvider::new(FakeProviderBehavior::Echo);diff --git a/crates/calendar_events/src/inbound/mutation_router.rs b/crates/calendar_events/src/inbound/mutation_router.rsindex ae795cfaad..e46ce4b8ca 100644--- a/crates/calendar_events/src/inbound/mutation_router.rs+++ b/crates/calendar_events/src/inbound/mutation_router.rs@@ -283,6 +283,7 @@ pub enum CalendarRsvpScopeParam {#[serde(rename_all = "camelCase")]pub struct RsvpCalendarEventRequest {/// The owned connected address whose attendance is changed. Validated by the domain.+ /// Omit to answer as the inbox the addressed copy syncs through.pub responding_email: Option<String>,/// Calendar whose copy of the event is answered, for an event synced/// from more than one calendar. Omit to answer on the canonical copy.diff --git a/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs b/crates/calendar_events/src/inbound/toolset/update_calendar_event.rsindex 9a9ed82af2..fcb52cd5a0 100644--- a/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs+++ b/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs@@ -109,7 +109,8 @@ the user cannot edit.\n\\n\`rsvp` sets the user's own response to an invitation and is independent of the field \edits — it can be the only thing this call changes. It applies at the same `scope` as \-the rest of the call, and only works on events the user is actually an attendee of."+the rest of the call and answers as the connected inbox the event's copy belongs to, so \+it only works when that inbox is an attendee.")]pub struct UpdateCalendarEvent {/// Event to update.diff --git a/crates/graphql_calendar/src/mutation/inputs.rs b/crates/graphql_calendar/src/mutation/inputs.rsindex 30dc4a22e9..4be9af7cf7 100644--- a/crates/graphql_calendar/src/mutation/inputs.rs+++ b/crates/graphql_calendar/src/mutation/inputs.rs@@ -482,7 +482,8 @@ pub struct RespondToCalendarEventInput {pub scope: Option<GraphqlCalendarRsvpScope>,/// Original-start key of the occurrence the response targets.pub recurrence_id: Option<String>,- /// The owned connected address whose attendance is changed.+ /// The owned connected address whose attendance is changed. Omit to+ /// answer as the inbox the addressed copy syncs through.pub responding_email: Option<String>,}diff --git a/packages/sdk-docs/reference/generated/calendar/types.gen/type-aliases/RsvpCalendarEventRequest.md b/packages/sdk-docs/reference/generated/calendar/types.gen/type-aliases/RsvpCalendarEventRequest.mdindex 951057a1c4..daf8a64937 100644--- a/packages/sdk-docs/reference/generated/calendar/types.gen/type-aliases/RsvpCalendarEventRequest.md+++ b/packages/sdk-docs/reference/generated/calendar/types.gen/type-aliases/RsvpCalendarEventRequest.md@@ -10,6 +10,6 @@ Request body setting the requester's RSVP on an event.| ------ | ------ | ------ || <a id="property-calendarid"></a> `calendarId?` | `string` \| `null` | Calendar whose copy of the event is answered, for an event synced from more than one calendar. Omit to answer on the canonical copy. || <a id="property-recurrenceid"></a> `recurrenceId?` | `string` \| `null` | Original-start key of the occurrence the response targets. |-| <a id="property-respondingemail"></a> `respondingEmail?` | `string` \| `null` | The owned connected address whose attendance is changed. Validated by the domain. |+| <a id="property-respondingemail"></a> `respondingEmail?` | `string` \| `null` | The owned connected address whose attendance is changed. Validated by the domain. Omit to answer as the inbox the addressed copy syncs through. || <a id="property-response"></a> `response` | [`AttendeeResponseStatus`](AttendeeResponseStatus.md) | The response to record for the connected account. || <a id="property-scope"></a> `scope?` | `null` \| [`CalendarRsvpScopeParam`](CalendarRsvpScopeParam.md) | - |diff --git a/packages/sdk/generated/calendar/types.gen.ts b/packages/sdk/generated/calendar/types.gen.tsindex f84f7c1fdb..aaa0ea0c59 100644--- a/packages/sdk/generated/calendar/types.gen.ts+++ b/packages/sdk/generated/calendar/types.gen.ts@@ -727,6 +727,7 @@ export type RsvpCalendarEventRequest = {recurrenceId?: string | null;/*** The owned connected address whose attendance is changed. Validated by the domain.+ * Omit to answer as the inbox the addressed copy syncs through.*/respondingEmail?: string | null;/**diff --git a/packages/sdk/specs/calendar.json b/packages/sdk/specs/calendar.jsonindex ae100ebc0f..e75855d9c9 100644--- a/packages/sdk/specs/calendar.json+++ b/packages/sdk/specs/calendar.json@@ -1755,7 +1755,7 @@},"respondingEmail": {"type": ["string", "null"],- "description": "The owned connected address whose attendance is changed. Validated by the domain."+ "description": "The owned connected address whose attendance is changed. Validated by the domain.\nOmit to answer as the inbox the addressed copy syncs through."},"response": {"$ref": "#/components/schemas/AttendeeResponseStatus",diff --git a/static_assets/schema.graphql b/static_assets/schema.graphqlindex 2390c8d466..f0950cbfc4 100644--- a/static_assets/schema.graphql+++ b/static_assets/schema.graphql@@ -9719,7 +9719,8 @@ input RespondToCalendarEventInput {"""recurrenceId: String"""- The owned connected address whose attendance is changed.+ The owned connected address whose attendance is changed. Omit to+ answer as the inbox the addressed copy syncs through."""respondingEmail: String}