Skip to content

feat(devbox): delete paused runtimes after 24 hours - #258

Open
zjy365 wants to merge 1 commit into
mainfrom
codex/devbox-delete-after-pause
Open

feat(devbox): delete paused runtimes after 24 hours#258
zjy365 wants to merge 1 commit into
mainfrom
codex/devbox-delete-after-pause

Conversation

@zjy365

@zjy365 zjy365 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • delete Chat and Deploy Devboxes after they have remained paused for 24 hours
  • keep Deployment Task rows, events, timeline history, runner transcripts, and deployment results permanently
  • add a durable Chat Devbox lifecycle ledger and migration, and track Deploy Devbox pause timestamps
  • remove the previous 30-day task purge path and the archiveAfterPauseTime Devbox contract

Why

The previous lifecycle coupled ephemeral Devbox storage to durable deployment history. Paused Devboxes could remain archived for an extended period while Deployment Task audit records were deleted after 30 days. This change separates those lifecycles: runtime storage is reclaimed promptly, while task history remains available.

Behavior and impact

  • terminal Deploy Devboxes are paused, then deleted 24 hours after the confirmed pause
  • Chat Devboxes are tracked before create/resume activity; confirmed pause starts their 24-hour deletion deadline
  • successful deletion and 404 both converge on runtimeState=deleted
  • API failures leave lifecycle state intact so the next reaper sweep retries
  • no user-facing task or Devbox deletion action is added
  • historical paused Deploy Devboxes are backfilled by the database migration

Validation

  • bun check
  • bun typecheck
  • 86 focused UI tests
  • helm lint charts/brain-system
  • bun run db:generate (no additional schema changes)
  • git diff --check

Notes

A live Devbox DELETE canary was not run because the resource API timed out and no dedicated test namespace was available. Root bun lint currently fails on unchanged packages/ui files that match main; the same ESLint failure appears in PR CI.

@zjy365
zjy365 force-pushed the codex/devbox-delete-after-pause branch from 67828a9 to ebea456 Compare August 5, 2026 08:33
@zjy365
zjy365 marked this pull request as ready for review August 6, 2026 08:12
@aimeritething

Copy link
Copy Markdown
Member

P1 —— 合并前应解决或拿到明确决策
连接池耗尽风险:FOR UPDATE 行锁横跨最长 10 秒的外部 Devbox 调用,且 Chat 扫描按进程 setInterval 各自运行、无跨进程租约(deploy 引擎有租约,Chat 没有)——N 个进程 × 4 并发同时钉住连接。Devbox API 一慢,无关查询就会跟着排队。建议:锁内只做状态 claim,API 调用移出事务;或给 Chat 扫描加租约。

@cla-assistant

cla-assistant Bot commented Aug 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Use short-lived database cleanup claims and token-fenced finalization so Devbox API calls never hold database transactions. Serialize Chat activity against cleanup claims and retain Deploy Task history while retrying failed runtime cleanup.
@zjy365
zjy365 force-pushed the codex/devbox-delete-after-pause branch from b9e720f to e2a7ba7 Compare August 6, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants