Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/src/terminal/model/kitty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use base64::Engine;
use flate2::read::ZlibDecoder;
use pathfinder_geometry::vector::Vector2F;
use rand::Rng;
#[cfg(feature = "local_fs")]
use warp_errors::report_error;
use warpui::assets::asset_cache::Asset;
use warpui::image_cache::{
resize_dimensions, CustomHeaderCreationError, CustomImageFormat, CustomImageHeader, FitType,
Expand All @@ -18,6 +16,8 @@ use warpui::image_cache::{
use warpui::util::{parse_i32, parse_u32};

use super::escape_sequences::C1;
#[cfg(feature = "local_fs")]
use crate::safe_warn;

/// Actions specified by the [Kitty Image Protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/)
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -764,9 +764,9 @@ fn read_file(decoded_payload: Vec<u8>, is_temp: bool) -> Result<Vec<u8>, Invalid
fn safe_delete_temp_file(path: &str) {
if is_path_in_temp_dir(path) && path.contains("tty-graphics-protocol") {
if let Err(err) = fs::remove_file(path) {
report_error!(
anyhow::Error::new(err).context("Failed to delete kitty temporary file"),
extra: { "path" => %path }
safe_warn!(
safe: ("Failed to delete kitty temporary file"),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!safe_warn!. Per logging-and-error-reporting, report_error! is reserved for actionable failures where our code is wrong. fs::remove_file failing to clean up a kitty temp file is an external filesystem error we can't fix, and it's best-effort/handled (the sibling shm_unlink path just below already logs the same class at warn!) — "non-ideal but expected" = warn!. Used safe_warn! because warn breadcrumbs are uploaded to Sentry and the temp path is user-controlled, so the path only appears in the dogfood-only full: arm.

full: ("Failed to delete kitty temporary file (path = {path}): {err:#}")
);
}
}
Expand Down
14 changes: 9 additions & 5 deletions app/src/terminal/model/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ use itertools::Itertools;
use lazy_static::lazy_static;
use parking_lot::Mutex;
use rangemap::{RangeInclusiveMap, StepLite};
use warp_errors::report_error;
use warpui::elements::SecretRange;
use warpui::EntityId;

use super::grid::grid_handler::GridHandler;
use super::grid::{Dimensions as _, RespectDisplayedOutput};
use super::terminal_model::RangeInModel;
use crate::ai::blocklist::TextLocation;
use crate::safe_warn;
use crate::terminal::model::find::RegexDFAs;
use crate::terminal::model::index::Point;

Expand Down Expand Up @@ -377,8 +377,10 @@ pub fn set_user_and_enterprise_secret_regexes<'a>(
let dfas = match RegexDFAs::new_many(&all_secrets, false, true) {
Ok(dfas) => dfas,
Err(err) => {
report_error!(anyhow::Error::new(err)
.context("Failed to construct new RegexDFA with combined secrets"));
safe_warn!(
safe: ("Failed to construct new RegexDFA with combined secrets"),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!safe_warn!. The DFA fails to build only when the combined user/enterprise secret regexes can't compile (size/complexity limits) — bad external config, not an our-code bug, and gracefully handled (the previous regexes are kept, per the fn doc). That's the skill's warn! case (recoverable/handled). safe_warn! because err can embed the offending regex pattern and warn breadcrumbs ship to Sentry — the pattern stays in the dogfood-only full: arm.

full: ("Failed to construct new RegexDFA with combined secrets: {err:#}")
);
return;
}
};
Expand All @@ -392,8 +394,10 @@ pub fn set_user_and_enterprise_secret_regexes<'a>(
},
},
Err(err) => {
report_error!(anyhow::Error::new(err)
.context("Failed to construct new Regex with combined secrets"));
safe_warn!(
safe: ("Failed to construct new Regex with combined secrets"),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reasoning as the RegexDFA case above: a failure to build the combined secret regex is external config, gracefully handled (old regexes retained), so warn! per the skill. safe_warn! keeps the potentially-sensitive pattern in err out of the Sentry-uploaded breadcrumb (dogfood-only full: arm).

full: ("Failed to construct new Regex with combined secrets: {err:#}")
);
return;
}
};
Expand Down
10 changes: 5 additions & 5 deletions app/src/terminal/model/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,9 @@ impl Sessions {
if let Some(in_band_command_output_tx) = self.in_band_command_output_tx_map.get(&session_id)
{
if let Err(e) = in_band_command_output_tx.try_send(event) {
report_error!(anyhow::Error::new(e).context(
"Failed to send ExecutedExecutorCommandEvent to InBandCommandExecutor"
));
log::warn!(
"Failed to send ExecutedExecutorCommandEvent to InBandCommandExecutor: {e:#}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!log::warn!. try_send failing here means the receiving InBandCommandExecutor channel is gone — a teardown/race, not a bug. Per the skill, channel-teardown/handled conditions are warn!, not Sentry-worthy. The error is a channel SendError with no sensitive payload, so plain log::warn!.

);
}
}
}
Expand Down Expand Up @@ -740,7 +740,7 @@ impl SessionInfo {
}
}
Err(e) => {
warp_errors::report_error!(e);
log::warn!("Failed to get local hostname when determining session type: {e:#}");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!log::warn!. get_local_hostname() failing is an environmental/system error (not our bug) and is handled with a fallback (default to Local) — the skill's warn! case. The error is a failure to read the hostname, so it doesn't carry the hostname value; plain log::warn! is safe.

BootstrapSessionType::Local
}
}
Expand Down Expand Up @@ -1560,7 +1560,7 @@ impl Session {
)
}
CommandExitStatus::Failure => {
report_error!("Failed to parse history file from file");
log::warn!("Failed to parse history file from file");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!log::warn!. A cat of the history file failing on a remote session is an expected external condition (missing file / permissions), already handled by returning None. Per the skill that's warn!, not an actionable engineering issue. Static message, no interpolated data.

None
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use async_trait::async_trait;
use parking_lot::{Mutex, MutexGuard};
use warp_completer::completer::{CommandExitStatus, CommandOutput};
use warp_core::command::ExitCode;
use warp_errors::report_error;
use warp_terminal::model::Point;
use warp_util::on_cancel::OnCancelFutureExt;
use warpui::r#async::block_on;
Expand Down Expand Up @@ -226,9 +225,9 @@ impl InBandCommandExecutor {
}
};
if let Err(error) = output_tx.try_send(command_output) {
report_error!(anyhow::Error::new(error).context(
"Error occurred when sending generator command output"
));
log::warn!(
"Error occurred when sending generator command output: {error}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!log::warn!. try_send of generator output failing (right after an is_closed() check) is a receiver-drop race/teardown, not a bug — this matches the sibling warn! a few lines up for the exact same operation. Per the skill, teardown/handled conditions are warn!. No sensitive data.

);
}
}
}
Expand Down
18 changes: 11 additions & 7 deletions app/src/terminal/model/terminal_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ use super::session::{BootstrapSessionType, InBandCommandOutputReceiver, SessionI
use super::{Secret, SecretHandle};
use crate::ai::ambient_agents::AmbientAgentTaskId;
use crate::ai::blocklist::SerializedBlockListItem;
use crate::safe_warn;
use crate::terminal::available_shells::AvailableShell;
use crate::terminal::block_filter::BlockFilterQuery;
use crate::terminal::block_list_element::GridType;
Expand Down Expand Up @@ -3016,7 +3017,7 @@ impl ansi::Handler for TerminalModel {
// Not being able to read the value should not cause a full-app crash. Instead,
// bootstrapping should fail in the same way that it would if the DCS message
// were otherwise corrupted.
report_error!("Received bootstrap message with no pending session info.");
log::warn!("Received bootstrap message with no pending session info.");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!log::warn!. Per the adjacent comment, a bootstrap DCS arriving with no pending session info is treated the same as a corrupted DCS message — unexpected external input, gracefully handled by returning. Not an our-code bug, so warn! per the skill. Static message.

return;
}
};
Expand Down Expand Up @@ -3162,9 +3163,9 @@ impl ansi::Handler for TerminalModel {
uname: data.uname,
}))
}
None => report_error!(
"Received invalid shell name in init_subshell",
extra: { "shell" => %data.shell }
None => safe_warn!(
safe: ("Received invalid shell name in init_subshell"),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!safe_warn!. An unparseable shell name comes from the terminal DCS payload (external/untrusted input) and is handled gracefully — the skill's warn! case, not actionable. data.shell is DCS-supplied and warn breadcrumbs ship to Sentry, so it appears only in the dogfood-only full: arm.

full: ("Received invalid shell name in init_subshell: {}", data.shell)
),
}
}
Expand All @@ -3186,9 +3187,12 @@ impl ansi::Handler for TerminalModel {
))
}
None => {
report_error!(
"Received invalid shell name in SourcedRCFileForWarpValue",
extra: { "shell" => %data.shell }
safe_warn!(
safe: ("Received invalid shell name in SourcedRCFileForWarpValue"),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the init_subshell case above: an invalid shell name in the sourced-rc-file DCS is external/untrusted input, handled gracefully → warn!. safe_warn! keeps the DCS-supplied data.shell out of the Sentry breadcrumb (dogfood-only full: arm).

full: (
"Received invalid shell name in SourcedRCFileForWarpValue: {}",
data.shell
)
);
}
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/terminal/writeable_pty/command_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::sync::mpsc::SyncSender;
use std::sync::Arc;

use parking_lot::FairMutex;
use warp_errors::report_error;
use warpui::{AppContext, ModelHandle, SingletonEntity};

use crate::persistence::{ModelEvent, StartedCommandMetadata};
Expand Down Expand Up @@ -69,7 +68,7 @@ pub fn update_command_history(
.spawn(async move {
// Sending over a sync sender can block the current thread, so we do this async.
if let Err(e) = sender_clone.send(insert_command_event) {
report_error!(anyhow::Error::new(e).context("Error sending ModelEvent"));
log::warn!("Error sending ModelEvent: {e:#}");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!log::warn!. Sending the ModelEvent fails only when the receiver has been dropped (shutdown/teardown) — expected, not our bug. Per the skill that's warn!, not Sentry-worthy. The SendError Display carries no sensitive data.

}
})
.detach();
Expand Down
4 changes: 1 addition & 3 deletions app/src/terminal/writeable_pty/pty_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ use std::sync::Arc;
use async_channel::{Receiver, Sender};
use parking_lot::FairMutex;
use thiserror::Error;
#[cfg(feature = "local_fs")]
use warp_errors::report_error;
use warp_util::path::ShellFamily;
use warpui::r#async::block_on;
use warpui::{Entity, ModelContext, ModelHandle, SingletonEntity};
Expand Down Expand Up @@ -429,7 +427,7 @@ impl<T: EventLoopSender> PtyController<T> {
self.source_bootstrap_script(path, shell_type, ctx);
} else {
self.write_terminating_bootstrap_bytes(ctx);
report_error!("Could not convert bootstrap script file path to str");
log::warn!("Could not convert bootstrap script file path to str");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demotion report_error!log::warn!. This is an already-handled fallback path — we fall back to write_terminating_bootstrap_bytes when the bootstrap-file path can't be converted to a str (an env/OS edge case, not a bug). Per the skill, expected fallback paths belong at warn!, not report_error!. Static message.

}

self.bootstrap_file = Some(file);
Expand Down
Loading