mirror of
https://github.com/thedotmack/claude-mem.git
synced 2026-09-20 04:23:02 +08:00
ba889fc39b
claude-sonnet-4-6 and claude-opus-4-7 are no longer valid Anthropic
model ids and are now rejected outright by the Messages API
("Unsupported model"), silently zeroing out observation generation
for anyone on these defaults. Bumps every hardcoded reference
(ClaudeObservationProvider's DEFAULT_SERVER_CLAUDE_MODEL, the viewer's
DEFAULT_SETTINGS, the installer's allowed-model list and interactive
prompt, the openclaw installer + its test, public docs, and the
existing server-runtime-guard test) to claude-sonnet-5 / claude-opus-4-8.
Same class of staleness as #1390/#1550, just the next model cycle.
Note: src/shared/SettingsDefaultsManager.ts's CLAUDE_MEM_MODEL default
already differs from the above (claude-haiku-4-5-20251001, set in
#2255) and is left untouched here since Haiku 4.5 is still a valid,
working model — not the bug this PR fixes. Flagging it since it's an
existing inconsistency with the other three "default" declarations
this PR does update.
59 lines
2.1 KiB
TypeScript
59 lines
2.1 KiB
TypeScript
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
// #2572 — wrong-runtime guard for the server operability CLI.
|
|
// #2554 — stale DEFAULT_MODEL fix.
|
|
|
|
import { describe, expect, it } from 'bun:test';
|
|
import { assertServerRuntimeForCli } from '../../src/server/runtime/ServerService.js';
|
|
import { DEFAULT_SERVER_CLAUDE_MODEL } from '../../src/server/generation/providers/ClaudeObservationProvider.js';
|
|
|
|
describe('assertServerRuntimeForCli — wrong-runtime guard (#2572)', () => {
|
|
it('passes for canonical server runtime with a database URL', () => {
|
|
expect(() =>
|
|
assertServerRuntimeForCli('keys', {
|
|
CLAUDE_MEM_RUNTIME: 'server',
|
|
CLAUDE_MEM_SERVER_DATABASE_URL: 'postgres://localhost/db',
|
|
}),
|
|
).not.toThrow();
|
|
});
|
|
|
|
it('passes for legacy server-beta runtime literal (Phase 1d back-compat)', () => {
|
|
expect(() =>
|
|
assertServerRuntimeForCli('keys', {
|
|
CLAUDE_MEM_RUNTIME: 'server-beta',
|
|
CLAUDE_MEM_SERVER_DATABASE_URL: 'postgres://localhost/db',
|
|
}),
|
|
).not.toThrow();
|
|
});
|
|
|
|
it('passes when runtime is unset but a database URL is present (bare server image)', () => {
|
|
expect(() =>
|
|
assertServerRuntimeForCli('jobs', {
|
|
CLAUDE_MEM_SERVER_DATABASE_URL: 'postgres://localhost/db',
|
|
}),
|
|
).not.toThrow();
|
|
});
|
|
|
|
it('fails CLEARLY when run in a worker-only runtime context', () => {
|
|
expect(() =>
|
|
assertServerRuntimeForCli('keys', {
|
|
CLAUDE_MEM_RUNTIME: 'worker',
|
|
CLAUDE_MEM_SERVER_DATABASE_URL: 'postgres://localhost/db',
|
|
}),
|
|
).toThrow(/server runtime command.*CLAUDE_MEM_RUNTIME=worker/s);
|
|
});
|
|
|
|
it('fails CLEARLY (actionable) when no database URL is configured', () => {
|
|
expect(() =>
|
|
assertServerRuntimeForCli('jobs', { CLAUDE_MEM_RUNTIME: 'server' }),
|
|
).toThrow(/CLAUDE_MEM_SERVER_DATABASE_URL is required/);
|
|
});
|
|
});
|
|
|
|
describe('Claude provider default model (#2554)', () => {
|
|
it('uses a current, valid model id (not the stale claude-3-5-sonnet-latest)', () => {
|
|
expect(DEFAULT_SERVER_CLAUDE_MODEL).toBe('claude-sonnet-5');
|
|
expect(DEFAULT_SERVER_CLAUDE_MODEL).not.toBe('claude-3-5-sonnet-latest');
|
|
});
|
|
});
|