Skip to content

Commit d98ed47

Browse files
rajbosCopilot
andcommitted
fix: raise token limit to 2B and surface server validation errors
- Raise MAX_TOKEN_VALUE from 100M to 2B per entry. Large Copilot CLI agent sessions can easily exceed 100M tokens in a single day/model/workspace combination. Entries exceeding the old limit were silently rejected, causing ~40% of data to be dropped. - Make SharingServerUploadService read the actual server-side 'uploaded' count from the response body instead of assuming all sent entries were accepted. Logs a warning when the server rejects entries (validation errors), making silent data loss visible. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 64b9448 commit d98ed47

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

sharing-server/src/routes/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const MAX_STRING_LENGTHS = {
1111
datasetId: 128,
1212
editor: 100,
1313
};
14-
const MAX_TOKEN_VALUE = 100_000_000; // 100M tokens per entry is already absurd
14+
const MAX_TOKEN_VALUE = 2_000_000_000; // 2B tokens — large agent sessions can exceed 100M in one day
1515
const MAX_ENTRIES_PER_UPLOAD = 500;
1616

1717
export const api = new Hono<{ Variables: AuthVariables }>();

vscode-extension/src/backend/services/sharingServerUploadService.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,17 @@ export class SharingServerUploadService {
5050
warn(`Sharing server upload: ${message}`);
5151
return { success: false, entriesUploaded: totalUploaded, message };
5252
}
53-
totalUploaded += batch.length;
53+
54+
// Read actual uploaded count — server may reject entries that fail validation
55+
let serverUploaded = batch.length;
56+
try {
57+
const result = await response.json() as { uploaded?: number; errors?: string[] };
58+
if (typeof result.uploaded === 'number') { serverUploaded = result.uploaded; }
59+
if (result.errors && result.errors.length > 0) {
60+
warn(`Sharing server upload: server rejected ${batch.length - serverUploaded} entries: ${result.errors.slice(0, 3).join('; ')}`);
61+
}
62+
} catch { /* response not JSON, use batch.length */ }
63+
totalUploaded += serverUploaded;
5464
}
5565

5666
const message = `Uploaded ${totalUploaded} entries`;

0 commit comments

Comments
 (0)