File bug directly (#6413)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Douwe Osinga
2026-01-12 12:13:01 -05:00
committed by GitHub
parent 26c5a6c1dd
commit 5a460fd3b1
10 changed files with 359 additions and 112 deletions
+64 -13
View File
@@ -1,30 +1,81 @@
use crate::config::base::Config;
use crate::config::extensions::get_enabled_extensions;
use crate::config::paths::Paths;
use crate::providers::utils::LOGS_TO_KEEP;
use crate::session::SessionManager;
use serde::{Deserialize, Serialize};
use std::fs::{self};
use std::io::Cursor;
use std::io::Write;
use utoipa::ToSchema;
use zip::write::FileOptions;
use zip::ZipWriter;
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct SystemInfo {
pub app_version: String,
pub os: String,
pub os_version: String,
pub architecture: String,
pub provider: Option<String>,
pub model: Option<String>,
pub enabled_extensions: Vec<String>,
}
impl SystemInfo {
pub fn collect() -> Self {
let config = Config::global();
let provider = config.get_goose_provider().ok();
let model = config.get_goose_model().ok();
let enabled_extensions = get_enabled_extensions()
.into_iter()
.map(|ext| ext.name().to_string())
.collect();
Self {
app_version: env!("CARGO_PKG_VERSION").to_string(),
os: std::env::consts::OS.to_string(),
os_version: sys_info::os_release().unwrap_or_else(|_| "unknown".to_string()),
architecture: std::env::consts::ARCH.to_string(),
provider,
model,
enabled_extensions,
}
}
pub fn to_text(&self) -> String {
format!(
"App Version: {}\n\
OS: {}\n\
OS Version: {}\n\
Architecture: {}\n\
Provider: {}\n\
Model: {}\n\
Enabled Extensions: {}\n\
Timestamp: {}\n",
self.app_version,
self.os,
self.os_version,
self.architecture,
self.provider.as_deref().unwrap_or("unknown"),
self.model.as_deref().unwrap_or("unknown"),
self.enabled_extensions.join(", "),
chrono::Utc::now().to_rfc3339()
)
}
}
pub fn get_system_info() -> SystemInfo {
SystemInfo::collect()
}
pub async fn generate_diagnostics(session_id: &str) -> anyhow::Result<Vec<u8>> {
let logs_dir = Paths::in_state_dir("logs");
let config_dir = Paths::config_dir();
let config_path = config_dir.join("config.yaml");
let data_dir = Paths::data_dir();
let system_info = format!(
"App Version: {}\n\
OS: {}\n\
OS Version: {}\n\
Architecture: {}\n\
Timestamp: {}\n",
env!("CARGO_PKG_VERSION"),
std::env::consts::OS,
sys_info::os_release().unwrap_or_else(|_| "unknown".to_string()),
std::env::consts::ARCH,
chrono::Utc::now().to_rfc3339()
);
let system_info = SystemInfo::collect();
let mut buffer = Vec::new();
{
@@ -55,7 +106,7 @@ pub async fn generate_diagnostics(session_id: &str) -> anyhow::Result<Vec<u8>> {
}
zip.start_file("system.txt", options)?;
zip.write_all(system_info.as_bytes())?;
zip.write_all(system_info.to_text().as_bytes())?;
let schedule_json = data_dir.join("schedule.json");
if schedule_json.exists() {
+1 -1
View File
@@ -4,6 +4,6 @@ pub mod extension_data;
mod legacy;
pub mod session_manager;
pub use diagnostics::generate_diagnostics;
pub use diagnostics::{generate_diagnostics, get_system_info, SystemInfo};
pub use extension_data::{EnabledExtensionsState, ExtensionData, ExtensionState, TodoState};
pub use session_manager::{Session, SessionInsights, SessionManager, SessionType};