Skip to content

feat(conversations)!: Archive conversations for everyone - #2900

Merged
dcramer merged 4 commits into
mainfrom
feat/shared-archive
Nov 7, 2026
Merged

dcramer merged 4 commits into
mainfrom
feat/shared-archive

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Part of #2792. Archive now applies to everyone in a Conversation, for roots and children alike.

Model

  • One junior_conversations.archived_at holds the archive for every Conversation. Nothing reads or writes the per-person junior_conversation_participants.archived_at anymore.
  • Pins stay per person. Pinning restores the shared archive. Archiving no longer unpins anyone.
  • A person's Message restores the Conversation for everyone.
  • applyToChildren follows the same refuse-and-cascade rules on a root as on a child.
  • Auto-archive runs for any opted-in participant, but the root is kept when any participant pinned it, turned auto-archive off for it (a manual restore does this), or has an open action Review item on it (noParticipantKeepsRoot, notWaitingOnAnyone / reviewItemNeedsSomeone).

Migration 0086

  • Backfills archived_at on a root only when every member had archived it. The root's actor counts as a member who has not archived when it has no participant row.
  • Keeps child_archived_at (schema legacyChildArchivedAt), so code from the previous release keeps working during the deploy. A later migration drops it, together with the participant archived_at.

Copy

  • MCP tools (archive-done-conversations, search-conversations, set-conversation-auto-archive), AutoArchiveToggle, AutoArchiveSettings and docs/mcp-server.md now say archive applies to everyone.
  • detail-etag.ts no longer hashes the participant archive. Archive writes bump the Conversation's detail_version.

Known items, not in this PR

  • A root archive in the dashboard has no "for everyone" confirm. Children already have one.
  • MCP archiveConversation on a root with unarchived children returns 409 unless applyToChildren is passed.
  • The auto-archive index is rebuilt without CONCURRENTLY.
  • pin.ts clears the archive and upserts the pin in two writes, with no transaction.

Checks

  • typecheck and lint pass. 1644 junior unit and 400 dashboard unit tests pass. db:generate shows no drift. Dashboard e2e passed on 26eefaf.
  • The Postgres integration tests, including auto-archive.test.ts, run in CI.

via @dcramer.

--

View Session [Sentry]

sentry-junior Bot and others added 3 commits November 7, 2026 18:56
Every archive now lives on junior_conversations.archived_at and applies to
every participant, root or child. applyToChildren follows the same refusal,
cascade and restore rules on a root. Pins stay per person; pinning restores
the archive and archiving no longer unpins. Auto-archive archives a root once
any opted-in participant is idle past their grace time.

Migration 0086 backfills a root only when every participant archived it,
copies child_archived_at, and drops it.
Archive now lives on junior_conversations and bumps detail_version, so the
versions hash no longer reads it from the participant row.

Co-Authored-By: David Cramer <[email protected]>
…hoices

Archive is shared, so a run must respect every participant: a pin, auto-archive
turned off, or a Review item that waits on any person keeps the root. The 0086
backfill no longer archives a root whose actor has no participant row, and it
keeps child_archived_at so the release before still reads it during rollout.
Archive copy for tools and the dashboard now says it applies to everyone.
@vercel

vercel Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 7, 2026 7:33pm UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 7, 2026

@dcramer dcramer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a big behavior change but tbqh its probably the right future looking direction

we just need archived to be a meaningful thing

@dcramer dcramer changed the title feat(conversations): Archive conversations for everyone feat(conversations)!: Archive conversations for everyone Nov 7, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a1c7c16. Configure here.

…estores

A root actor may have no participant row, so the update did nothing and
another member's auto-archive could archive the root again.
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

14 screenshot changes — 14 changed · 0 added · 0 removed

Review screenshots in Frameshift

Conversation Attachment · Desktop
Conversation Attachment · Desktop
Changed
Conversation Captured Memories Popover · Desktop
Conversation Captured Memories Popover · Desktop
Changed
Conversation Captured Memories Popover · Mobile
Conversation Captured Memories Popover · Mobile
Changed
Conversation Details Watched Linked Work · Desktop
Conversation Details Watched Linked Work · Desktop
Changed
Conversation Details Watched Linked Work · Mobile
Conversation Details Watched Linked Work · Mobile
Changed
Conversation Event Log Virtual · Desktop
Conversation Event Log Virtual · Desktop
Changed
Show 8 more changed screenshots
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Conversation Recalled Memories Popover · Desktop
Conversation Recalled Memories Popover · Desktop
Changed
Conversation Recalled Memories Popover · Mobile
Conversation Recalled Memories Popover · Mobile
Changed
Settings · Desktop
Settings · Desktop
Changed
Settings Auto Archive · Desktop
Settings Auto Archive · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed
Settings Notifications · Desktop
Settings Notifications · Desktop
Changed
Settings Notifications · Mobile
Settings Notifications · Mobile
Changed

@dcramer
dcramer merged commit a09fcd8 into main Nov 7, 2026
45 checks passed
@dcramer
dcramer deleted the feat/shared-archive branch November 7, 2026 19:44
sentry-junior Bot added a commit that referenced this pull request Nov 7, 2026
Resolve conflicts with the shared archive (#2900) and agent tree kinds.
Renumber the child spawn migration to 0087 and regenerate its snapshot.
Keep `kind` in the lineage entry for the agent tree, and drop its
Location and visibility: child Runs read the copy bound at spawn.

Drop the supersede refactor (supersede-turns.ts) and its tests. The
bind-at-spawn design does not need it.
dcramer added a commit that referenced this pull request Nov 9, 2026
#2939)

Archive is shared now (#2900), so one person cannot drop a conversation
that someone else still works in. This adds a per-person unsubscribe for
that case.

**Contract**
The Given/When/Then contract is at the top of
`packages/junior/src/api/conversations/subscription.ts`. The feed
filter, Turn input membership, auto-archive, and each entry point point
to it. Each scenario has one test in
`tests/integration/api/conversations/subscription.test.ts`:
- Unsubscribing removes it from only your feed, and you keep access
(open, search, archived list).
- It stays out of your feed until you address Junior again (Slack
mention or DM, or a dashboard Message). A passive Slack reply, or other
people working, does not bring it back.
- Pin and Subscribe also bring it back. Unsubscribe drops your pin.
- The last subscriber leaving archives it for everyone. The person who
started it counts as subscribed before they post.
- Whoever restores an archived conversation (a Message or Unarchive) is
subscribed again, so a restored conversation is never in no feed.
- The agent tool changes only the person who started the Turn. Nobody
can subscribe or unsubscribe another person.

The tests use only the public API, the agent tool, and stored Slack
Turns. They write no participant rows by hand, so a storage change does
not need a test change. Each rule fails its test when I break it on
purpose.

**Entry points**
- Dashboard: **Unsubscribe** / **Subscribe** in the conversation `⋯`
menu.
- Agent tool `setConversationSubscription` (deferred, source
`conversation-subscription`). It takes only `subscribed`. The person is
the Turn actor and the target is the current Conversation, so the model
cannot name someone else. Child agents do not get it.
- MCP tool `setConversationSubscription` under `conversations:manage`,
for the signed-in user.
- HTTP: `PATCH /api/conversations/:id/subscription` with `{ subscribed
}`. A child id resolves to its root.

**Implementation**
- Migration 0088 adds
`junior_conversation_participants.unsubscribed_at`. The row stays, so
access does not change.
- The re-subscribe happens when a Turn starts from the person's Message
and `meta.explicitMention !== false`, or when their Message or Unarchive
restores an archived root.
- Unsubscribe and pin lock the root with `FOR NO KEY UPDATE`, so they
run one at a time with each other, archives, and Turns in the root, but
never block a Turn in a child that adds a participant or child row. The
last-subscriber archive is one update over the tree that waits for
in-flight child Turns; it then checks subscribers again and undoes the
archive if such a Turn subscribed someone.
- Auto-archive ignores unsubscribed participants.
- Detail returns `subscribed` for participants, and the detail ETag
hashes it.

**Not in this PR**
- No Slack slash command or undo toast.

**Checks**
- typecheck and `pnpm lint` pass. Throwaway stress tests ran pin,
mention, a second unsubscribe, and a new person's mention in a child
thread concurrently with the last unsubscribe. All passed with no
deadlocks; the child-thread case deadlocked 23 of 25 times before this
lock change. Dashboard unit tests pass. The subscription, MCP route, and
MCP tool suites pass, as do the archive, auto-archive, list, and
conversation storage suites.

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0B595QDZLL%3A1794165313.465219 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0B595QDZLL%3A1794165313.465219)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0B595QDZLL%3A1794165313.465219/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <[email protected]>
Co-authored-by: David Cramer <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — fea1deb1 Deployed Nov 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant