Files
galaxy/crates/warp_features/src/lib.rs
T
Matthew AlbrightandOz a6d1ece15e Remove orchestration_event_push feature flag; rename poller to streamer (#9265)
## Description

Removes the `orchestration_event_push` feature flag and the polling
fallback in the orchestration event delivery path. SSE-based event push
has been on in dogfood and staging long enough that it's now the only
path; the dual-mode `OrchestrationEventPoller` is renamed to
`OrchestrationEventStreamer` and only opens persistent SSE connections.

- Removed `FeatureFlag::OrchestrationEventPush` and the matching Cargo
feature.
- Renamed `app/src/ai/blocklist/orchestration_event_poller.rs` (and its
tests) to `orchestration_event_streamer.rs`. Renamed the public type to
`OrchestrationEventStreamer`; renamed the shared event-injection sink
`handle_poll_result` → `handle_event_batch`.
- Removed polling-only state (`poll_backoff_index`, `poll_in_flight`),
methods (`poll_and_inject`, `start_idle_poll_timer`), and constants
(`POLL_BACKOFF_STEPS`, `EVENT_POLL_BATCH_LIMIT`). Kept `event_cursor`,
`pending_delivery`, and `conversation_statuses` since they are also used
by the SSE path.
- Removed the now-dead `AIClient::poll_agent_events` trait method and
its `ServerApi` implementation in `app/src/server/server_api/ai.rs`.

The `OrchestrationV2` flag continues to gate streamer instantiation and
watched-run registration; runtime behavior under v2 is unchanged.

Pairs with the warp-server PR that drops the flag server-side:
https://github.com/warpdotdev/warp-server/pull/10736 — that PR should
land first so the polling endpoint stays available for older clients
during rollout.

## Testing
- `cargo build -p warp` clean.
- `cargo clippy -p warp -p warp_features --all-targets -- -D warnings`
clean (after `cargo fmt`).
- `cargo test -p warp --lib ai::blocklist::orchestration_event_streamer`
— all 7 tests pass.

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode

---

[Plan: Remove orchestration_event_push flag (server +
client)](https://staging.warp.dev/drive/notebook/yAlAxMAr4EO65A9LEy40cX)

[Conversation](https://staging.warp.dev/conversation/ff5e82cb-bba7-4cbf-ae0b-e51f2c542f4a)

---------

Co-authored-by: Oz <oz-agent@warp.dev>
2026-04-29 09:42:02 -04:00

1171 lines
40 KiB
Rust

use std::sync::atomic::{AtomicBool, AtomicU8, Ordering};
use enum_iterator::{cardinality, Sequence};
#[cfg(feature = "test-util")]
pub use overrides::{get_overrides, set_overrides};
#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug, Sequence)]
pub enum FeatureFlag {
Changelog,
CocoaSentry,
CrashReporting,
DebugMode,
Autoupdate,
LogExpensiveFramesInSentry,
WithSandboxTelemetry,
RecordAppActiveEvents,
WelcomeTips,
ThinStrokes,
WelcomeBlock,
KnowledgeSidebar,
RuntimeFeatureFlags,
/// Enables cloud object related features for an explicit allowlist of team testers.
CloudObjects,
/// If `true`, fetch updated Warp channel versions from the Warp server endpoint instead of
/// from GCP directly.
FetchChannelVersionsFromWarpServer,
/// Does grid storage go forwards or backwards
SequentialStorage,
/// If set, generators are executed in-band in all SSH sessions.
InBandGeneratorsForSSH,
/// If set, generators are executed using cmd.exe on Windows.
RunGeneratorsWithCmdExe,
/// Gates a bindable keyboard action for accepting command corrections.
CommandCorrectionKey,
/// If `true`, the "Show Initialization Block" menu item is added to the Blocks menu in the Mac
/// menu bar.
ToggleBootstrapBlock,
/// A runtime flag to enable the creation of shared sessions.
///
/// It is enabled if the logged in user is part of a paying team
/// or part of the allowlist (via [`ServerExperiment::SessionSharingExperiment`]).
///
/// We also use [`ServerExperiment::SessionSharingControl`] as a
/// killswitch for abuse prevention.
CreatingSharedSessions,
/// Enables the joining / viewing of shared sessions (_not_ creation).
ViewingSharedSessions,
/// Enabling context chips functionality for prompt
ContextChips,
/// Ligature Support in the Editor and Grid
Ligatures,
/// When enabled, the `History` rule from the command_corrections crate
/// will be enabled. When the `History` rule is enabled, the command_corrections
/// lib will use the user's history as a last-ditch effort to find a reasonable correction.
CommandCorrectionsHistoryRule,
/// Used to gate an experiment we're doing on WarpDev ONLY
/// to get a sense of PTY throughput over time.
RecordPtyThroughput,
/// Whether to fetch generic string objects from the server.
FetchGenericStringObjects,
/// Enables a setting on Intel Dual-GPU Macs to enable use of the integrated GPU over the
/// discrete GPU.
IntegratedGPU,
/// Warp Agent Mode.
AgentMode,
/// Whether the user is part of the Warp Alpha Program (AI Trusted Testers).
/// This is enabled automatically for local and dev builds.
/// Collect conversation and input autodetection data for agent mode.
/// Also collects block data for Next Command, if enabled.
AgentModeAnalytics,
/// A setting to enable a traditional completions experience.
ClassicCompletions,
/// Force enable classic completions.
ForceClassicCompletions,
/// If enabled, autosuggestions are hidden when the tab completions
/// menu is open (except when using completions-as-you-type).
RemoveAutosuggestionDuringTabCompletions,
/// Feature flag for cursor reflow fix (fixes part of the Alacritty resizing logic).
ResizeFix,
/// Enable multiselect in Notebooks and Warp Text.
RichTextMultiselect,
/// If enabled, the default input mode is set to waterfall for new users.
DefaultWaterfallMode,
/// Makes the input editor's prompt selectable.
SelectablePrompt,
/// Enables the settings file feature.
SettingsFile,
/// Enables the settings import onboarding block and pre-parsing
/// configs on app startup.
SettingsImport,
/// Enables rect selection.
RectSelection,
/// Adds Alacritty as a supported terminal to import settings from.
AlacrittySettingsImport,
/// Enable dynamic enum parameter types for workflow arguments
DynamicWorkflowEnums,
/// Enables next action prediction within Warp, powered by AI.
AgentPredict,
/// Enables receiving shared Warp Drive objects.
SharedWithMe,
/// Enables workflows for use with Agent Mode.
AgentModeWorkflows,
/// Enables AI rules for use with Agent Mode.
AIRules,
/// Routes SSH sessions through the tmux-backed SSH wrapper.
SSHTmuxWrapper,
/// Reduces the amount of horizontal padding in the blocklist
/// from 20px to 16px.
LessHorizontalTerminalPadding,
/// Enables the shell selector, allowing us to open a new tab in
/// a shell other than the default shell.
ShellSelector,
/// Enables writing to long-running commands in shared sessions.
SharedSessionWriteToLongRunningCommands,
/// Replaces the bookmark button with a "save as workflow" button.
BlockToolbeltSaveAsWorkflow,
/// Lazily builds scenes at render time instead of eagerly when a view
/// changes.
LazySceneBuilding,
/// Enables support for ACLs in Session Sharing. Should be disabled if the
/// corresponding `use_acls` flag in the session sharing server is disabled.
/// https://github.com/warpdotdev/session-sharing-server/blob/b6590ebd0b0e7f6847d6b2228b4e77d63939ce22/server/Cargo.toml#L13
SessionSharingAcls,
/// Removes the extraneous padding from the alt-screen that we previously had
/// to keep consistent size between blocklist and alt-screen.
///
/// See plan here: https://docs.google.com/document/d/1TBPSWNfh4KylkEgL5o5xyYgK_KQzUQk1oxjuIx2ipXw
RemoveAltScreenPadding,
/// Enables the full-screen "zen mode" setting, where we hide the tab bar if there's only one
/// tab.
FullScreenZenMode,
/// Playground for reducing Warp UI clutter.
MinimalistUI,
/// Enables support for using native shell completions to supplement our
/// completion specs.
NativeShellCompletions,
/// Adds avatar to the tab bar.
AvatarInTabBar,
/// Adds aliases for executing Warp Drive workflows.
WorkflowAliases,
SshDragAndDrop,
DragTabsToWindows,
/// Enables the overflow menu on AI blocks.
AIBlockOverflowMenu,
/// Enables cycling through the next command suggestions with down arrow.
CycleNextCommandSuggestion,
/// Enables multi-workspace selection.
MultiWorkspace,
/// Maximizes data in flat storage to reduce memory usage.
MaximizeFlatStorage,
ImeMarkedText,
/// Enables partial next command suggestions with a prefix.
PartialNextCommandSuggestions,
AIGeneratedOnboardingSuggestions,
/// Enables iTerm image rendering
ITermImages,
/// Enables validation of autosuggestions.
ValidateAutosuggestions,
/// Enables prompt suggestions sourced via MAA.
PromptSuggestionsViaMAA,
/// Enables using `esc` to clear autosuggestions.
ClearAutosuggestionOnEscape,
/// If enabled, the default theme is set to Adeberry for new users.
DefaultAdeberryTheme,
/// New, less intrusive autoupdate UI.
AutoupdateUIRevamp,
/// Enables Kitty image rendering
KittyImages,
/// Enables support for Warp Packs.
WarpPacks,
/// Enables the revised AI analytics policy banner.
///
/// This does not gate actual collection of data under the new policy.
GlobalAIAnalyticsBanner,
/// Enables actual collection of AI analytics data per the revised AI analytics policy.
GlobalAIAnalyticsCollection,
/// Enables auto-generated AI memories.
AIMemories,
/// Enables the XML output system prompt for the primary (terminal) agent in Agent Mode.
AgentModePrimaryXML,
/// Enables the XML output system prompt for the pre-plan agent in Agent Mode.
AgentModePrePlanXML,
/// Enables Agent Mode onboarding.
AgentOnboarding,
/// Enables suggested rules.
SuggestedRules,
/// Enables suggested workflows for Agent Mode.
SuggestedAgentModeWorkflows,
/// Forces users to login.
ForceLogin,
/// Enables prediction of Agent Mode queries.
PredictAMQueries,
/// Enables full source code embedding of repos when using codebase context.
FullSourceCodeEmbedding,
/// If enabled, command palette searches will use Tantivy search instead of the default fuzzy search.
UseTantivySearch,
/// Allows AI to call the grep tool.
GrepTool,
/// MCP server v0 functionality.
McpServer,
/// Enables image as context for AM.
ImageAsContext,
/// UNIX shells running "natively" on Windows via MSYS2.
MSYS2Shells,
/// Allows AI to call the file retrieval tools.
FileRetrievalTools,
/// Reload files in an AI conversation to prevent stale files.
ReloadStaleConversationFiles,
/// Auto generate the title when creating a shared block.
SharedBlockTitleGeneration,
/// Retry truncated file edit responses from the coding agent.
RetryTruncatedCodeResponses,
/// Enables reading images with the `read_files` tool.
ReadImageFiles,
UsageBasedPricing,
/// Enables cross-repo codebase context.
CrossRepoContext,
/// Persist codebase indices to disk.
CodebaseIndexPersistence,
/// Enables the AI context menu, or at-menu.
AIContextMenuEnabled,
/// Enables the AI context menu outside of AI input mode.
AtMenuOutsideOfAIMode,
/// Enables the resume button for cancelled AI conversations.
AIResumeButton,
/// Enables the agent to decide whether to execute a command.
AgentDecidesCommandExecution,
/// Show speed bump when enabling codebase indexing.
CodebaseIndexSpeedbump,
/// Enables inline review comments on specific lines of code.
ContextLineReviewComments,
/// Enables the natural language classification model.
NLDClassifierModelEnabled,
/// Enables the fast-forward autoexecute button
FastForwardAutoexecuteButton,
/// Remembers the per-conversation fast-forward state across local session restoration.
RememberFastForwardState,
/// Enables the find/replace in code editor
CodeFindReplace,
/// Enables file search functionality in command palette
CommandPaletteFileSearch,
/// Enables the AI context menu nesting and commands
AIContextMenuCommands,
/// Enables sending stderr warnings in FileGlobV2 results.
FileGlobV2Warnings,
/// Enables code symbols in AI context menu
AIContextMenuCode,
/// Enables Warp Drive objects (like workflows) as context in AI context menu
DriveObjectsAsContext,
/// Expands code diff edits to replace the current pane instead of opening in a new tab.
ExpandEditToPane,
/// Enables fallback model load output messaging in the warping indicator.
FallbackModelLoadOutputMessaging,
/// Enables close button on left side of tabs
TabCloseButtonOnLeft,
/// Enables AI agent profile settings UI and functionality.
///
/// TODO: When cleaning up this flag, also remove the `show_model_selectors_in_prompt`
/// setting in [`SessionSettings`] (defined in `app/src/terminal/session_settings.rs`),
/// as model selectors are always shown when this flag is enabled.
ProfilesDesignRevamp,
/// Enables new Search Codebase UI
SearchCodebaseUI,
/// Enables return changed lines on apply diff result
ChangedLinesOnlyApplyDiffResult,
/// Enables us to render linked code blocks
LinkedCodeBlocks,
/// Enables the tabbed file viewer
TabbedEditorView,
/// Enables sending telemetry data to a file in addition to the server
SendTelemetryToFile,
/// Enables multiple agent profiles in settings for managing different AI agent configurations.
MultiProfile,
/// Enables the /pr-comments slash command.
PRCommentsSlashCommand,
/// Enables displaying imported PR review comments in the blocklist.
PRCommentsV2,
/// Gates the bundled skill-based implementation of PR comment fetching.
PRCommentsSkill,
/// An entrypoint pane type to launch other pane types from a search palette. The default view
/// when creating a tab.
WelcomeTab,
/// A new first-time user experience which prioritizes choosing a coding repository.
GetStartedTab,
/// Enables Projects and Project management
Projects,
/// Enables selection-as-context functionality in the code editor.
SelectionAsContext,
/// A context chip that shows when the PWD is inside of a git repository.
CodeModeChip,
/// Enables the prompt chip that displays the GitHub PR for the current branch.
GithubPrPromptChip,
/// A button on the homepage for easily creating new projects.
CreateProjectFlow,
/// Enables vim keybindings in the code editor.
VimCodeEditor,
/// Allows opening file links using the $EDITOR environment variable.
AllowOpeningFileLinksUsingEditorEnv,
/// Enables improvements to our natural language detection functionality.
NldImprovements,
/// Enables the ability to undo closed panes.
UndoClosedPanes,
/// Enables revert button for diff hunks in the gutter.
RevertDiffHunk,
/// Enables saving code review pane changes
CodeReviewSaveChanges,
/// Enables the file tree (with an entrypoint through code mode).
FileTree,
/// Enables ignoring input suggestions.
AllowIgnoringInputSuggestions,
/// Enables the one-time modal on app startup for existing users for the Code launch.
CodeLaunchModal,
/// Enables API key authentication for Agent SDK
APIKeyAuthentication,
/// Enables API key management UI in settings
APIKeyManagement,
/// Enables OAuth support for MCP.
McpOauth,
/// Enables attaching diff sets (multiple hunks from multiple files) as context in Agent Mode.
DiffSetAsContext,
/// Enables file- and diff set-level comments in the code review header.
FileAndDiffSetComments,
/// Enables discarding per-file and discarding all changes
DiscardPerFileAndAllChanges,
/// Enables UI zoom support (scaling the entire UI by a given percentage).
UIZoom,
/// Shows a confirmation dialog when cancelling an active summarization via Ctrl-C or stop.
SummarizationCancellationConfirmation,
/// Enables find/search in code review pane
CodeReviewFind,
/// Enables using Agent Mode in shared sessions.
AgentSharedSessions,
/// Enables auto-opening code review pane on first agent change and its setting UI.
AutoOpenCodeReviewPane,
/// Enables the ambient agents command-line interface.
AmbientAgentsCommandLine,
/// Feature flags for the Build Plan Auto Reload experiment.
BuildPlanAutoReloadBannerToggle,
BuildPlanAutoReloadPostPurchaseModal,
/// Enables inline code review functionality
InlineCodeReview,
/// Enables cloud environments management via CLI.
CloudEnvironments,
/// Enables the /create-environment slash command for setting up Warp Environments
CreateEnvironmentSlashCommand,
/// Enables the local docker sandbox entrypoints in the client.
LocalDockerSandbox,
/// Enables the /compact slash command.
SummarizationConversationCommand,
/// Enables the provider command for linking third-party services.
ProviderCommand,
/// Enables the integration command for managing agent integrations.
IntegrationCommand,
/// Enables the artifact command for uploading and downloading CLI artifacts.
ArtifactCommand,
/// Groups MCP tools and resources by their originating server when sending context to the AI backend.
MCPGroupedServerContext,
/// Enables the web search UI (when the model executes a web search).
WebSearchUI,
/// Enables the web fetch UI (when the model fetches content from URLs).
WebFetchUI,
/// Displays debugging IDs for MCP servers, installations, and gallery items.
McpDebuggingIds,
/// Enables rendering of images in markdown files and AI responses.
MarkdownImages,
/// Enables rendering Mermaid diagrams in markdown notebooks.
MarkdownMermaid,
/// Enables editable Mermaid diagrams to behave atomically in notebook and plan editors.
EditableMarkdownMermaid,
/// Enables rendering markdown tables in notebooks.
MarkdownTables,
/// Enables rendering markdown tables inline in AI block list responses.
BlocklistMarkdownTableRendering,
/// Enables rendering markdown images inline in AI block list responses.
BlocklistMarkdownImages,
/// Enables the /fork-from slash command.
ForkFromCommand,
/// Enables v2 of the context window usage UI.
ContextWindowUsageV2,
/// Enables global search
GlobalSearch,
/// Enables embedded code review comments.
EmbeddedCodeReviewComments,
/// Enables the revert to checkpoints feature.
RevertToCheckpoints,
/// Enables the /rewind slash command.
RewindSlashCommand,
/// Agent Management View.
AgentManagementView,
/// Agent Management Details View - enables new details panel on card click.
AgentManagementDetailsView,
/// Enables scheduled ambient agents.
ScheduledAmbientAgents,
AgentView,
/// Enables block context functionality in Agent View.
AgentViewBlockContext,
/// Enables the inline history menu for quickly accessing previous commands and conversations.
InlineHistoryMenu,
/// Enables the inline repo switcher menu for switching between indexed repos.
InlineRepoMenu,
/// Enables cloud mode functionality for ambient agents.
CloudMode,
/// Enables starting cloud mode from a local session.
CloudModeFromLocalSession,
/// Enables host selection in cloud mode.
CloudModeHostSelector,
/// Enables Warp Managed Secrets functionality.
WarpManagedSecrets,
/// Enables support for AM file diffs backed by the V4A patch format.
V4AFileDiffs,
/// Enables loading conversations in the Agent Management View.
InteractiveConversationManagementView,
/// Enables agent tips displayed below the warping indicator in Agent Mode.
AgentTips,
/// Allows agent mode to use computer use tools.
AgentModeComputerUse,
/// Enables computer use functionality in local clients.
LocalComputerUse,
/// Enables team API key creation in the API key management UI.
TeamApiKeys,
/// Enables cloud conversation loading via the CLI --conversation flag.
CloudConversations,
/// Enables the "New agent" prompt chip in terminal mode when AgentView is enabled.
///
/// When disabled (the default), the terminal message bar is shown instead.
AgentViewPromptChip,
/// Enables editing the agent input footer layout from the prompt context menu.
AgentToolbarEditor,
/// Enables configuring header toolbar item order, side placement, and visibility.
ConfigurableToolbar,
/// Enables real-time communication updates for ambient agent tasks.
AmbientAgentsRTC,
// Enables a side panel conversation list view for AgentView mode.
AgentViewConversationListView,
/// When enabled, the server will use message replacement + retroactive subtasks for
/// summarization.
SummarizationViaMessageReplacement,
/// Enables pluggable notifications via OSC 9 and OSC 777 escape sequences.
/// External programs can trigger system and in-app notifications.
PluggableNotifications,
/// Dev-only: simulate a GitHub-unauthed user in the Environments page flow.
///
/// This is intended for developer testing and should have no effect in release builds.
SimulateGithubUnauthed,
/// When enabled, profile selection is displayed in an inline view above the Agent input (e.g. via /profile).
InlineProfileSelector,
/// Enables sending the server a list of Skills that the client has access to.
///
/// If disabled, the server will send None as the SkillsContext.
ListSkills,
/// When enabled, we expose LSP as a tool to the agent
LSPAsATool,
/// Enables conversation artifacts.
ConversationArtifacts,
/// Enables auto-syncing ambient plans to Warp Drive.
SyncAmbientPlans,
/// Enables platform skills support (--skill flag) for agent runs.
///
/// Skills are loaded from `.agents/skills/`, `.warp/skills/`, `.claude/skills/`, and `.codex/skills/`
/// directories to provide base prompts for agent runs.
OzPlatformSkills,
/// Enables Oz identity federation commands.
OzIdentityFederation,
/// Gates populating/reading oz updates from channel versions in the changelog model.
OzChangelogUpdates,
/// Enables image upload for ambient agents.
AmbientAgentsImageUpload,
/// Enables image attachment support for cloud mode conversations.
CloudModeImageContext,
/// Enables loading and returning bundled skills in the SkillManager.
BundledSkills,
/// Enables the Oz launch modal for introducing cloud agent features.
OzLaunchModal,
/// Enables the OpenWarp launch modal announcing Warp going open-source.
/// When enabled, the HOA onboarding flow is suppressed.
OpenWarpLaunchModal,
/// Updated tab styling (background colors, border, close button positioning, margins).
NewTabStyling,
/// Enables file-based MCP server support via .mcp.json files in repo roots.
FileBasedMcp,
/// Enables passing user query arguments to skill invocations ($ARGUMENTS, $N).
SkillArguments,
/// When enabled, a conversation is only considered "active" once a new query has been
/// sent since opening (rather than the moment its agent view is expanded).
ActiveConversationRequiresInteraction,
/// Enables attaching conversations as context in Agent Mode via the @ menu.
ConversationsAsContext,
/// Enables the rich input editor for CLI agents (e.g., Claude Code).
/// Ctrl-G intercepts the keystroke and opens Warp's input editor instead of $EDITOR.
CLIAgentRichInput,
/// Enables incremental (diff-based) buffer updates for auto-reload instead of full replace.
IncrementalAutoReload,
/// Enables scroll position preservation in the code review pane when file
/// content changes via auto-reload.
CodeReviewScrollPreservation,
/// Enables orchestration mode (multi-agent parallel execution).
Orchestration,
/// Enables server-side durable messaging for orchestration (v2).
/// When enabled, messages and events are stored in Postgres and the client
/// opens a persistent SSE connection to the server to receive events in
/// real time.
OrchestrationV2,
/// Shows a pending user query indicator during summarization when a follow-up
/// prompt is queued via `/fork-and-compact` or `/compact-and`.
PendingUserQueryIndicator,
/// Gates the `/queue` slash command, which lets users queue a follow-up prompt
/// while the agent is mid-response.
QueueSlashCommand,
/// Enables an agent tool for the CLI subagent to explicitly transfer command control to the
/// user.
TransferControlTool,
/// Enables Kitty keyboard protocol support (CSI u encoding, progressive enhancement).
KittyKeyboardProtocol,
/// Detects the word "figma" in the terminal input in real-time and shows a
/// contextual button above the input.
FigmaDetection,
/// Enables header rows on all inline menus (label, tabs, resize handle).
InlineMenuHeaders,
/// Enables associating a tab color with a directory so tabs automatically
/// adopt the configured color when their working directory matches.
DirectoryTabColors,
/// Enables the new settings to control visibility of Warp Drive, Code Review Panel,
/// and Project Explorer & Global Search features.
OpenWarpNewSettingsModes,
/// Enables vertical tab layout as an alternative to the horizontal tab bar.
VerticalTabs,
/// Enables attaching code review comments, diff hunk, and attach as context
/// from code review + code editor for House Of Agents work
HoaCodeReview,
/// Enables the `--harness` flag for `oz agent run`, allowing external agent
/// CLIs (e.g. `claude`) to execute prompts instead of Warp's agent harness.
AgentHarness,
/// Enables workspace- and block-snapshot handoff between cloud agent runs
/// and the local Warp client.
/// When enabled:
/// - The `AgentDriver` uploads a workspace snapshot (repo diffs + files) at the end of every
/// cloud agent run, regardless of harness.
/// - Subsequent executions download the prior execution's handoff snapshot attachments.
/// - Third-party harness conversations hydrate their terminal output inline by fetching a
/// block snapshot from the server.
OzHandoff,
/// Enables the upgraded CLI agent session tracking and notifications infrastructure.
HOANotifications,
/// Enables the install/update chip for the OpenCode Warp plugin.
/// Requires HOANotifications to also be enabled.
OpenCodeNotifications,
/// Enables the install/update chip for the Codex Warp notification plugin.
/// Requires HOANotifications to also be enabled.
CodexNotifications,
/// Enables the install/update chip for the Gemini CLI Warp extension.
/// Requires HOANotifications to also be enabled.
GeminiNotifications,
/// When enabled, the "Skip for now" login flow does not create a Firebase
/// anonymous user. The user remains fully logged out (no credentials) and
/// login-gated features are disabled until they sign in.
SkipFirebaseAnonymousUser,
/// Enables tab configs — user-definable TOML templates for launching custom tab layouts.
TabConfigs,
/// When enabled, free-tier users are blocked from AI features (no-AI experiment arm).
FreeUserNoAi,
/// Enables the ask_user_question tool allowing the agent to ask clarifying questions.
AskUserQuestion,
/// When enabled, solo users (not on a team) can use BYO API keys.
SoloUserByok,
/// Replaces the in-block warpification banner with a warpify footer.
WarpifyFooter,
/// Enables conversation retrieval via the CLI (oz run conversation get, oz run get --conversation).
ConversationApi,
/// Guided onboarding flow for existing users introducing HOA features
/// (vertical tabs, agent inbox, tab configs).
HOAOnboardingFlow,
/// Enables commit, push, and create-PR actions in the code review panel.
GitOperationsInCodeReview,
/// Gates the remote control chip and `/remote-control` slash command in the CLI agent footer.
HOARemoteControl,
/// Trims trailing blank rows from CLI agent block output so unused vertical
/// space is not rendered while the agent is running.
TrimTrailingBlankLines,
/// Gates the new SSH remote server flow that installs and connects to a
/// persistent binary on the remote machine instead of using ControlMaster
/// for command execution.
SshRemoteServer,
/// Redux of the setup/initial user query UI for cloud mode.
CloudModeSetupV2,
/// Enables summary mode in vertical tabs, showing condensed tab summaries
/// instead of individual pane rows.
VerticalTabsSummaryMode,
CloudModeInputV2,
}
static FLAG_STATES: [AtomicBool; cardinality::<FeatureFlag>()] =
[const { AtomicBool::new(false) }; { cardinality::<FeatureFlag>() }];
/// This map is populated by UserPreferences, which take precedence
/// over the global feature flag state.
static USER_PREFERENCE_MAP: [AtomicTriState; cardinality::<FeatureFlag>()] =
[const { AtomicTriState::new() }; { cardinality::<FeatureFlag>() }];
/// Flag for whether or not feature flags have been globally initialized. Outside
/// of tests, this ensures that feature flags are only used after they're set
/// up by the app's `run_internal` function.
#[cfg(debug_assertions)]
static FEATURES_INITIALIZED: AtomicBool = AtomicBool::new(false);
/// Features used in debugging.
pub const DEBUG_FLAGS: &[FeatureFlag] = &[FeatureFlag::DebugMode, FeatureFlag::RuntimeFeatureFlags];
/// Features enabled for the development team. The expectation is that, over
/// time, these will move on to PREVIEW_FLAGS before being launched.
pub const DOGFOOD_FLAGS: &[FeatureFlag] = &[
FeatureFlag::LogExpensiveFramesInSentry,
FeatureFlag::ToggleBootstrapBlock,
FeatureFlag::CreatingSharedSessions,
FeatureFlag::RemoveAutosuggestionDuringTabCompletions,
FeatureFlag::ResizeFix,
FeatureFlag::AgentModeWorkflows,
#[cfg(not(windows))]
FeatureFlag::SSHTmuxWrapper,
FeatureFlag::AgentModeAnalytics,
FeatureFlag::LazySceneBuilding,
FeatureFlag::SshDragAndDrop,
FeatureFlag::MultiWorkspace,
FeatureFlag::ImeMarkedText,
FeatureFlag::MSYS2Shells,
FeatureFlag::RetryTruncatedCodeResponses,
FeatureFlag::ContextLineReviewComments,
FeatureFlag::RunGeneratorsWithCmdExe,
FeatureFlag::NLDClassifierModelEnabled,
FeatureFlag::Projects,
FeatureFlag::ProviderCommand,
FeatureFlag::ArtifactCommand,
FeatureFlag::MarkdownImages,
FeatureFlag::FileAndDiffSetComments,
FeatureFlag::FileGlobV2Warnings,
FeatureFlag::SummarizationViaMessageReplacement,
FeatureFlag::LocalComputerUse,
FeatureFlag::OzPlatformSkills,
FeatureFlag::AgentViewBlockContext,
FeatureFlag::OzLaunchModal,
FeatureFlag::OzChangelogUpdates,
FeatureFlag::PendingUserQueryIndicator,
FeatureFlag::QueueSlashCommand,
// These are enabled via 100% experiment on prod warp-server,
// but we need to enable here for dogfood builds.
FeatureFlag::CrossRepoContext,
FeatureFlag::CodebaseIndexPersistence,
FeatureFlag::FullSourceCodeEmbedding,
FeatureFlag::CodebaseIndexSpeedbump,
// End manually enabled Code features.
FeatureFlag::DirectoryTabColors,
FeatureFlag::EditableMarkdownMermaid,
FeatureFlag::CodeReviewScrollPreservation,
FeatureFlag::OzIdentityFederation,
FeatureFlag::AgentHarness,
FeatureFlag::OzHandoff,
FeatureFlag::ConversationApi,
FeatureFlag::RememberFastForwardState,
FeatureFlag::HOANotifications,
FeatureFlag::OrchestrationV2,
FeatureFlag::GeminiNotifications,
FeatureFlag::LocalDockerSandbox,
FeatureFlag::VerticalTabsSummaryMode,
FeatureFlag::CloudModeSetupV2,
];
/// Features enabled for feature preview build users (e.g.: Friends of Warp).
/// All PREVIEW_FLAGS are also automatically added to dogfood builds (WarpDev).
pub const PREVIEW_FLAGS: &[FeatureFlag] = &[
FeatureFlag::Orchestration,
FeatureFlag::BlocklistMarkdownTableRendering,
FeatureFlag::BlocklistMarkdownImages,
FeatureFlag::MarkdownTables,
FeatureFlag::OzIdentityFederation,
// Remote server binary is not yet supported on Windows.
#[cfg(not(windows))]
FeatureFlag::SshRemoteServer,
FeatureFlag::GitOperationsInCodeReview,
];
/// Features enabled for all release builds (i.e.: everything but WarpLocal).
/// NOTE: if you are promoting a feature from Preview to launch, you'll likely
/// want to enable the feature by default in app/Cargo.toml, rather than add it to RELEASE_FLAGS.
pub const RELEASE_FLAGS: &[FeatureFlag] = &[
FeatureFlag::Autoupdate,
FeatureFlag::Changelog,
FeatureFlag::CrashReporting,
// Marked text is currently only supported on MacOS.
#[cfg(target_os = "macos")]
FeatureFlag::ImeMarkedText,
];
/// Flags that we want to allow to switch at runtime (assuming RuntimeFeatureFlags is set)
pub const RUNTIME_FEATURE_FLAGS: &[FeatureFlag] = &[];
impl FeatureFlag {
pub fn is_enabled(&self) -> bool {
#[cfg(all(debug_assertions, not(feature = "test-util")))]
{
use std::sync::atomic::Ordering;
assert!(
FEATURES_INITIALIZED.load(Ordering::Relaxed),
"Tried to check FeatureFlag::{self:?} before feature flags were initialized"
);
}
overrides::get_override(*self)
.or(USER_PREFERENCE_MAP[*self as usize].get())
.or(Some(FLAG_STATES[*self as usize].load(Ordering::Relaxed)))
.unwrap_or(false)
}
#[allow(dead_code)]
pub fn set_enabled(self, enabled: bool) {
// Allow calling this in integration tests because we sometimes use it in the app
// during flows that integration tests cover.
if cfg!(test) && cfg!(not(feature = "integration_tests")) {
panic!("Tried to globally enable {self:?} in a test. Use FeatureFlag::{self:?}.override_enabled instead");
}
FLAG_STATES[self as usize].store(enabled, Ordering::Relaxed);
}
/// Sets a user preference for this flag. User preferences take precedence
/// over the global feature flag state, and can be used to allow explicit opt-in
/// and explicit opt-out behavior.
pub fn set_user_preference(self, enabled: bool) {
USER_PREFERENCE_MAP[self as usize].set(enabled);
}
/// Sets a thread-local test override for this flag. The override lasts
/// until the returned guard is dropped.
///
/// **Warning**: overrides do not work for tests of multi-threaded code. If
/// you need to test multi-threaded code that's behind a feature flag, you'll
/// need to set an override in _each_ thread.
///
/// Tests should create overrides early on and allow them to be
/// dropped automatically when they finish. This keeps overrides scoped to
/// the duration of the test, since Rust doesn't have test lifecycle hooks.
#[cfg(feature = "test-util")]
pub fn override_enabled(self, enabled: bool) -> overrides::OverrideGuard {
overrides::override_flag(self, enabled)
}
pub fn flag_description(&self) -> Option<&'static str> {
use FeatureFlag::*;
// Note: many feature flags are purposefully omitted from this list, in order to avoid blowing up
// the Preview changelog. Features below which are enabled for Preview via PREVIEW_FLAGS, will be added to the changelog.
// Features which are added to Stable should ideally have their feature flag removed entirely, but at the
// very least, the feature flag should be removed from the Preview changelog by removing it from PREVIEW_FLAGS.
// ** ONLY Preview-exclusive features should be added to this list! **
match self {
AgentSharedSessions => {
Some("Enables viewing agent conversations within shared sessions.")
}
CodeReviewFind => Some("Enables the find bar in the code review pane."),
BlocklistMarkdownImages => {
Some("Enables rendering markdown images inline in AI block list responses.")
}
CloudEnvironments => Some("Enables creating and managing Warp Environments via the CLI."),
CreateEnvironmentSlashCommand => Some("Enables the /create environment slash command for setting up Warp Environments with custom configurations."),
GlobalSearch => Some("Enables global search in the left panel"),
BlocklistMarkdownTableRendering => {
Some("Enables rendering markdown tables inline in AI block list responses.")
}
MarkdownTables => Some("Enables rendering and interaction support for markdown tables in notebooks."),
OzIdentityFederation => Some("Enables automatic authentication from Oz to AWS and GCP"),
SettingsFile => Some("Enables configuring Warp via a user-editable `settings.toml` file, with hot reload and error reporting for invalid values."),
GitOperationsInCodeReview => Some("Enables commit, push, and create-PR actions directly from the code review panel."),
_ => None,
}
}
}
/// Marks that feature flags have been globally initialized.
pub fn mark_initialized() {
#[cfg(debug_assertions)]
FEATURES_INITIALIZED.store(true, std::sync::atomic::Ordering::Relaxed);
}
#[cfg(not(feature = "test-util"))]
mod overrides {
#[inline(always)]
pub fn get_override(_flag: super::FeatureFlag) -> Option<bool> {
None
}
}
/// Thread-local feature flag overrides for unit tests. For isolation, tests
/// should use overrides instead of globally modifying flags with [`super::FeatureFlag::set_enabled`].
#[cfg(feature = "test-util")]
mod overrides {
use std::{cell::RefCell, collections::HashMap};
use super::FeatureFlag;
thread_local! {
static FLAG_OVERRIDES: RefCell<HashMap<FeatureFlag,bool>> = RefCell::new(HashMap::new());
}
/// RAII guard to set feature flag overrides in tests. When the guard is
/// dropped, it reverts to the global flag state.
#[must_use = "if unused the override will be immediately cleared"]
pub struct OverrideGuard {
flag: FeatureFlag,
}
/// Gets the overridden state for a flag, if set.
pub fn get_override(flag: FeatureFlag) -> Option<bool> {
FLAG_OVERRIDES.with(|overrides| overrides.borrow().get(&flag).copied())
}
/// Gets the set of overridden flags.
pub fn get_overrides() -> HashMap<FeatureFlag, bool> {
FLAG_OVERRIDES.with(|overrides| overrides.borrow().clone())
}
/// Applies a set of overrides.
///
/// This is intended to be used with [`get_overrides`] to apply a set of
/// existing overrides to a newly-spawned thread. If you are trying to
/// override a single feature flag, use [`FeatureFlag::override_enabled`]
/// instead.
pub fn set_overrides(new_overrides: HashMap<FeatureFlag, bool>) {
FLAG_OVERRIDES.with(|overrides| *overrides.borrow_mut() = new_overrides);
}
/// Set a thread-local override for a flag.
pub fn override_flag(flag: FeatureFlag, enabled: bool) -> OverrideGuard {
set_override(flag, enabled);
OverrideGuard { flag }
}
fn set_override(flag: FeatureFlag, enabled: bool) {
FLAG_OVERRIDES.with(|overrides| {
let previous = overrides.borrow_mut().insert(flag, enabled);
// We could support nested overrides, but it requires some care around
// out-of-order drops - if overrides are set and then cleared out of
// order, what should the state after each drop be?
if previous.is_some() {
panic!("Multiple overrides set for {flag:?}");
}
});
}
fn clear_override(flag: FeatureFlag) {
FLAG_OVERRIDES.with(|overrides| {
let previous = overrides.borrow_mut().remove(&flag);
if previous.is_none() {
panic!("Cleared override for {flag:?}, but none was set");
}
});
}
impl Drop for OverrideGuard {
fn drop(&mut self) {
clear_override(self.flag);
}
}
}
/// An atomic tri-state value.
///
/// This is initally unset, and can be set to a true or false value.
///
/// Writes and reads use [`Ordering::Relaxed`], so should not be used for
/// synchronization.
struct AtomicTriState(AtomicU8);
impl AtomicTriState {
const fn new() -> Self {
Self(AtomicU8::new(TriState::Unset as u8))
}
fn get(&self) -> Option<bool> {
TriState::from(self.0.load(Ordering::Relaxed)).into()
}
fn set(&self, value: bool) {
self.0.store(TriState::from(value) as u8, Ordering::Relaxed);
}
}
/// A simple enum representing a tristate, to be used as the backing type
/// for [`AtomicTriState`].
enum TriState {
Unset = 0,
False = 1,
True = 2,
}
impl From<bool> for TriState {
fn from(value: bool) -> Self {
if value {
TriState::True
} else {
TriState::False
}
}
}
impl From<u8> for TriState {
fn from(value: u8) -> Self {
match value {
0 => TriState::Unset,
1 => TriState::False,
2 => TriState::True,
_ => unreachable!(),
}
}
}
impl From<TriState> for Option<bool> {
fn from(value: TriState) -> Self {
match value {
TriState::Unset => None,
TriState::False => Some(false),
TriState::True => Some(true),
}
}
}
#[cfg(test)]
#[path = "features_test.rs"]
mod tests;