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.

fix(ai): withhold Anthropic fast mode until the account is approved (#7980)

Wolf Mermelstein78e3b320a515
diff --git a/apps/web/src/components/ui/components/SpeedToggle.docs.tsx b/apps/web/src/components/ui/components/SpeedToggle.docs.tsx
index d866d454f6..239f5d892f 100644
--- a/apps/web/src/components/ui/components/SpeedToggle.docs.tsx
+++ b/apps/web/src/components/ui/components/SpeedToggle.docs.tsx
@@ -13,7 +13,7 @@ function SpeedsDemo() {
<SpeedToggle model={Model.gpt61Sol} /> GPT-6.1 Sol · 6×
</div>
<div class="flex items-center gap-3">
- <SpeedToggle model={Model.opus55} /> Opus 5.5 · 2×
+ <SpeedToggle model={Model.opus55} /> Opus 5.5 · standard only
</div>
<div class="flex items-center gap-3">
<SpeedToggle model={Model.sonnet55} /> Sonnet 5.5 · standard only
diff --git a/apps/web/src/lib/core/component/AI/component/input/SpeedToggle.test.tsx b/apps/web/src/lib/core/component/AI/component/input/SpeedToggle.test.tsx
index 832c91cdcb..261ff1f08d 100644
--- a/apps/web/src/lib/core/component/AI/component/input/SpeedToggle.test.tsx
+++ b/apps/web/src/lib/core/component/AI/component/input/SpeedToggle.test.tsx
@@ -44,11 +44,18 @@ it('animates the bolt and retains its paid-speed preference across mounts', () =
expect(localStorage.getItem('macro:ai-fast-mode')).toBe('true');
expect(animate).toHaveBeenCalledOnce();
view.unmount();
- render(() => <SpeedToggle model={Model.opus55} />);
+ render(() => <SpeedToggle model={Model.gpt61Sol} />);
expect(screen.getByRole('button').getAttribute('aria-label')).toContain(
- 'Fast mode on · 2×'
+ 'Ultrafast mode on · 6×'
);
- expect(speedForModel(Model.opus55, true)).toBe('fast');
+ expect(speedForModel(Model.gpt61Sol, true)).toBe('ultrafast');
+});
+
+it('keeps Claude Opus on standard speed while Anthropic fast mode is off', () => {
+ setFastModeEnabled(true);
+ render(() => <SpeedToggle model={Model.opus55} />);
+ expect(screen.queryByRole('button')).toBeNull();
+ expect(speedForModel(Model.opus55, true)).toBe('standard');
});
it('leaves unsupported models at standard speed and respects reduced motion', () => {
diff --git a/apps/web/src/lib/core/component/AI/constant/speed.ts b/apps/web/src/lib/core/component/AI/constant/speed.ts
index 1ed8624e6f..c4821dc454 100644
--- a/apps/web/src/lib/core/component/AI/constant/speed.ts
+++ b/apps/web/src/lib/core/component/AI/constant/speed.ts
@@ -2,12 +2,14 @@ import { Model } from './model';
export type ModelSpeed = 'standard' | 'fast' | 'ultrafast';
-/** Only advertise speed tiers supported by the provider for this exact model. */
+/**
+ * Only advertise speed tiers this account can use for the exact model.
+ * Opus fast mode stays off until Anthropic approves the account.
+ */
export function acceleratedSpeed(
model: string
): Exclude<ModelSpeed, 'standard'> | undefined {
if (model === Model.gpt6Astra || model === Model.gpt61Sol) return 'ultrafast';
- if (model === Model.opus55) return 'fast';
return undefined;
}
diff --git a/crates/agent/src/model/metering/per_call.rs b/crates/agent/src/model/metering/per_call.rs
index 067d8ce779..1f3b9d2f5f 100644
--- a/crates/agent/src/model/metering/per_call.rs
+++ b/crates/agent/src/model/metering/per_call.rs
@@ -63,7 +63,7 @@ impl PerCallUsage {
return Err(MeteringError::Unsupported);
}
};
- if !speed.supported(&self.model) {
+ if !speed.billable(&self.model) {
return Err(MeteringError::Unsupported);
}
let bare = self
diff --git a/crates/agent/src/model/speed.rs b/crates/agent/src/model/speed.rs
index 8e33d4d13b..ee32d526a5 100644
--- a/crates/agent/src/model/speed.rs
+++ b/crates/agent/src/model/speed.rs
@@ -11,21 +11,34 @@ pub enum ModelSpeed {
#[default]
Standard,
/// Use Anthropic's faster Opus inference.
+ ///
+ /// Withheld until Anthropic approves the account for Claude fast mode.
Fast,
/// Use OpenAI's fastest Responses processing tier.
Ultrafast,
}
+/// Flip on once Anthropic approves the account for Claude fast mode.
+const ANTHROPIC_FAST_MODE_ENABLED: bool = false;
+
impl ModelSpeed {
- /// Whether this model supports the requested speed.
+ /// Whether a caller may request this speed for `model`.
pub fn supported(self, model: &str) -> bool {
match self {
Self::Standard => true,
- Self::Fast => model == "anthropic/claude-opus-5-5",
+ Self::Fast => ANTHROPIC_FAST_MODE_ENABLED && model == "anthropic/claude-opus-5-5",
Self::Ultrafast => matches!(model, "openai/gpt-6-astra" | "openai/gpt-6.1-sol"),
}
}
+ /// Whether a delivered tier has a price for `model`, including withheld speeds.
+ pub(crate) fn billable(self, model: &str) -> bool {
+ match self {
+ Self::Fast => model == "anthropic/claude-opus-5-5",
+ other => other.supported(model),
+ }
+ }
+
/// Models whose usage must be priced per provider call, including long context.
pub fn has_per_call_pricing(model: &str) -> bool {
matches!(
@@ -55,6 +68,9 @@ impl ModelSpeed {
/// Add the provider-specific setting without changing reasoning parameters.
pub(crate) fn apply(self, model: &str, params: &mut serde_json::Value) {
+ if !self.supported(model) {
+ return;
+ }
match self {
Self::Standard if model.starts_with("openai/") => {
params["service_tier"] = "default".into()
diff --git a/crates/agent/src/model/speed/test.rs b/crates/agent/src/model/speed/test.rs
index 295fe6f5b5..d3d870b866 100644
--- a/crates/agent/src/model/speed/test.rs
+++ b/crates/agent/src/model/speed/test.rs
@@ -4,9 +4,11 @@ use super::*;
fn premium_speeds_are_model_specific() {
assert!(ModelSpeed::Ultrafast.supported("openai/gpt-6-astra"));
assert!(ModelSpeed::Ultrafast.supported("openai/gpt-6.1-sol"));
- assert!(ModelSpeed::Fast.supported("anthropic/claude-opus-5-5"));
+ assert!(!ModelSpeed::Fast.supported("anthropic/claude-opus-5-5"));
+ assert!(ModelSpeed::Fast.billable("anthropic/claude-opus-5-5"));
for model in [
"openai/gpt-6-sol",
+ "anthropic/claude-opus-5-5",
"anthropic/claude-sonnet-5-5",
"google/gemini-3.8-flash",
] {
@@ -24,4 +26,7 @@ fn speed_preserves_reasoning_parameters() {
assert_eq!(params["service_tier"], "ultrafast");
ModelSpeed::Standard.apply("openai/gpt-6-astra", &mut params);
assert_eq!(params["service_tier"], "default");
+ let mut withheld = serde_json::json!({});
+ ModelSpeed::Fast.apply("anthropic/claude-opus-5-5", &mut withheld);
+ assert!(withheld.get("speed").is_none());
}
diff --git a/crates/agent_inmem/src/domain/agent/test.rs b/crates/agent_inmem/src/domain/agent/test.rs
index 39e5bad133..29883159ec 100644
--- a/crates/agent_inmem/src/domain/agent/test.rs
+++ b/crates/agent_inmem/src/domain/agent/test.rs
@@ -2535,7 +2535,11 @@ async fn changing_speed_applies_to_next_turn_and_rejects_unsupported_models() {
struct SpeedEngine(ScriptedEngine);
impl TurnEngine for SpeedEngine {
fn supported_models(&self) -> &[&str] {
- &["anthropic/claude-sonnet-5-5", "anthropic/claude-opus-5-5"]
+ &[
+ "anthropic/claude-sonnet-5-5",
+ "anthropic/claude-opus-5-5",
+ "openai/gpt-6-astra",
+ ]
}
fn run_turn(
&self,
@@ -2566,11 +2570,31 @@ async fn changing_speed_applies_to_next_turn_and_rejects_unsupported_models() {
.block_task()
.await
.unwrap();
+ assert!(
+ connection
+ .send_request(SetSessionConfigOptionRequest::new(
+ session.clone(),
+ "speed",
+ "fast",
+ ))
+ .block_task()
+ .await
+ .is_err()
+ );
+ connection
+ .send_request(SetSessionConfigOptionRequest::new(
+ session.clone(),
+ MODEL_CONFIG_ID,
+ "openai/gpt-6-astra",
+ ))
+ .block_task()
+ .await
+ .unwrap();
connection
.send_request(SetSessionConfigOptionRequest::new(
session.clone(),
"speed",
- "fast",
+ "ultrafast",
))
.block_task()
.await
@@ -2597,6 +2621,6 @@ async fn changing_speed_applies_to_next_turn_and_rejects_unsupported_models() {
})
.await;
let requests = engine.0.requests();
- assert_eq!(requests[0].speed, agent::ModelSpeed::Fast);
+ assert_eq!(requests[0].speed, agent::ModelSpeed::Ultrafast);
assert_eq!(requests[1].speed, agent::ModelSpeed::Standard);
}
diff --git a/crates/agent_inmem/src/domain/model_options/test.rs b/crates/agent_inmem/src/domain/model_options/test.rs
index e79df4c988..a4bd5987cf 100644
--- a/crates/agent_inmem/src/domain/model_options/test.rs
+++ b/crates/agent_inmem/src/domain/model_options/test.rs
@@ -57,7 +57,6 @@ fn speed_is_advertised_only_for_supported_models_with_current_value() {
for (model, speed) in [
("openai/gpt-6-astra", ModelSpeed::Ultrafast),
("openai/gpt-6.1-sol", ModelSpeed::Ultrafast),
- ("anthropic/claude-opus-5-5", ModelSpeed::Fast),
] {
let options =
super::session_config_options(model, &[model], ReasoningEffort::Default, speed);
@@ -70,6 +69,7 @@ fn speed_is_advertised_only_for_supported_models_with_current_value() {
};
assert_eq!(select.current_value.to_string(), speed.as_str());
}
+ assert!(super::speed_config_option("anthropic/claude-opus-5-5", ModelSpeed::Fast).is_none());
assert!(
super::speed_config_option("anthropic/claude-sonnet-5-5", ModelSpeed::Standard).is_none()
);
diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.md
index 2008b3166e..0eb03801d0 100644
--- a/docs/AGENT_GUIDE/ai-chat.md
+++ b/docs/AGENT_GUIDE/ai-chat.md
@@ -1631,11 +1631,12 @@ choose a vision model or start a conversation without images.
## Accelerated model speed
The lightning button beside the model selector enables Ultrafast for GPT-6 Astra
-and GPT-6.1 Sol (6× token pricing), or Fast for Claude Opus 5.5 (2× token pricing).
-Its tooltip shows the mode, state, and usage multiplier before sending. Other
-models keep standard speed. The preference is saved in browser local storage and
-shared by legacy chat and native Macro agent composers. External coding agents
-use their own speed controls.
+and GPT-6.1 Sol (6× token pricing). Its tooltip shows the mode, state, and usage
+multiplier before sending. Claude models, including Opus 5.5, stay on standard
+speed until Anthropic approves fast mode for this account. Other models keep
+standard speed. The preference is saved in browser local storage and shared by
+legacy chat and native Macro agent composers. External coding agents use their
+own speed controls.
Preview the controls at `/app/debug/ui?ui=speed-toggle`.
Click the bolt and verify its brief scale/rotation animation and highlighted state.