From 17ecf67970476b503d213673f46f1f28ab087165 Mon Sep 17 00:00:00 2001 From: Ryan Ward Date: Wed, 3 Jun 2026 01:47:36 -0500 Subject: [PATCH] Enable DOGFOOD_FLAGS for OSS and add fix-it suggestion for failed commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two changes addressing agent context visibility and error recovery: 1. Enable DOGFOOD_FLAGS in oss.rs — this activates AgentViewBlockContext, which auto-attaches user-executed command output (stdout/stderr/exit code) to the AI conversation context. Previously the LLM was blind to any commands the user ran via `!` prefix in agent view. 2. Add instant "Fix this error" prompt suggestion when a user-run command fails (non-zero exit) in agent view. This lets users hand off errors to the agent with one click instead of manually copy-pasting output. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../ai/blocklist/passive_suggestions/maa.rs | 33 +++++++++++++++++++ app/src/bin/oss.rs | 1 + 2 files changed, 34 insertions(+) diff --git a/app/src/ai/blocklist/passive_suggestions/maa.rs b/app/src/ai/blocklist/passive_suggestions/maa.rs index c92ea4cc..3a2b31ea 100644 --- a/app/src/ai/blocklist/passive_suggestions/maa.rs +++ b/app/src/ai/blocklist/passive_suggestions/maa.rs @@ -304,6 +304,39 @@ impl PassiveSuggestionsModel { if is_oz_environment_startup_command { return; } + + // When a user-run command fails in agent view, offer an instant "fix it" + // suggestion so the user can hand off the error to the agent. + if FeatureFlag::AgentViewBlockContext.is_enabled() + && !block_completed.was_part_of_agent_interaction + && !block_completed.serialized_block.exit_code.was_successful() + && !block_completed.command.trim().is_empty() + { + let conversation_id = self + .terminal_model + .lock() + .block_list() + .block_at(block_completed.index) + .and_then(|block| { + block + .agent_view_visibility() + .agent_view_conversation_id() + }); + + let prompt = format!( + "The command `{}` failed. Diagnose the error and suggest a fix.", + block_completed.command.trim() + ); + ctx.emit(PassiveSuggestionsEvent::NewPromptSuggestion { + prompt, + label: Some("Fix this error".to_string()), + request_duration_ms: 0, + trigger: None, + conversation_id, + server_request_token: None, + }); + } + let is_prompt_suggestions_enabled = is_prompt_suggestions_enabled(ctx); let is_passive_code_diffs_enabled = is_passive_code_diffs_enabled(ctx); if !is_prompt_suggestions_enabled && !is_passive_code_diffs_enabled { diff --git a/app/src/bin/oss.rs b/app/src/bin/oss.rs index 3dcd55b4..e14b94c5 100644 --- a/app/src/bin/oss.rs +++ b/app/src/bin/oss.rs @@ -24,6 +24,7 @@ fn main() -> Result<()> { mcp_static_config: None, }, ); + state = state.with_additional_features(galaxy_core::features::DOGFOOD_FLAGS); if cfg!(debug_assertions) { state = state.with_additional_features(galaxy_core::features::DEBUG_FLAGS); }