Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(ai): swap Opus 4.8 for Opus 5 in the chat model selector (#5181)

Eric Hayesaf8d674328e8
diff --git a/apps/web/src/lib/core/component/AI/component/debug/Component.tsx b/apps/web/src/lib/core/component/AI/component/debug/Component.tsx
index 8014b008b9..1831a2c037 100644
--- a/apps/web/src/lib/core/component/AI/component/debug/Component.tsx
+++ b/apps/web/src/lib/core/component/AI/component/debug/Component.tsx
@@ -486,7 +486,7 @@ function ProviderFailureChat() {
return (
<ProviderFailureDemo
label="Provider failure - switch-model fallback"
- initialModel={Model.opus48}
+ initialModel={Model.opus5}
availableModels={GALLERY_MODELS}
/>
);
diff --git a/apps/web/src/lib/core/component/AI/component/input/ModelSelector.test.tsx b/apps/web/src/lib/core/component/AI/component/input/ModelSelector.test.tsx
index 736694e8d0..33e9c019a7 100644
--- a/apps/web/src/lib/core/component/AI/component/input/ModelSelector.test.tsx
+++ b/apps/web/src/lib/core/component/AI/component/input/ModelSelector.test.tsx
@@ -89,7 +89,7 @@ describe('ModelSelector: availability', () => {
expect(available.className).not.toContain('opacity-50');
expect(available.querySelector('[data-testid="lock-icon"]')).toBeNull();
- const locked = itemFor(container, Model.opus48);
+ const locked = itemFor(container, Model.opus5);
expect(locked.className).toContain('opacity-50');
expect(locked.querySelector('[data-testid="lock-icon"]')).not.toBeNull();
});
@@ -123,8 +123,8 @@ describe('ModelSelector: selection routing', () => {
<ModelSelector models={options} onSelect={onSelect} onLocked={onLocked} />
));
- fireEvent.click(itemFor(container, Model.opus48)); // locked for a free user
- expect(onLocked).toHaveBeenCalledWith(Model.opus48);
+ fireEvent.click(itemFor(container, Model.opus5)); // locked for a free user
+ expect(onLocked).toHaveBeenCalledWith(Model.opus5);
expect(onSelect).not.toHaveBeenCalled();
});
});
@@ -134,7 +134,7 @@ describe('ModelSelector: what is shown is what is sent', () => {
// model accessor. Picking a model updates that single source, so the request
// can never diverge from what the selector displays.
function Harness() {
- const [model, setModel] = createSignal<TModel>(Model.opus48);
+ const [model, setModel] = createSignal<TModel>(Model.opus5);
return (
<>
{/* stand-in for the value sendMessage() reads */}
@@ -153,8 +153,8 @@ describe('ModelSelector: what is shown is what is sent', () => {
// Initial state: trigger shows the selected model.
const trigger = container.querySelector('[data-trigger]')!;
- expect(trigger.textContent).toContain(MODEL_PRETTYNAME[Model.opus48]);
- expect(getByTestId('would-send').textContent).toBe(Model.opus48);
+ expect(trigger.textContent).toContain(MODEL_PRETTYNAME[Model.opus5]);
+ expect(getByTestId('would-send').textContent).toBe(Model.opus5);
// Select a different model -> both the trigger and the would-send value move
// together to exactly that model.
@@ -185,10 +185,10 @@ describe('ModelSelector: what is shown is what is sent', () => {
}
const { container, getByTestId } = render(() => <FreeHarness />);
- fireEvent.click(itemFor(container, Model.opus48)); // locked
+ fireEvent.click(itemFor(container, Model.opus5)); // locked
// The would-send value is unchanged; only the paywall fired.
expect(getByTestId('would-send').textContent).toBe(Model.haiku45);
- expect(onLocked).toHaveBeenCalledWith(Model.opus48);
+ expect(onLocked).toHaveBeenCalledWith(Model.opus5);
});
});
diff --git a/apps/web/src/lib/core/component/AI/constant/model.test.ts b/apps/web/src/lib/core/component/AI/constant/model.test.ts
index cfb91098a4..c983fabc4c 100644
--- a/apps/web/src/lib/core/component/AI/constant/model.test.ts
+++ b/apps/web/src/lib/core/component/AI/constant/model.test.ts
@@ -27,7 +27,7 @@ describe('modelsForPlan / defaultModelForPlan', () => {
expect(free).toEqual([FREE_DEFAULT_MODEL]);
expect(defaultModelForPlan(false)).toBe(FREE_DEFAULT_MODEL);
// The premium models are *not* in a free user's selectable set.
- expect(free).not.toContain(Model.opus48);
+ expect(free).not.toContain(Model.opus5);
expect(free).not.toContain(Model.gpt55);
});
});
@@ -62,7 +62,7 @@ describe('alternateProviderModel', () => {
// Candidates model the user's accessible models. The suggestion must be
// one of them, never a model outside the accessible set.
const candidates: TModel[] = [Model.haiku45, Model.gpt5Mini];
- const alt = alternateProviderModel(Model.opus48, { candidates });
+ const alt = alternateProviderModel(Model.opus5, { candidates });
expect(candidates).toContain(alt);
expect(PROVIDER_OF(alt!)).toBe('openai'); // the only different-provider candidate
});
@@ -75,7 +75,7 @@ describe('alternateProviderModel', () => {
).toBeUndefined();
// Likewise when every candidate shares the current (Anthropic) provider.
expect(
- alternateProviderModel(Model.opus48, {
+ alternateProviderModel(Model.opus5, {
candidates: [Model.haiku45, Model.sonnet46],
})
).toBeUndefined();
@@ -87,7 +87,7 @@ describe('alternateProviderModel', () => {
// just the current model's provider.
const candidates = [...Object.values(Model)] as TModel[];
const failedProviders = new Set<string>();
- let current: TModel = Model.opus48; // anthropic
+ let current: TModel = Model.opus5; // anthropic
// Anthropic has an outage → suggest a different provider.
failedProviders.add(PROVIDER_OF(current));
@@ -110,7 +110,7 @@ describe('alternateProviderModel', () => {
});
it('still avoids the current provider when no failures are recorded', () => {
- const alt = alternateProviderModel(Model.opus48, {
+ const alt = alternateProviderModel(Model.opus5, {
candidates: [...Object.values(Model)] as TModel[],
failedProviders: new Set(),
});
diff --git a/apps/web/src/lib/core/component/AI/constant/model.ts b/apps/web/src/lib/core/component/AI/constant/model.ts
index 0080e0f055..b52ce54a1f 100644
--- a/apps/web/src/lib/core/component/AI/constant/model.ts
+++ b/apps/web/src/lib/core/component/AI/constant/model.ts
@@ -10,7 +10,7 @@ import OpenAiIcon from '@core/component/AI/assets/openai.svg';
*/
export const Model = {
sonnet5: 'anthropic/claude-sonnet-5',
- opus48: 'anthropic/claude-opus-4-8',
+ opus5: 'anthropic/claude-opus-5',
haiku45: 'anthropic/claude-haiku-4-5',
sonnet46: 'anthropic/claude-sonnet-4-6',
gpt55: 'openai/gpt-5.5',
@@ -28,7 +28,7 @@ type ExhaustiveMap = {
export const MODEL_PRETTYNAME: ExhaustiveMap = {
'anthropic/claude-sonnet-5': 'Sonnet 5',
- 'anthropic/claude-opus-4-8': 'Opus 4.8',
+ 'anthropic/claude-opus-5': 'Opus 5',
'anthropic/claude-haiku-4-5': 'Haiku 4.5',
'anthropic/claude-sonnet-4-6': 'Sonnet 4.6',
'openai/gpt-5.5': 'GPT-5.5',
@@ -37,7 +37,7 @@ export const MODEL_PRETTYNAME: ExhaustiveMap = {
export const MODEL_PROVIDER_ICON: ExhaustiveMap = {
'anthropic/claude-sonnet-5': AnthropicIcon,
- 'anthropic/claude-opus-4-8': AnthropicIcon,
+ 'anthropic/claude-opus-5': AnthropicIcon,
'anthropic/claude-haiku-4-5': AnthropicIcon,
'anthropic/claude-sonnet-4-6': AnthropicIcon,
'openai/gpt-5.5': OpenAiIcon,
@@ -78,7 +78,7 @@ export function modelsForPlan(hasPaidAccess: boolean): readonly TModel[] {
/** Provider serving each model — mirrors the backend `provider` field. */
export const MODEL_PROVIDER: ExhaustiveMap = {
'anthropic/claude-sonnet-5': 'anthropic',
- 'anthropic/claude-opus-4-8': 'anthropic',
+ 'anthropic/claude-opus-5': 'anthropic',
'anthropic/claude-haiku-4-5': 'anthropic',
'anthropic/claude-sonnet-4-6': 'anthropic',
'openai/gpt-5.5': 'openai',
diff --git a/apps/web/src/lib/core/component/AI/state/createChatController.test.tsx b/apps/web/src/lib/core/component/AI/state/createChatController.test.tsx
index a921ce65cb..f526d85408 100644
--- a/apps/web/src/lib/core/component/AI/state/createChatController.test.tsx
+++ b/apps/web/src/lib/core/component/AI/state/createChatController.test.tsx
@@ -91,7 +91,7 @@ describe('createChatController: provider-failure toast', () => {
// Mirror exactly how Chat.tsx wires onSwitchModel: the chat's model signal
// is the single source of truth, swapped via alternateProviderModel against
// the user's accessible (paid) models.
- const [model, setModel] = createSignal<TModel>(Model.opus48);
+ const [model, setModel] = createSignal<TModel>(Model.opus5);
const onSwitchModel = () => {
const alt = alternateProviderModel(model(), {
candidates: [...modelsForPlan(true)],
diff --git a/crates/agent/src/agent_loop.rs b/crates/agent/src/agent_loop.rs
index b46eddfd30..d9f5948648 100644
--- a/crates/agent/src/agent_loop.rs
+++ b/crates/agent/src/agent_loop.rs
@@ -210,8 +210,15 @@ impl AgentLoop {
// Tell the model which model it is. Done here (not on the frontend)
// so the system prompt always reflects the model actually serving the
- // request.
- let mut system_prompt = format!("{system_prompt}\n\nYou are the {} model.", self.model);
+ // request. A model's training data predates its own release, so a
+ // newly released model doesn't recognize its own id and may fall back
+ // to identifying as a predecessor — tell it to trust the id.
+ let mut system_prompt = format!(
+ "{system_prompt}\n\nYou are the {} model. If this model id is unfamiliar, \
+ that is because it was released after your training data cutoff — trust \
+ this id over your training data when identifying yourself.",
+ self.model
+ );
// Tell the model which connected integrations it can reach via tool
// search. The prompt text lives in the `prompt` crate; the toolset names
// are the dynamic data injected here. Omitted when nothing is connected.
diff --git a/crates/ai_usage/src/outbound/pg_usage_repo/test.rs b/crates/ai_usage/src/outbound/pg_usage_repo/test.rs
index 01596c13d9..27abe68a3d 100644
--- a/crates/ai_usage/src/outbound/pg_usage_repo/test.rs
+++ b/crates/ai_usage/src/outbound/pg_usage_repo/test.rs
@@ -24,6 +24,8 @@ async fn seeded_pricing_is_available(pool: PgPool) {
let repo = PgUsageRepo::new(pool);
let price = repo.get_pricing("claude-opus-4-8").await.unwrap();
assert_eq!(price, Some((5.0, 25.0)));
+ let price = repo.get_pricing("claude-opus-5").await.unwrap();
+ assert_eq!(price, Some((5.0, 25.0)));
assert_eq!(repo.get_pricing("nonexistent-model").await.unwrap(), None);
}
diff --git a/crates/chat/src/domain/models/model_access.rs b/crates/chat/src/domain/models/model_access.rs
index 4079eba439..b1fe12ab5f 100644
--- a/crates/chat/src/domain/models/model_access.rs
+++ b/crates/chat/src/domain/models/model_access.rs
@@ -6,7 +6,7 @@
/// The chat models offered to users, best-first.
pub const CHAT_MODELS: &[&str] = &[
"anthropic/claude-sonnet-5",
- "anthropic/claude-opus-4-8",
+ "anthropic/claude-opus-5",
"anthropic/claude-haiku-4-5",
"anthropic/claude-opus-4-7",
"anthropic/claude-sonnet-4-6",
diff --git a/crates/chat/src/domain/service/model_access/test.rs b/crates/chat/src/domain/service/model_access/test.rs
index e6a8c14377..60c881efae 100644
--- a/crates/chat/src/domain/service/model_access/test.rs
+++ b/crates/chat/src/domain/service/model_access/test.rs
@@ -2,7 +2,7 @@ use super::*;
const HAIKU: &str = "anthropic/claude-haiku-4-5";
const SONNET_5: &str = "anthropic/claude-sonnet-5";
-const OPUS: &str = "anthropic/claude-opus-4-8";
+const OPUS: &str = "anthropic/claude-opus-5";
const OPUS_4_7: &str = "anthropic/claude-opus-4-7";
const SONNET_4_6: &str = "anthropic/claude-sonnet-4-6";
const GPT_5_5: &str = "openai/gpt-5.5";
diff --git a/crates/chat/src/inbound/http/extractors.rs b/crates/chat/src/inbound/http/extractors.rs
index 9d52ff37f0..b74fbc211b 100644
--- a/crates/chat/src/inbound/http/extractors.rs
+++ b/crates/chat/src/inbound/http/extractors.rs
@@ -159,7 +159,7 @@ mod test {
let free = access(&[]);
assert_eq!(free.best_model(), FREE_MODEL);
assert!(free.has_access(FREE_MODEL));
- assert!(!free.has_access("anthropic/claude-opus-4-8"));
+ assert!(!free.has_access("anthropic/claude-opus-5"));
}
#[test]
@@ -167,7 +167,7 @@ mod test {
let pro = access(&[PermissionId::ReadProfessionalFeatures]);
assert_eq!(pro.best_model(), "anthropic/claude-sonnet-5");
assert!(pro.has_access("anthropic/claude-sonnet-5"));
- assert!(pro.has_access("anthropic/claude-opus-4-8"));
+ assert!(pro.has_access("anthropic/claude-opus-5"));
assert!(pro.has_access(FREE_MODEL));
assert!(pro.has_access("openai/gpt-5.5"));
}
@@ -177,6 +177,6 @@ mod test {
fn unrelated_permissions_stay_free() {
let acc = access(&[PermissionId::WriteEmailTool, PermissionId::ReadDocxEditor]);
assert!(!acc.professional());
- assert!(!acc.has_access("anthropic/claude-opus-4-8"));
+ assert!(!acc.has_access("anthropic/claude-opus-5"));
}
}
diff --git a/crates/macro_db_client/migrations/20260724182218_seed_claude_opus_5_pricing.sql b/crates/macro_db_client/migrations/20260724182218_seed_claude_opus_5_pricing.sql
new file mode 100644
index 0000000000..3024085679
--- /dev/null
+++ b/crates/macro_db_client/migrations/20260724182218_seed_claude_opus_5_pricing.sql
@@ -0,0 +1,7 @@
+-- Seed pricing for Claude Opus 5 (USD per million tokens), which replaces
+-- Claude Opus 4.8 in the chat model selector. Same price as Opus 4.8 per the
+-- Claude pricing catalog. ON CONFLICT keeps any price already set at runtime
+-- via the set_pricing endpoint.
+INSERT INTO ai_pricing (model, price_per_million_in, price_per_million_out) VALUES
+ ('claude-opus-5', 5.0, 25.0)
+ON CONFLICT (model) DO NOTHING;