Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

feat(gui): gate the /fast toggle on codex (fast_applies), matching the harness

Rach Pradhan19c2d28bbe75
diff --git a/gui/src-tauri/src/dto/runtime.rs b/gui/src-tauri/src/dto/runtime.rs
index 15148f0d..ca9b9541 100644
--- a/gui/src-tauri/src/dto/runtime.rs
+++ b/gui/src-tauri/src/dto/runtime.rs
@@ -277,6 +277,12 @@ pub struct PromptSettingsDto {
pub selected_model_id: Option<String>,
pub selected_reasoning_effort: Option<String>,
pub fast_enabled: bool,
+ /// Whether toggling fast actually changes harness behavior for the selected
+ /// provider. The harness only applies /fast on the codex provider (the
+ /// `responses` kind): it emits `service_tier:"priority"` there and reports
+ /// `applies:false` everywhere else. True only when the selected provider is
+ /// codex; the GUI greys out the toggle when this is false.
+ pub fast_applies: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, TS)]
diff --git a/gui/src-tauri/src/runtime/simple.rs b/gui/src-tauri/src/runtime/simple.rs
index 2ceea537..086de27e 100644
--- a/gui/src-tauri/src/runtime/simple.rs
+++ b/gui/src-tauri/src/runtime/simple.rs
@@ -2830,6 +2830,8 @@ fn build_prompt_settings_from_catalog(
selected_model_id: Some("default".into()),
selected_reasoning_effort: None,
fast_enabled,
+ // codegraff is the `chat` kind, not `responses`: /fast is a no-op.
+ fast_applies: false,
};
}
@@ -2839,6 +2841,7 @@ fn build_prompt_settings_from_catalog(
selected_model_id: None,
selected_reasoning_effort: None,
fast_enabled,
+ fast_applies: false,
};
}
@@ -2865,12 +2868,22 @@ fn build_prompt_settings_from_catalog(
None
};
+ // /fast only changes behavior on the codex provider (the harness `responses`
+ // kind, which emits `service_tier:"priority"`); it reports `applies:false`
+ // for every other provider. Gate on the *resolved* provider so the GUI
+ // matches what the harness will actually do for the active selection.
+ let fast_applies = selected_pair
+ .as_ref()
+ .map(|(provider, _)| provider == "codex")
+ .unwrap_or(false);
+
PromptSettingsDto {
available_models,
selected_provider_id: selected_pair.as_ref().map(|(provider, _)| provider.clone()),
selected_model_id: selected_pair.as_ref().map(|(_, model)| model.clone()),
selected_reasoning_effort: selected_pair.and(selected_effort),
fast_enabled,
+ fast_applies,
}
}
diff --git a/gui/src/app/SessionProvider.test.tsx b/gui/src/app/SessionProvider.test.tsx
index 0f120440..ac27e73e 100644
--- a/gui/src/app/SessionProvider.test.tsx
+++ b/gui/src/app/SessionProvider.test.tsx
@@ -128,6 +128,7 @@ const promptSettingsFixture: PromptSettings = {
selectedProviderId: "openai",
selectedReasoningEffort: "medium",
fastEnabled: false,
+ fastApplies: false,
};
mock.module("../hooks/useSessionBootstrap", () => ({
diff --git a/gui/src/app/sessionStore.test.ts b/gui/src/app/sessionStore.test.ts
index 1c6b1484..56fdbbfb 100644
--- a/gui/src/app/sessionStore.test.ts
+++ b/gui/src/app/sessionStore.test.ts
@@ -47,6 +47,7 @@ const promptSettingsFixture: PromptSettings = {
selectedProviderId: "openai",
selectedReasoningEffort: "medium",
fastEnabled: false,
+ fastApplies: false,
};
function createSnapshot(
diff --git a/gui/src/components/PromptInputCard.test.tsx b/gui/src/components/PromptInputCard.test.tsx
index 923d215b..dcf7142b 100644
--- a/gui/src/components/PromptInputCard.test.tsx
+++ b/gui/src/components/PromptInputCard.test.tsx
@@ -27,6 +27,7 @@ const promptSettings: PromptSettings = {
selectedProviderId: "anthropic",
selectedReasoningEffort: "medium",
fastEnabled: false,
+ fastApplies: false,
};
function renderPromptInputCard(
diff --git a/gui/src/components/PromptInputCard.tsx b/gui/src/components/PromptInputCard.tsx
index b3d43c03..09fe32da 100644
--- a/gui/src/components/PromptInputCard.tsx
+++ b/gui/src/components/PromptInputCard.tsx
@@ -143,9 +143,14 @@ export function PromptInputCard({
setFastEnabled(promptSettings?.fastEnabled ?? false);
}, [promptSettings?.fastEnabled]);
- const isCodexModel = selectedModel?.providerId === "codex";
+ // Whether /fast actually changes harness behavior. The harness only applies
+ // the priority service tier on the codex provider (the `responses` kind); it
+ // is a no-op everywhere else. The runtime reports this authoritatively via
+ // `fastApplies`, so the toggle stays active only when it's true.
+ const fastApplies = promptSettings?.fastApplies ?? false;
function handleFastToggle() {
+ if (!fastApplies) return;
const next = !fastEnabled;
setFastEnabled(next);
void setFast(next);
@@ -533,26 +538,29 @@ export function PromptInputCard({
<MapIcon data-icon="inline-start" />
<span className="text-xs">Plan</span>
</Button>
- {isCodexModel ? (
- <Button
- type="button"
- variant="outline"
- size="sm"
- aria-label="Toggle fast mode"
- aria-pressed={fastEnabled}
- className={cn(
- "text-muted-foreground hover:bg-transparent hover:text-foreground",
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ aria-label="Toggle fast mode"
+ aria-pressed={fastApplies && fastEnabled}
+ className={cn(
+ "text-muted-foreground hover:bg-transparent hover:text-foreground",
+ fastApplies &&
fastEnabled &&
- "border-[color:var(--accent)] bg-[color:color-mix(in_oklab,var(--accent)_10%,transparent)] text-foreground hover:bg-[color:color-mix(in_oklab,var(--accent)_14%,transparent)]",
- )}
- disabled={isControlDisabled}
- onClick={handleFastToggle}
- title="Codex priority service tier — lower latency"
- >
- <ZapIcon data-icon="inline-start" />
- <span className="text-xs">Fast</span>
- </Button>
- ) : null}
+ "border-[color:var(--accent)] bg-[color:color-mix(in_oklab,var(--accent)_10%,transparent)] text-foreground hover:bg-[color:color-mix(in_oklab,var(--accent)_14%,transparent)]",
+ )}
+ disabled={isControlDisabled || !fastApplies}
+ onClick={handleFastToggle}
+ title={
+ fastApplies
+ ? "Codex priority service tier — lower latency"
+ : "Fast (priority) — codex only"
+ }
+ >
+ <ZapIcon data-icon="inline-start" />
+ <span className="text-xs">Fast</span>
+ </Button>
{isPlanningMode ? (
<span
className="inline-flex h-8 items-center gap-2 px-1.5 text-xs font-medium text-muted-foreground"
diff --git a/gui/src/services/desktop/client.ts b/gui/src/services/desktop/client.ts
index 2b02b0ab..7ef05482 100644
--- a/gui/src/services/desktop/client.ts
+++ b/gui/src/services/desktop/client.ts
@@ -189,6 +189,7 @@ function qaPromptSettings(): PromptSettings {
selectedProviderId: "anthropic",
selectedReasoningEffort: qaReasoningEffort,
fastEnabled: false,
+ fastApplies: false,
};
}
diff --git a/gui/src/services/desktop/types/contracts.generated.ts b/gui/src/services/desktop/types/contracts.generated.ts
index 07a038ae..fd8b9d51 100644
--- a/gui/src/services/desktop/types/contracts.generated.ts
+++ b/gui/src/services/desktop/types/contracts.generated.ts
@@ -43,7 +43,15 @@ export type SessionSnapshot = { activeWorkspacePath: string | null, activeConver
export type PromptModelOption = { providerId: string, providerName: string, modelId: string, modelName: string | null, contextLength: bigint | null, supportsReasoning: boolean, reasoningEfforts: Array<string>, };
-export type PromptSettings = { availableModels: Array<PromptModelOption>, selectedProviderId: string | null, selectedModelId: string | null, selectedReasoningEffort: string | null, fastEnabled: boolean, };
+export type PromptSettings = { availableModels: Array<PromptModelOption>, selectedProviderId: string | null, selectedModelId: string | null, selectedReasoningEffort: string | null, fastEnabled: boolean,
+/**
+ * Whether toggling fast actually changes harness behavior for the selected
+ * provider. The harness only applies /fast on the codex provider (the
+ * `responses` kind): it emits `service_tier:"priority"` there and reports
+ * `applies:false` everywhere else. True only when the selected provider is
+ * codex; the GUI greys out the toggle when this is false.
+ */
+fastApplies: boolean, };
export type UpdatePromptSettingsInput = { workspacePath: string | null, providerId: string, modelId: string, reasoningEffort: string | null, };