storkit: merge 463_story_configurable_rate_limit_notification_suppression
This commit is contained in:
@@ -36,6 +36,12 @@ pub struct ProjectConfig {
|
||||
/// When not set, the system falls back to `detect_base_branch` (reads current HEAD).
|
||||
#[serde(default)]
|
||||
pub base_branch: Option<String>,
|
||||
/// Whether to send `RateLimitWarning` chat notifications.
|
||||
/// Set to `false` to suppress noisy soft rate-limit warnings while still
|
||||
/// receiving `RateLimitHardBlock` and `StoryBlocked` notifications.
|
||||
/// Default: `true`.
|
||||
#[serde(default = "default_rate_limit_notifications")]
|
||||
pub rate_limit_notifications: bool,
|
||||
}
|
||||
|
||||
/// Configuration for the filesystem watcher's sweep behaviour.
|
||||
@@ -79,6 +85,10 @@ fn default_max_retries() -> u32 {
|
||||
2
|
||||
}
|
||||
|
||||
fn default_rate_limit_notifications() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[allow(dead_code)]
|
||||
pub struct ComponentConfig {
|
||||
@@ -172,6 +182,8 @@ struct LegacyProjectConfig {
|
||||
max_retries: u32,
|
||||
#[serde(default)]
|
||||
base_branch: Option<String>,
|
||||
#[serde(default = "default_rate_limit_notifications")]
|
||||
rate_limit_notifications: bool,
|
||||
}
|
||||
|
||||
impl Default for ProjectConfig {
|
||||
@@ -199,6 +211,7 @@ impl Default for ProjectConfig {
|
||||
max_coders: None,
|
||||
max_retries: default_max_retries(),
|
||||
base_branch: None,
|
||||
rate_limit_notifications: default_rate_limit_notifications(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -245,6 +258,7 @@ impl ProjectConfig {
|
||||
max_coders: legacy.max_coders,
|
||||
max_retries: legacy.max_retries,
|
||||
base_branch: legacy.base_branch,
|
||||
rate_limit_notifications: legacy.rate_limit_notifications,
|
||||
};
|
||||
validate_agents(&config.agent)?;
|
||||
return Ok(config);
|
||||
@@ -270,6 +284,7 @@ impl ProjectConfig {
|
||||
max_coders: legacy.max_coders,
|
||||
max_retries: legacy.max_retries,
|
||||
base_branch: legacy.base_branch,
|
||||
rate_limit_notifications: legacy.rate_limit_notifications,
|
||||
};
|
||||
validate_agents(&config.agent)?;
|
||||
Ok(config)
|
||||
@@ -283,6 +298,7 @@ impl ProjectConfig {
|
||||
max_coders: legacy.max_coders,
|
||||
max_retries: legacy.max_retries,
|
||||
base_branch: legacy.base_branch,
|
||||
rate_limit_notifications: legacy.rate_limit_notifications,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -946,6 +962,28 @@ prompt = "git difftool {{base_branch}}...HEAD"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rate_limit_notifications_defaults_to_true() {
|
||||
let toml_str = r#"
|
||||
[[agent]]
|
||||
name = "coder"
|
||||
"#;
|
||||
let config = ProjectConfig::parse(toml_str).unwrap();
|
||||
assert!(config.rate_limit_notifications, "rate_limit_notifications should default to true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rate_limit_notifications_can_be_disabled() {
|
||||
let toml_str = r#"
|
||||
rate_limit_notifications = false
|
||||
|
||||
[[agent]]
|
||||
name = "coder"
|
||||
"#;
|
||||
let config = ProjectConfig::parse(toml_str).unwrap();
|
||||
assert!(!config.rate_limit_notifications);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_toml_has_three_sonnet_coders() {
|
||||
let manifest_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
|
||||
|
||||
Reference in New Issue
Block a user