Sitesmith: RESPONSE_TOO_LONG status gets its own message

The backend now ends a job with RESPONSE_TOO_LONG when the model answer is
cut off at the output cap twice. Without the status in the union it fell
back to the generic ERROR text; now it says nothing was changed and to ask
for one page or section at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-11-01 15:31:34 -08:00
1 parent 542f5efc78
commit 99d5855f6a
3 files changed
+14 -3

No files matched your search

@@ -1,5 +1,5 @@
import { describe, test, expect } from 'vitest';
import { SITESMITH_CLIENT_STATUSES, SITESMITH_SERVER_STATUSES, type SitesmithStatus } from '../../types/sitesmith';
import { SITESMITH_CLIENT_STATUSES, SITESMITH_SERVER_STATUSES, isSitesmithStatus, type SitesmithStatus } from '../../types/sitesmith';
import { failureMessage, STATUS_MESSAGES } from './statusMessages';
const FAILURES: SitesmithStatus[] = [...SITESMITH_SERVER_STATUSES, ...SITESMITH_CLIENT_STATUSES].filter((s) => s !== 'OK_BONUS' && s !== 'OK_MONTHLY');
@@ -27,6 +27,15 @@ describe('Sitesmith failure messages (G6)', () => {
expect(failureMessage({ ok: false, status: 'AI_INVALID', message: '' })).toMatch(/could not use/i);
});
test('RESPONSE_TOO_LONG is a known server status with its own advice (not the generic ERROR)', () => {
expect(isSitesmithStatus('RESPONSE_TOO_LONG')).toBe(true);
const m = failureMessage({ ok: false, status: 'RESPONSE_TOO_LONG', message: 'That answer was too long for Sitesmith to finish in one go, so nothing was changed. Try asking for less at once -- for example one page, or one section, at a time.' });
expect(m).toBe(STATUS_MESSAGES.RESPONSE_TOO_LONG.text);
expect(m).not.toBe(STATUS_MESSAGES.ERROR.text);
expect(m).toMatch(/nothing was changed/);
expect(m).toMatch(/one page or one section at a time/);
});
test('statuses whose server text carries the detail keep it; fixed-meaning statuses use the specific text', () => {
expect(failureMessage({ ok: false, status: 'BAD_ATTACHMENT', message: 'Self-review needs an AI model that can see images.' }))
.toBe('Self-review needs an AI model that can see images.');
@@ -25,6 +25,8 @@ export const STATUS_MESSAGES: Record<SitesmithStatus, { text: string; preferServ
JOB_IN_PROGRESS: { text: 'Sitesmith is still working on your previous request for this site. Wait for it to finish, or reopen Sitesmith to follow it.' },
TOO_MANY_JOBS: { text: 'Sitesmith is already working on your other requests. Wait for one of them to finish, then try again.' },
SERVER_BUSY: { text: 'Sitesmith is busy on this server right now. Please try again in a minute.' },
// The answer was cut off twice at the output cap; nothing was applied. Asking for less at once is the fix.
RESPONSE_TOO_LONG: { text: 'That answer was too long for Sitesmith to finish in one go, so nothing was changed. Ask for less at once, for example one page or one section at a time.' },
NETWORK: { text: MSG_NETWORK },
TIMEOUT: { text: MSG_TIMEOUT },
ABORTED: { text: 'Stopped waiting for Sitesmith. It may still finish in the background; reopen Sitesmith to see the result.' },
+2 -2
View File
@@ -7,7 +7,7 @@ export type SitesmithServerStatus =
| 'USER_KILLSWITCH' | 'SERVER_KILLSWITCH'
| 'RATE_LIMITED' | 'BLOCKED' | 'AI_ERROR' | 'AI_INVALID'
| 'BAD_ATTACHMENT' | 'IMAGES_BUSY' | 'INTERRUPTED' | 'CANCELLED'
| 'JOB_IN_PROGRESS' | 'TOO_MANY_JOBS' | 'SERVER_BUSY';
| 'JOB_IN_PROGRESS' | 'TOO_MANY_JOBS' | 'SERVER_BUSY' | 'RESPONSE_TOO_LONG';
/** Statuses the editor's transport (hooks/useSitesmith.ts) produces itself. */
export type SitesmithClientStatus =
@@ -19,7 +19,7 @@ export type SitesmithStatus = SitesmithServerStatus | SitesmithClientStatus;
export const SITESMITH_SERVER_STATUSES: readonly SitesmithServerStatus[] = [
'OK_BONUS', 'OK_MONTHLY', 'DISABLED', 'CAP_REACHED', 'USER_KILLSWITCH', 'SERVER_KILLSWITCH',
'RATE_LIMITED', 'BLOCKED', 'AI_ERROR', 'AI_INVALID', 'BAD_ATTACHMENT', 'IMAGES_BUSY', 'INTERRUPTED',
'CANCELLED', 'JOB_IN_PROGRESS', 'TOO_MANY_JOBS', 'SERVER_BUSY',
'CANCELLED', 'JOB_IN_PROGRESS', 'TOO_MANY_JOBS', 'SERVER_BUSY', 'RESPONSE_TOO_LONG',
];
export const SITESMITH_CLIENT_STATUSES: readonly SitesmithClientStatus[] = [
'NETWORK', 'TIMEOUT', 'ABORTED', 'LOST_CONNECTION', 'AUTH_REQUIRED', 'FORBIDDEN', 'TOO_LARGE',