feat: add auto pause and resume lifecycle options at box creation time#1009
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis change replaces minute-based auto-stop and auto-delete settings with second-based AutoPause and AutoDelete policies, adds AutoResume behavior, updates lifecycle persistence and sweepers, integrates proxy readiness handling, propagates contracts through SDKs and dashboards, and adds migration, tests, and documentation. ChangesBox lifecycle automation
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
822442b to
1e7a1fb
Compare
1e7a1fb to
ccbc2c5
Compare
ccbc2c5 to
4af6de4
Compare
4af6de4 to
38f3b79
Compare
38f3b79 to
678402c
Compare
678402c to
977f553
Compare
977f553 to
f44b01e
Compare
📦 BoxLite review — couldn't completepowered by BoxLite |
Done |
I mean auto_delete duplicates auto_remove. |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/api/src/migrations/1741087887225-migration.ts`:
- Line 73: Revert the schema changes in the existing migration containing the
box table definition, restoring its previously executed column names and
structure. Implement the auto-delete column rename entirely in the new migration
1784250000000-add-box-lifecycle-seconds-migration.ts, ensuring existing
deployments migrate cleanly without altering migration history.
In
`@apps/api/src/migrations/pre-deploy/1784250000000-add-box-lifecycle-seconds-migration.ts`:
- Around line 6-26: Update the up method in the migration to add the new
lifecycle columns before removing legacy data, preserve existing
autoStopInterval values in autoPause and autoDeleteInterval values in autoDelete
by converting minutes to seconds (multiply by 60), then drop the legacy
autoStopInterval and autoDeleteInterval columns. Use the production legacy
column name autoDeleteInterval, and keep the constraints applied after the
converted values are populated.
In `@docs/architecture/auto-pause-resume-design.md`:
- Around line 86-93: Update the AutoDelete flow described in the design to
re-read the Redis-preferred latest activity through
BoxActivityService.getLastActivityAt after acquiring the per-box lock, before
deleting a candidate. Skip deletion when recent activity is detected, preserving
the existing AutoPause re-check and conditional state-write protections.
- Around line 11-20: Update the public wire-fields contract to document
auto_resume alongside auto_pause and auto_delete, specifying its type, default
value, semantics, and local-runtime behavior. Keep the existing public naming
and second-level conventions consistent, and ensure the lifecycle/API contract
clearly covers create-time AutoResume.
- Around line 95-99: Align the “Removed Fields and Endpoints” section with the
actual compatibility behavior: verify whether the legacy autostop and autodelete
endpoints remain supported with minute-to-second conversion, then document them
as deprecated/compatible endpoints or remove their support to match the stated
removal. Keep the endpoint documentation and implementation consistent.
In `@sdks/node/lib/native-contracts.ts`:
- Around line 176-178: Update the native return type fields autoPause,
autoDelete, and autoResume in the TypeScript contract to remove their optional
modifiers, matching the always-present primitive values serialized by the Rust
JsBoxInfo struct.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f506b888-b2d0-437e-9b56-b7c16adad0e3
📒 Files selected for processing (45)
apps/api-client-go/api/openapi.yamlapps/api-client-go/model_box.goapps/api/src/box/constants/box-lifecycle.constants.tsapps/api/src/box/dto/box.dto.tsapps/api/src/box/dto/create-box.dto.tsapps/api/src/box/entities/box.entity.tsapps/api/src/box/managers/box.manager.tsapps/api/src/box/services/box.service.tsapps/api/src/boxlite-rest/boxlite-box.controller.tsapps/api/src/boxlite-rest/boxlite-proxy.controller.spec.tsapps/api/src/boxlite-rest/boxlite-proxy.controller.tsapps/api/src/boxlite-rest/boxlite-ws-proxy.service.tsapps/api/src/boxlite-rest/dto/box-response.dto.tsapps/api/src/boxlite-rest/dto/create-box.dto.spec.tsapps/api/src/boxlite-rest/dto/create-box.dto.tsapps/api/src/boxlite-rest/mappers/box-to-box.mapper.spec.tsapps/api/src/boxlite-rest/mappers/box-to-box.mapper.tsapps/api/src/migrations/1741087887225-migration.tsapps/api/src/migrations/pre-deploy/1784250000000-add-box-lifecycle-seconds-migration.tsapps/dashboard/src/components/Box/CreateBoxDialog.test.tsxapps/dashboard/src/components/Box/CreateBoxDialog.tsxapps/dashboard/src/lib/cloudBox.test.tsapps/dashboard/src/lib/cloudBox.tsapps/dashboard/src/pages/Boxes.tsxapps/libs/api-client/src/docs/Box.mdapps/libs/api-client/src/models/box.tsdocs/architecture/auto-pause-resume-design.mddocs/guides/auto-pause-resume.mdopenapi/box.openapi.yamlsdks/c/include/boxlite.hsdks/c/src/event_queue.rssdks/c/src/info.rssdks/c/src/options.rssdks/go/info.gosdks/go/options.gosdks/node/lib/native-contracts.tssdks/node/src/info.rssdks/node/src/options.rssdks/python/src/info.rssdks/python/src/options.rssrc/boxlite/src/rest/runtime.rssrc/boxlite/src/rest/types.rssrc/boxlite/src/runtime/options.rssrc/boxlite/src/runtime/rt_impl.rssrc/boxlite/src/runtime/types.rs
🚧 Files skipped from review as they are similar to previous changes (24)
- apps/api/src/boxlite-rest/dto/create-box.dto.spec.ts
- apps/api/src/boxlite-rest/boxlite-box.controller.ts
- apps/api/src/boxlite-rest/mappers/box-to-box.mapper.spec.ts
- apps/dashboard/src/components/Box/CreateBoxDialog.test.tsx
- apps/api/src/box/constants/box-lifecycle.constants.ts
- sdks/c/src/info.rs
- apps/dashboard/src/pages/Boxes.tsx
- sdks/c/include/boxlite.h
- sdks/node/src/info.rs
- sdks/c/src/event_queue.rs
- apps/api/src/box/dto/create-box.dto.ts
- src/boxlite/src/rest/runtime.rs
- sdks/python/src/info.rs
- apps/api/src/box/dto/box.dto.ts
- src/boxlite/src/runtime/rt_impl.rs
- apps/dashboard/src/components/Box/CreateBoxDialog.tsx
- apps/dashboard/src/lib/cloudBox.ts
- sdks/c/src/options.rs
- docs/guides/auto-pause-resume.md
- apps/api/src/boxlite-rest/boxlite-proxy.controller.spec.ts
- apps/api/src/boxlite-rest/boxlite-ws-proxy.service.ts
- apps/api/src/box/managers/box.manager.ts
- apps/api/src/box/services/box.service.ts
- apps/api/src/boxlite-rest/boxlite-proxy.controller.ts
Signed-off-by: xhe <xw897002528@gmail.com>
- Cap auto-pause/auto-delete cron queries at 100 boxes per tick with deterministic ordering to avoid burst load. - Retry Redis subscription in BoxStateWaiter on transient failures. - Reject directly if toBoxDto throws inside the waiter finish path. - Guard WebSocket auto-resume behind box.autoResumeEnabled. - Remove obsolete websocket activity test for reverted implementation.
Rename auto_pause_interval/auto_delete_interval/auto_resume_enabled to auto_pause/auto_delete/auto_resume for consistency with the existing auto_remove option. Signed-off-by: xhe <xw897002528@gmail.com>
…uto_delete Signed-off-by: xhe <xw897002528@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
sdks/node/lib/native-contracts.ts (1)
90-95: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument lifecycle option units and migration semantics.
These public fields should state that intervals are in seconds and that
0disables them. Also explain how the deprecated booleanautoRemovemaps toautoDelete; “Use autoDelete” alone can lead callers to pass the wrong value type or semantics.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sdks/node/lib/native-contracts.ts` around lines 90 - 95, Update the public option documentation for autoPause and autoDelete to specify that their intervals are measured in seconds and that 0 disables the behavior. Expand the deprecated autoRemove documentation to explain its boolean-to-autoDelete migration mapping and corresponding semantics, while preserving the existing field types and declarations.openapi/reference-server/server.py (1)
383-388: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep
build_box_optionsunder the documented 50-line limit.This function spans Lines 346-410. Extract lifecycle-policy mapping or another cohesive block into a helper so the request conversion remains focused and testable.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@openapi/reference-server/server.py` around lines 383 - 388, Refactor build_box_options to remain within the documented 50-line limit by extracting the cohesive lifecycle-policy mapping for auto_pause, auto_delete, and auto_resume into a dedicated helper. Have build_box_options invoke that helper while preserving the existing behavior and keeping request-to-options conversion focused.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openapi/reference-server/server.py`:
- Around line 142-144: Update the auto_pause and auto_delete fields in the model
definition to enforce non-negative integer values by adding the ge=0 constraint,
while leaving auto_resume unchanged.
In `@sdks/python/tests/test_options.py`:
- Around line 62-70: Update test_auto_delete_overrides_auto_remove to stop the
created box before cleanup, then assert through the local runtime that the box
is removed immediately when auto_delete=60 despite auto_remove=False. Retain
explicit cleanup only if the box remains, ensuring the test detects precedence
regressions.
In `@src/cli/src/commands/serve/mod.rs`:
- Around line 677-678: Update the request-to-BoxOptions construction in the
serve command so an omitted detach value defaults to false when auto_delete is
enabled, while preserving the existing default for requests without auto-delete.
Ensure the resulting options satisfy BoxOptions::sanitize(), or return a clear
4xx validation error for incompatible explicitly provided values.
In `@src/cli/src/commands/serve/types.rs`:
- Line 39: Add auto_pause and auto_resume alongside auto_delete in the request
schema, then update build_box_options to propagate all three lifecycle fields
into the runtime options. Preserve the existing optional types and mapping
behavior so clients can send any combination without unknown-field rejection.
In `@src/test-utils/src/config_matrix.rs`:
- Around line 89-94: Update the matrix entries around the “default” and
“auto_delete_zero” cases so they test distinct policies: keep “default” using
BoxOptions::default() with auto_delete unset, and reserve auto_delete: Some(0)
exclusively for the explicitly named zero-value case. Preserve each case’s
unique name and avoid duplicate option configurations.
---
Nitpick comments:
In `@openapi/reference-server/server.py`:
- Around line 383-388: Refactor build_box_options to remain within the
documented 50-line limit by extracting the cohesive lifecycle-policy mapping for
auto_pause, auto_delete, and auto_resume into a dedicated helper. Have
build_box_options invoke that helper while preserving the existing behavior and
keeping request-to-options conversion focused.
In `@sdks/node/lib/native-contracts.ts`:
- Around line 90-95: Update the public option documentation for autoPause and
autoDelete to specify that their intervals are measured in seconds and that 0
disables the behavior. Expand the deprecated autoRemove documentation to explain
its boolean-to-autoDelete migration mapping and corresponding semantics, while
preserving the existing field types and declarations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 66186f7c-5c95-47ea-b5c7-20503e1050fb
📒 Files selected for processing (42)
apps/api/src/boxlite-rest/boxlite-box.controller.tsapps/api/src/boxlite-rest/dto/create-box.dto.tsapps/api/src/migrations/pre-deploy/1784250000000-add-box-lifecycle-seconds-migration.tsdocs/architecture/auto-pause-resume-design.mdopenapi/box.openapi.yamlopenapi/reference-server/server.pyscripts/test/stress/api-create-box.k6.jsscripts/test/stress/api-vm-lifecycle.k6.jssdks/c/include/boxlite.hsdks/c/src/options.rssdks/c/src/tests.rssdks/go/boxlite_test.gosdks/go/options.gosdks/node/lib/native-contracts.tssdks/node/src/options.rssdks/python/src/options.rssdks/python/tests/test_options.pysrc/boxlite/src/db/migration/mod.rssrc/boxlite/src/db/migration/v8_to_v9.rssrc/boxlite/src/db/schema.rssrc/boxlite/src/litebox/box_impl.rssrc/boxlite/src/rest/types.rssrc/boxlite/src/runtime/options.rssrc/boxlite/src/runtime/rt_impl.rssrc/boxlite/tests/common/mod.rssrc/boxlite/tests/execution_shutdown.rssrc/boxlite/tests/health_check.rssrc/boxlite/tests/lifecycle.rssrc/boxlite/tests/mount_security.rssrc/boxlite/tests/recovery.rssrc/boxlite/tests/rest_integration.rssrc/boxlite/tests/security_enforcement.rssrc/boxlite/tests/timing_profile.rssrc/boxlite/tests/zygote_integration.rssrc/cli/src/cli.rssrc/cli/src/commands/run.rssrc/cli/src/commands/serve/mod.rssrc/cli/src/commands/serve/types.rssrc/test-utils/src/box_test.rssrc/test-utils/src/cache.rssrc/test-utils/src/config_matrix.rssrc/test-utils/src/home.rs
💤 Files with no reviewable changes (5)
- apps/api/src/boxlite-rest/dto/create-box.dto.ts
- scripts/test/stress/api-vm-lifecycle.k6.js
- apps/api/src/boxlite-rest/boxlite-box.controller.ts
- scripts/test/stress/api-create-box.k6.js
- src/boxlite/src/rest/types.rs
🚧 Files skipped from review as they are similar to previous changes (5)
- sdks/c/include/boxlite.h
- sdks/go/options.go
- sdks/node/src/options.rs
- sdks/python/src/options.rs
- docs/architecture/auto-pause-resume-design.md
| /// When false, the box is preserved after stop and can be restarted | ||
| /// with `runtime.get(box_id)`. | ||
| #[serde(default = "default_auto_remove")] | ||
| pub auto_remove: bool, |
There was a problem hiding this comment.
This is a hard break changing. Why remove it?
There was a problem hiding this comment.
I mean auto_delete duplicates auto_remove.
A direct change to this comment. SDK and APIs remains unchanged. I though you want that.
There was a problem hiding this comment.
We could just keep the flag, and make them co-exist by prioritizing the new flag first.
There was a problem hiding this comment.
obviously you changed the Rust SDK
There was a problem hiding this comment.
We could just keep the flag, and make them co-exist by prioritizing the new flag first.
I agree with this and mark it as deprecated but still support it for now
There was a problem hiding this comment.
Do you mean that Rust SDK relies on BoxOptions defined here?
12055c2 to
138631f
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/boxlite/src/runtime/types.rs (1)
386-401: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
exit_codemissing fromBoxInfo'sPartialEq.
exit_codewas added toBoxInfo(Line 352) but the hand-writtenPartialEqimpl (Lines 386-401) only checksauto_pause/auto_delete/auto_resume/health_status. Two infos differing only inexit_codecompare as equal, silently breaking equality-based change detection for this new, meaningful field.🐛 Proposed fix
&& self.auto_pause == other.auto_pause && self.auto_delete == other.auto_delete && self.auto_resume == other.auto_resume + && self.exit_code == other.exit_code && self.health_status == other.health_status } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/boxlite/src/runtime/types.rs` around lines 386 - 401, Update the hand-written PartialEq implementation for BoxInfo::eq to compare the exit_code field as well, preserving the existing comparisons for all other fields so instances differing only in exit_code are unequal.src/boxlite/src/litebox/watcher.rs (1)
281-306: 🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick winDead debounce guard in the
Probe::Failedbranch — persists on every failed probe.
new_failuresis alwayslast.failures + 1(Line 283), solast.failures == new_failures(Line 289) can never be true. The early-return guard never fires, meaning every failed probe unconditionally writes to the DB viaself.persist, unlike theHealthybranch's working debounce just above it.♻️ Proposed fix
Probe::Failed => { tracing::warn!(box_id = %self.box_id, "Health check probe failed"); let new_failures = last.failures + 1; let new_state = if new_failures >= retries { HealthState::Unhealthy } else { last.state }; - if last.state == new_state && last.failures == new_failures { + if last.state == new_state && last.state == HealthState::Unhealthy { + // Already unhealthy and staying unhealthy: nothing new to persist. return Continue(()); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/boxlite/src/litebox/watcher.rs` around lines 281 - 306, Fix the debounce logic in the Probe::Failed branch so repeated failed probes that do not change the health snapshot return before calling self.persist. Replace the impossible last.failures == new_failures comparison with a comparison against the persisted/current health state, while preserving transition handling through mark_health_check_failure and the existing Break/Continue behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/architecture/auto-pause-resume-design.md`:
- Line 7: Align the lifecycle semantics described in the architecture document
so local auto_delete behavior is consistent throughout. Update the rejection
statement and the sections around the local lifecycle behavior to clearly
distinguish cloud/REST unsupported configurations from supported local
auto_delete behavior, preserving one unambiguous meaning per runtime.
In `@sdks/c/include/boxlite.h`:
- Around line 586-590: Document the public lifecycle setters with comprehensive
API documentation: in sdks/c/include/boxlite.h lines 586-590, add comments for
boxlite_options_set_auto_pause_interval,
boxlite_options_set_auto_delete_interval, and
boxlite_options_set_auto_resume_enabled describing time units, zero-value
behavior, and accepted boolean values; in sdks/c/src/options.rs lines 170-186,
add Rust docstrings to the corresponding public helper functions, preserving
their existing behavior.
In `@sdks/c/src/options.rs`:
- Around line 176-179: Ensure explicit auto-delete settings deterministically
override the legacy auto-remove option: update options_set_auto_delete_interval
in sdks/c/src/options.rs to clear auto_remove, and update the Node conversion in
sdks/node/src/options.rs and Python conversion in sdks/python/src/options.rs to
apply the same precedence or reject configurations specifying both values.
Preserve the configured auto-delete delay instead of retaining auto_remove=true.
---
Outside diff comments:
In `@src/boxlite/src/litebox/watcher.rs`:
- Around line 281-306: Fix the debounce logic in the Probe::Failed branch so
repeated failed probes that do not change the health snapshot return before
calling self.persist. Replace the impossible last.failures == new_failures
comparison with a comparison against the persisted/current health state, while
preserving transition handling through mark_health_check_failure and the
existing Break/Continue behavior.
In `@src/boxlite/src/runtime/types.rs`:
- Around line 386-401: Update the hand-written PartialEq implementation for
BoxInfo::eq to compare the exit_code field as well, preserving the existing
comparisons for all other fields so instances differing only in exit_code are
unequal.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 9354b173-47e0-4b9e-beef-fa984991fdfc
⛔ Files ignored due to path filters (1)
apps/go.work.sumis excluded by!**/*.sum
📒 Files selected for processing (92)
apps/api-client-go/api/openapi.yamlapps/api-client-go/api_box.goapps/api-client-go/model_box.goapps/api/src/box/constants/box-lifecycle.constants.tsapps/api/src/box/controllers/box.controller.tsapps/api/src/box/dto/box.dto.tsapps/api/src/box/dto/create-box.dto.tsapps/api/src/box/entities/box.entity.tsapps/api/src/box/managers/box.manager.tsapps/api/src/box/repositories/box.repository.tsapps/api/src/box/services/box-state-waiter.service.spec.tsapps/api/src/box/services/box-state-waiter.service.tsapps/api/src/box/services/box.service.tsapps/api/src/boxlite-rest/box-auto-resume.service.spec.tsapps/api/src/boxlite-rest/box-auto-resume.service.tsapps/api/src/boxlite-rest/boxlite-box.controller.tsapps/api/src/boxlite-rest/boxlite-proxy.controller.spec.tsapps/api/src/boxlite-rest/boxlite-proxy.controller.tsapps/api/src/boxlite-rest/boxlite-rest-routing.spec.tsapps/api/src/boxlite-rest/boxlite-rest.module.tsapps/api/src/boxlite-rest/boxlite-ws-proxy.service.spec.tsapps/api/src/boxlite-rest/boxlite-ws-proxy.service.tsapps/api/src/boxlite-rest/dto/box-response.dto.tsapps/api/src/boxlite-rest/dto/create-box.dto.spec.tsapps/api/src/boxlite-rest/dto/create-box.dto.tsapps/api/src/boxlite-rest/mappers/box-to-box.mapper.spec.tsapps/api/src/boxlite-rest/mappers/box-to-box.mapper.tsapps/api/src/migrations/pre-deploy/1784250000000-add-box-lifecycle-seconds-migration.tsapps/dashboard/src/components/Box/CreateBoxDialog.test.tsxapps/dashboard/src/components/Box/CreateBoxDialog.tsxapps/dashboard/src/lib/cloudBox.test.tsapps/dashboard/src/lib/cloudBox.tsapps/dashboard/src/pages/Boxes.tsxapps/libs/api-client/src/api/box-api.tsapps/libs/api-client/src/docs/Box.mdapps/libs/api-client/src/docs/BoxApi.mdapps/libs/api-client/src/models/box.tsapps/proxy/pkg/proxy/get_box_target.goapps/proxy/pkg/proxy/proxy.goapps/scripts/e2e-dev-smoke.mjsdocs/README.mddocs/architecture/README.mddocs/architecture/auto-pause-resume-design.mddocs/guides/README.mddocs/guides/auto-pause-resume.mdopenapi/box.openapi.yamlopenapi/reference-server/server.pyscripts/build/build-runtime.shscripts/test/stress/api-create-box.k6.jsscripts/test/stress/api-vm-lifecycle.k6.jssdks/c/include/boxlite.hsdks/c/src/event_queue.rssdks/c/src/info.rssdks/c/src/options.rssdks/c/src/tests.rssdks/go/boxlite_test.gosdks/go/info.gosdks/go/options.gosdks/node/lib/native-contracts.tssdks/node/src/info.rssdks/node/src/options.rssdks/python/src/info.rssdks/python/src/options.rssdks/python/tests/test_options.pysrc/boxlite/src/lib.rssrc/boxlite/src/litebox/box_impl.rssrc/boxlite/src/litebox/watcher.rssrc/boxlite/src/rest/runtime.rssrc/boxlite/src/rest/types.rssrc/boxlite/src/runtime/options.rssrc/boxlite/src/runtime/rt_impl.rssrc/boxlite/src/runtime/types.rssrc/boxlite/tests/common/mod.rssrc/boxlite/tests/execution_shutdown.rssrc/boxlite/tests/health_check.rssrc/boxlite/tests/lifecycle.rssrc/boxlite/tests/mount_security.rssrc/boxlite/tests/recovery.rssrc/boxlite/tests/rest_integration.rssrc/boxlite/tests/run_main_command.rssrc/boxlite/tests/security_enforcement.rssrc/boxlite/tests/timing_profile.rssrc/boxlite/tests/zygote_integration.rssrc/cli/src/cli.rssrc/cli/src/commands/create.rssrc/cli/src/commands/run.rssrc/cli/src/commands/serve/mod.rssrc/cli/src/commands/serve/types.rssrc/test-utils/src/box_test.rssrc/test-utils/src/cache.rssrc/test-utils/src/config_matrix.rssrc/test-utils/src/home.rs
💤 Files with no reviewable changes (3)
- scripts/test/stress/api-create-box.k6.js
- apps/proxy/pkg/proxy/get_box_target.go
- scripts/test/stress/api-vm-lifecycle.k6.js
🚧 Files skipped from review as they are similar to previous changes (68)
- docs/architecture/README.md
- scripts/build/build-runtime.sh
- src/boxlite/tests/timing_profile.rs
- sdks/go/boxlite_test.go
- apps/api/src/box/controllers/box.controller.ts
- apps/api/src/box/constants/box-lifecycle.constants.ts
- apps/api/src/box/services/box-state-waiter.service.spec.ts
- src/boxlite/src/lib.rs
- apps/api/src/boxlite-rest/boxlite-rest.module.ts
- src/cli/src/commands/run.rs
- apps/libs/api-client/src/models/box.ts
- sdks/node/src/info.rs
- src/test-utils/src/home.rs
- docs/README.md
- apps/dashboard/src/lib/cloudBox.test.ts
- docs/guides/README.md
- src/cli/src/cli.rs
- sdks/python/src/info.rs
- apps/api/src/boxlite-rest/box-auto-resume.service.spec.ts
- apps/api/src/box/repositories/box.repository.ts
- src/test-utils/src/box_test.rs
- src/boxlite/tests/security_enforcement.rs
- apps/api/src/boxlite-rest/dto/create-box.dto.spec.ts
- apps/api/src/box/entities/box.entity.ts
- apps/api/src/boxlite-rest/boxlite-rest-routing.spec.ts
- src/boxlite/tests/rest_integration.rs
- apps/api/src/boxlite-rest/dto/box-response.dto.ts
- src/boxlite/tests/common/mod.rs
- sdks/node/lib/native-contracts.ts
- src/boxlite/tests/zygote_integration.rs
- src/boxlite/tests/execution_shutdown.rs
- src/boxlite/src/rest/runtime.rs
- apps/libs/api-client/src/docs/Box.md
- sdks/c/src/info.rs
- apps/api/src/migrations/pre-deploy/1784250000000-add-box-lifecycle-seconds-migration.ts
- apps/api/src/boxlite-rest/boxlite-ws-proxy.service.spec.ts
- openapi/reference-server/server.py
- apps/api/src/boxlite-rest/box-auto-resume.service.ts
- apps/api/src/box/dto/box.dto.ts
- apps/dashboard/src/components/Box/CreateBoxDialog.test.tsx
- sdks/python/tests/test_options.py
- src/boxlite/tests/lifecycle.rs
- src/boxlite/tests/health_check.rs
- apps/api/src/boxlite-rest/boxlite-box.controller.ts
- apps/api/src/boxlite-rest/boxlite-ws-proxy.service.ts
- sdks/c/src/event_queue.rs
- apps/scripts/e2e-dev-smoke.mjs
- apps/api/src/box/dto/create-box.dto.ts
- src/boxlite/tests/recovery.rs
- apps/api/src/boxlite-rest/boxlite-proxy.controller.spec.ts
- apps/api-client-go/api_box.go
- apps/dashboard/src/components/Box/CreateBoxDialog.tsx
- apps/api/src/boxlite-rest/mappers/box-to-box.mapper.spec.ts
- apps/api/src/boxlite-rest/dto/create-box.dto.ts
- sdks/go/options.go
- apps/libs/api-client/src/api/box-api.ts
- apps/api-client-go/api/openapi.yaml
- src/test-utils/src/config_matrix.rs
- apps/dashboard/src/lib/cloudBox.ts
- apps/api/src/box/services/box-state-waiter.service.ts
- src/boxlite/src/runtime/rt_impl.rs
- apps/api/src/box/services/box.service.ts
- docs/guides/auto-pause-resume.md
- openapi/box.openapi.yaml
- apps/api/src/box/managers/box.manager.ts
- apps/proxy/pkg/proxy/proxy.go
- src/boxlite/src/rest/types.rs
- apps/api/src/boxlite-rest/boxlite-proxy.controller.ts
Refs #1003
Summary
Adds create-time lifecycle options for AutoPause, AutoDelete, and AutoResume, and keeps the legacy autostop/autodelete endpoints working by converting minutes to seconds.
Changes
auto_pause,auto_delete, andauto_resumein both the internal and BoxLite REST APIs.auto_resumeis true.POST /box/{id}/autostop/{interval}andPOST /box/{id}/autodelete/{interval}endpoints are retained; input is converted from minutes to seconds.docs/.How to verify
make fmt:check:rustcd apps && ./node_modules/.bin/tsc -p api/tsconfig.app.json --noEmitcd apps && ./node_modules/.bin/eslint "api/src/box/**/*.ts"Risks / rollout
autodelete/0no longer deletes immediately; it now disables auto-delete, consistent with the new0 = disabledsemantics. Existing clients relying on the old immediate-delete behavior need to migrate.Summary by CodeRabbit