Skip to content
Merged
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
20 changes: 11 additions & 9 deletions cmd/lakebox/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,29 @@ func (e *sandboxEntry) idleTimeoutSecs() int64 {
return int64(d.Seconds())
}

// defaultAutoStopSecs mirrors the manager's `watchdog_idle_grace_secs`
// fallback (10 minutes) used when a sandbox has no per-record override.
// The value is also documented in `lakebox/CLAUDE.md` ("Sandbox
// Watchdog" section). Hardcoded here so list/status can render the
// effective timeout without an extra round-trip to fetch manager config.
const defaultAutoStopSecs int64 = 600

// autoStopLabel renders the auto-stop policy advertised by the manager
// for one sandbox into a short human-readable string. Mirrors the wire
// semantics from `lakebox/proto/lakebox.proto`:
// - `no_autostop == true` → never auto-stops
// - `idle_timeout` set and positive → that many seconds
// - otherwise → manager's global default (`defaultAutoStopSecs`)
// - otherwise → no enforcement today; render as "never"
//
// The "otherwise" branch used to render a hardcoded `10m` claiming to
// mirror a manager-side `watchdog_idle_grace_secs` fallback. That
// fallback does not exist in the current tree (only a stale comment in
// `lakebox/proto/lakebox.proto`); the ESM-side `LakeboxChecker` is also
// gated off via the `lakeboxCheckerEnabled` SAFE flag, so unset
// `idle_timeout` is functionally "never auto-stops" today. Once the
// manager enforces a real default, swap this branch back to a duration
// label.
func (e *sandboxEntry) autoStopLabel() string {
if e.NoAutostop != nil && *e.NoAutostop {
return "never"
}
if secs := e.idleTimeoutSecs(); secs > 0 {
return formatDurationSecs(secs)
}
return formatDurationSecs(defaultAutoStopSecs)
return "never"
}

// formatDurationSecs prints `secs` as a compact duration (e.g. `90s`,
Expand Down
Loading