Skip to content

Commit 8c16c36

Browse files
authored
Disable device sync (#1628)
* Enable sync in agent start * Update @xmtp/cli version * "Disable device sync in agents" * Add appVersion and disableSync * Update appVersion handling
1 parent a245ffe commit 8c16c36

File tree

9 files changed

+26
-0
lines changed

9 files changed

+26
-0
lines changed

agents/bots/csx/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const agent = await Agent.createFromEnv({
3232
(process.env.RAILWAY_VOLUME_MOUNT_PATH ?? ".") +
3333
`/${process.env.XMTP_ENV}-csx-${inboxId.slice(0, 8)}.db3`,
3434
appVersion: APP_VERSION,
35+
disableDeviceSync: true,
3536
});
3637

3738
// Handle uncaught errors

agents/bots/echo/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ if (process.env.NODE_ENV !== "production") process.loadEnvFile(".env");
66

77
const agent = await Agent.createFromEnv({
88
appVersion: APP_VERSION,
9+
disableDeviceSync: true,
910
});
1011

1112
let count = 0;

agents/bots/gang/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const agent = await Agent.createFromEnv({
2727
(process.env.RAILWAY_VOLUME_MOUNT_PATH ?? ".") +
2828
`/${process.env.XMTP_ENV}-gang-${inboxId.slice(0, 8)}.db3`,
2929
appVersion: APP_VERSION,
30+
disableDeviceSync: true,
3031
});
3132

3233
// Handle uncaught errors

cli/gen.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ const MAX_RETRIES = 3;
2525
interface InboxData {
2626
accountAddress: string;
2727
walletKey: string;
28+
appVersion: string;
29+
disableDeviceSync: boolean;
30+
2831
dbEncryptionKey: string;
2932
inboxId: string;
3033
installations: number;
@@ -318,6 +321,7 @@ async function smartUpdate({
318321
dbEncryptionKey,
319322
dbPath: `${LOGPATH}/${env}-${inbox.accountAddress}-install-0`,
320323
appVersion: APP_VERSION,
324+
disableDeviceSync: true,
321325
env,
322326
});
323327
const { currentInstallations } = await checkInstallations(
@@ -336,6 +340,7 @@ async function smartUpdate({
336340
dbPath: `${LOGPATH}/${env}-${inbox.accountAddress}-install-${j}`,
337341
env,
338342
appVersion: APP_VERSION,
343+
disableDeviceSync: true,
339344
});
340345
if (debugMode) {
341346
process.stdout.write(
@@ -358,6 +363,7 @@ async function smartUpdate({
358363
dbPath: `${LOGPATH}/${env}-${inbox.accountAddress}-install-${j}`,
359364
env,
360365
appVersion: APP_VERSION,
366+
disableDeviceSync: true,
361367
});
362368
if (debugMode) {
363369
process.stdout.write(
@@ -404,6 +410,7 @@ async function smartUpdate({
404410
dbPath: `${LOGPATH}/${env}-${accountAddress}-install-${j}`,
405411
env,
406412
appVersion: APP_VERSION,
413+
disableDeviceSync: true,
407414
});
408415
if (j === 0 && env === envs[0]) inboxId = client.inboxId;
409416
totalCreated++;
@@ -420,6 +427,8 @@ async function smartUpdate({
420427
dbEncryptionKey,
421428
inboxId,
422429
installations: installationCount,
430+
appVersion: APP_VERSION,
431+
disableDeviceSync: true,
423432
});
424433
consecutiveFailures = 0;
425434
writeJson(targetFilePath, existingInboxes);

copilot/.claude/docs/build-agents/create-a-client.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const dbEncryptionKey = fromString(encryptionKey, "hex");
2020

2121
const agent = await Agent.create(signer, {
2222
env: "dev", // or 'production'
23+
disableDeviceSync: true,
24+
appVersion: "agent-name/1.0.0",
2325
dbEncryptionKey: dbEncryptionKey, // save it for later
2426
});
2527
```
@@ -96,6 +98,10 @@ env?: 'local' | 'dev' | 'production';
9698
* deprecations and required upgrades.
9799
*/
98100
appVersion?: string;
101+
/**
102+
* Disable device sync.
103+
*/
104+
disableDeviceSync?: boolean;
99105
/**
100106
* apiUrl can be used to override the `env` flag and connect to a
101107
* specific endpoint

helpers/versions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ export const regressionClient = async (
202202
loggingLevel,
203203
apiUrl,
204204
appVersion: APP_VERSION,
205+
disableDeviceSync: true,
205206
codecs: [new ReactionCodec(), new ReplyCodec()],
206207
});
207208
} catch (error) {
@@ -229,6 +230,7 @@ export const regressionClient = async (
229230
loggingLevel,
230231
apiUrl,
231232
appVersion: APP_VERSION,
233+
disableDeviceSync: true,
232234
codecs: [new ReactionCodec(), new ReplyCodec()],
233235
});
234236
} else {

inboxes/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const signer = createSigner(testInbox.walletKey);
3131
const client = await Client.create(signer, {
3232
dbEncryptionKey: getEncryptionKeyFromHex(testInbox.dbEncryptionKey),
3333
env: "dev",
34+
disableDeviceSync: true,
35+
appVersion: "agent-name/1.0.0",
3436
});
3537
```
3638

inboxes/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export interface InboxData {
1111
accountAddress: string;
1212
walletKey: string;
1313
dbEncryptionKey: string;
14+
disableDeviceSync: boolean;
15+
appVersion: string;
1416
inboxId: string;
1517
installations: number;
1618
}

measurements/concurrency.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ describe(testName, () => {
4141
primaryClient = await Client.create(primarySigner, {
4242
dbEncryptionKey: primaryEncryptionKey,
4343
env: env.XMTP_ENV as XmtpEnv,
44+
disableDeviceSync: true,
4445
appVersion: APP_VERSION,
4546
});
4647

@@ -51,6 +52,7 @@ describe(testName, () => {
5152
secondaryClient = await Client.create(secondarySigner, {
5253
dbEncryptionKey: secondaryEncryptionKey,
5354
env: env.XMTP_ENV as XmtpEnv,
55+
disableDeviceSync: true,
5456
appVersion: APP_VERSION,
5557
});
5658

0 commit comments

Comments
 (0)