Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/main/integration-mounts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describe('IntegrationMountManager', () => {
])
})

it('mounts canonical Slack command roots exactly once in write-only mode', async () => {
it('mounts Slack channel message roots in mirror mode (read-down + writeback)', async () => {
const manager = new IntegrationMountManager()

await manager.ensureMounted([
Expand All @@ -236,7 +236,10 @@ describe('IntegrationMountManager', () => {
localDir: '/tmp/pear-home/.agentworkforce/pear/relayfile/workspaces/account-workspace-id/slack/channels/C123/messages',
remotePath: '/slack/channels/C123/messages',
localLayout: 'exact',
syncMode: 'write-only',
// Dual-purpose root: reads inbound top-level messages down AND accepts
// send-writebacks. Mirror is a superset of write-only, so it does both;
// write-only disabled inbound read-down entirely.
syncMode: 'mirror',
scopes: ['relayfile:fs:read:/slack/channels/C123/messages/**', 'relayfile:fs:write:/slack/channels/C123/messages/**']
})
expect(mock.mountInputs[0]?.localDir).not.toContain('messages/slack/channels/C123/messages')
Expand All @@ -253,13 +256,13 @@ describe('IntegrationMountManager', () => {
expect(mock.startMount).toHaveBeenCalledWith(expect.objectContaining({
env: expect.objectContaining({
RELAYFILE_MOUNT_LOCAL_LAYOUT: 'exact',
RELAYFILE_MOUNT_SYNC_MODE: 'write-only',
RELAYFILE_MOUNT_SYNC_MODE: 'mirror',
RELAYFILE_MOUNT_TIMEOUT: '180s'
})
}))
})

it('uses the shared Slack command-root grammar for write-only mode', async () => {
it('mounts Slack user DM roots in mirror mode so inbound DMs read down', async () => {
const manager = new IntegrationMountManager()

await manager.ensureMounted([
Expand All @@ -273,7 +276,7 @@ describe('IntegrationMountManager', () => {
localDir: '/tmp/pear-home/.agentworkforce/pear/relayfile/workspaces/account-workspace-id/slack/users/U123/messages',
remotePath: '/slack/users/U123/messages',
localLayout: 'exact',
syncMode: 'write-only'
syncMode: 'mirror'
})
})

Expand Down
14 changes: 12 additions & 2 deletions src/main/integration-mounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from '@relayfile/sdk'
import { accountWorkspaceReadyRetryOptions, getAccountWorkspaceId, refreshCloudAuth, resolveCloudAuth } from './auth'
import { createPearMountLauncher } from './relayfile-mount-launcher'
import { isSlackWritebackCommandRoot } from './slack-writeback-command-roots'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

With the removal of isSlackWritebackCommandRoot from this file, the entire module src/main/slack-writeback-command-roots.ts appears to be unused and can be safely deleted to clean up dead code.


const MOUNT_READY_TIMEOUT_MS = 60_000
const MOUNT_SYNC_TIMEOUT = '180s'
Expand Down Expand Up @@ -519,7 +518,18 @@ export class IntegrationMountManager {
remotePath: mountPath,
localDir: join(mountRoot, ...remotePathSegments(mountPath)),
localLayout: 'exact',
syncMode: isSlackWritebackCommandRoot(mountPath) ? 'write-only' : 'mirror',
// Slack message/DM roots (`/slack/channels/<id>/messages`,
// `/slack/users/<U>/messages`) are DUAL-PURPOSE: they are writeback
// command roots AND the inbound read-down surface for top-level messages
// and DMs. Mounting them `write-only` pushed our send-writeback command
// files up but did ZERO remote->local pulls, so inbound never
// materialized (the DM/top-level read-down gap; only `threads`, which is
// mirror, read down). `mirror` is a strict superset of `write-only` — the
// local push/dispatch path is identical, it only ADDS the inbound pull —
// so use it for every Slack mount: inbound reads down AND send-writebacks
// still dispatch. (Durable cloud path-correctness for channel messages
// ships in cloud#2010; DMs use the cloud#1997 D->U mapping.)
syncMode: 'mirror',
agentName: `pear-integrations-${agentSegment}`,
scopes: [
`relayfile:fs:read:${mountPath}/**`,
Expand Down
Loading