-
Notifications
You must be signed in to change notification settings - Fork 1
Background Jobs
Not implemented. Upstream's job lifecycle registry has no server-side provider in Edge.
Upstream reference: Background Jobs
The jobs subsystem manages long-running producer work through ctx.jobs (JobRegistry). Producers own execution resources; the runtime owns identity, access control, and lifecycle state.
-
JobRegistry (
ctx.jobs) — abstract service withstart(),list(),get(),read(),kill(),wait().LocalJobRegistryis the process-local implementation. -
Producer contract — producers declare kind (
bash,subagent), providecancel()+donepromise + optionalreadOutput()for streaming. -
Consumer view —
JobSnapshotprojections with status lifecycle:running→stopping→completed/killed/failed. -
Session integration — the apiproxy subscribes to
onJobsChangedand broadcastssession/jobsframes over the mux channel.
Not implemented No dsh-jobs packages in dependencies. ctx.jobs is not available. No server-side job management exists.
The client-side UI plugin dsh-client-ui-jobs is included in the 33-plugin bundle — it renders job status panels and controls. But without a server-side JobRegistry, it has nothing to display.
| Cloudflare Product | What It Enables | Plan Requirement |
|---|---|---|
| DO alarms | Scheduled wake-ups for deferred work. Edge already uses these for WebSocket downlink expiry. Could schedule periodic job status checks or timeout enforcement. | Free plan |
| DO in-process execution | Short-lived jobs could run inside the DO's isolate directly — same approach as the current just-bash execution. Limited by Workers CPU time (30s free, 30min paid). | Free (30s) / Paid (30min) |
| Cloudflare Containers | Long-running jobs needing real processes (native builds, test suites, large file operations). A Container can run alongside the DO, coordinated via fetch. Full Linux environment. | Enterprise / Workers Paid (beta) |
The gap is the JobRegistry provider, not the concept. Upstream's LocalJobRegistry manages in-memory state with process-scoped cleanup. Edge would need a DurableObjectJobRegistry that:
- Tracks job state in DO memory (same lifecycle as the DO activation)
- Persists job metadata to DO KV for cold-session recovery
- Delegates execution to the current shell backend (just-bash) for simple jobs, or Containers for heavy work
- Broadcasts
session/jobsframes through the existing WebSocket downlink
The just-bash shell already runs commands synchronously in the DO. A job is essentially "a command that runs asynchronously with lifecycle tracking" — the execution engine exists, the lifecycle wrapper doesn't.
Evaluate JobRegistry with DO-backed state. The upstream
JobRegistryis abstract — a DO-specific subclass could track jobs in DO memory with KV persistence for recovery. Short jobs use the existing just-bash engine; long jobs could use Containers (paid plan) when available. Start with DO-only jobs (free plan compatible) and add Container delegation as an upgrade path.
- Home
- Architecture
- Core & Scope
- Session & Persistence
- Model & Context
-
Execution & Tools
- Tools
- Bash
- Subprocess 🚫
- PTY Session 🚫
- Background Jobs 🚫
- Filesystem
- LSP Navigation 🚫
- Code Runtime 🚫
-
Web Access
⚠️ -
Skills
⚠️ - Workflow 🚫
- Subagent 🚫
-
Policy & Interaction
- Goal
- Approval 🚫
- Permission Presets 🚫
-
Sandbox
⚠️ - Plan Mode 🚫
- User Interaction 🚫
- Commands 🚫
- Schedule 🚫
- Message Feedback 🚫
- Platform & Access
- Development
- 首页
- 架构
- 核心与作用域
- 会话与持久化
- 模型与上下文
- 执行与工具
- 策略与交互
- 平台与接入
- 开发