on main help sign in
feat: now added warn for disk size mismatch
commita4b9d628731020bfec03ee65a14d77167335e646 authorrobcholz <84130577+robcholz@users.noreply.github.com> dateSat 7 Feb 2026, 23:16 (8 months ago) parent727adff
2 files changed+26−5
src/bin/vibebox.rs+24−3 src/session_manager.rs+2−2
src/bin/vibebox.rs+24−3
@@ -49,7 +49,7 @@ fn main() -> Result<()> {
4949 let stderr_handle = init_tracing(&cwd);
5050
5151 let cli = Cli::parse();
52− tracing::info!(cwd = %cwd.display(), "starting vibebox cli");
52+ tracing::debug!(cwd = %cwd.display(), "starting vibebox cli");
5353 if let Some(command) = cli.command {
5454 return handle_command(command, &cwd, cli.config.as_deref());
5555 }
@@ -85,7 +85,6 @@ fn main() -> Result<()> {
8585 no_default_mounts: false,
8686 mounts: config.box_cfg.mounts.clone(),
8787 };
88−
8988 let auto_shutdown_ms = config.supervisor.auto_shutdown_ms;
9089 let vm_info = VmInfo {
9190 max_memory_mb: vm_args.ram_bytes / (1024 * 1024),
@@ -113,6 +112,7 @@ fn main() -> Result<()> {
113112 writeln!(stdout)?;
114113 stdout.flush()?;
115114 }
115+ warn_disk_size_mismatch(&cwd, vm_args.disk_bytes);
116116 if let Some(handle) = stderr_handle {
117117 let _ = handle.modify(|filter| *filter = LevelFilter::INFO);
118118 }
@@ -354,6 +354,27 @@ fn format_last_active(value: Option<&str>) -> String {
354354 format!("{} day{} ago", days, if days == 1 { "" } else { "s" })
355355}
356356
357+fn warn_disk_size_mismatch(cwd: &Path, configured_bytes: u64) {
358+ let instance_raw = cwd
359+ .join(session_manager::INSTANCE_DIR_NAME)
360+ .join("instance.raw");
361+ let Ok(meta) = fs::metadata(&instance_raw) else {
362+ return;
363+ };
364+ let current_bytes = meta.len();
365+ if current_bytes == configured_bytes {
366+ return;
367+ }
368+ let current_gb = current_bytes as f64 / (1024.0 * 1024.0 * 1024.0);
369+ let target_gb = configured_bytes as f64 / (1024.0 * 1024.0 * 1024.0);
370+ tracing::warn!(
371+ "instance disk size does not match config (current {:.2} GB, config {:.2} GB). \
372+disk_gb applies only on init. Run `vibebox reset` to recreate or set disk_gb to match; using the existing disk.",
373+ current_gb,
374+ target_gb
375+ );
376+}
377+
357378type StderrHandle = reload::Handle<LevelFilter, Registry>;
358379
359380fn init_tracing(cwd: &Path) -> Option<StderrHandle> {
@@ -374,7 +395,7 @@ fn init_tracing(cwd: &Path) -> Option<StderrHandle> {
374395 });
375396
376397 if stderr_is_tty {
377− let (stderr_filter, handle) = reload::Layer::new(LevelFilter::OFF);
398+ let (stderr_filter, handle) = reload::Layer::new(LevelFilter::INFO);
378399 let stderr_layer = fmt::layer()
379400 .with_target(false)
380401 .with_ansi(ansi)
src/session_manager.rs+2−2
@@ -117,7 +117,7 @@ impl SessionManager {
117117 }
118118
119119 if removed > 0 || added {
120− tracing::info!(
120+ tracing::debug!(
121121 path = %self.sessions_dir.display(),
122122 removed,
123123 added,
@@ -196,7 +196,7 @@ impl SessionManager {
196196 let path = self.session_path_for(&record.id);
197197 let content = toml::to_string_pretty(record)?;
198198 atomic_write(&path, content.as_bytes())?;
199− tracing::info!(
199+ tracing::debug!(
200200 path = %path.display(),
201201 "wrote session record"
202202 );