Skip to content
Open
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
22 changes: 22 additions & 0 deletions src/mount/relayfile-integration-preflight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,26 @@ describe('Relayfile integration preflight', () => {
expect(terminal.confirm).not.toHaveBeenCalled()
expect(relayfile.connect).not.toHaveBeenCalled()
})

it('directs completed-but-degraded integrations to an authorized repair instead of waiting', async () => {
const relayfile = connections(async () => ({
ready: false,
state: 'degraded',
initialSyncState: 'complete',
}))
const terminal = io()

await expect(ensureFactoryIntegrations({
connections: relayfile,
providers: ['github'],
workspaceId: 'rw_test',
interactive: false,
dryRun: true,
io: terminal,
})).rejects.toThrow(
/degraded after its initial sync completed \(degraded, complete\).*workspace owner.*repair or reconnect github/u,
)
expect(relayfile.connect).not.toHaveBeenCalled()
expect(relayfile.waitForConnection).not.toHaveBeenCalled()
})
})
7 changes: 7 additions & 0 deletions src/mount/relayfile-integration-preflight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ const notReadyMessage = (
const details = [observation.state, observation.initialSyncState]
.filter((value): value is string => Boolean(value))
.join(', ')
const state = observation.state?.trim().toLowerCase()
const initialSyncState = observation.initialSyncState?.trim().toLowerCase()
if (state === 'degraded' && initialSyncState === 'complete') {
return `[factory] ${provider} is connected but degraded after its initial sync completed` +
`${details ? ` (${details})` : ''}; ask an Agent Relay workspace owner to repair or reconnect ` +
`${provider}, then retry.`
}
return `[factory] ${provider} is connected but not ready${details ? ` (${details})` : ''}; wait for its initial sync, then retry.`
}

Expand Down