ContextLab / ContextLab/world-compute
Agent lifecycle: heartbeat, pause/checkpoint, and withdrawal
- Dominant language
- Rust
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Description
`src/agent/lifecycle.rs` contains three TODO items for core agent lifecycle operations:
1. **heartbeat()** (line ~134): Send heartbeat to broker/coordinator, receive lease offers
2. **pause()** (line ~143): Checkpoint any active sandboxes, notify broker
3. **withdraw()** (lines ~176-177): Checkpoint and terminate all active sandboxes, notify broker/coordinator of withdrawal
These are critical for Principle III (Donor Sovereignty) — donors must be able to pause and withdraw at any time with clean state transitions.
## Requirements
- Heartbeat: periodic signal to broker with node state, resource availability, active leases
- Pause: checkpoint all running sandboxes (SIGSTOP + snapshot), transition to Paused state, stop accepting new leases
- Withdraw: checkpoint all sandboxes, terminate them, wipe scoped working directory, revoke keypair, notify broker, leave no host state
## Success Criteria
- [ ] Heartbeat sends periodic updates to broker and receives lease offers
- [ ] Pause checkpoints active work and transitions agent to Paused state
- [ ] Withdraw fully cleans up: no files, processes, scheduled tasks, or network state remain
- [ ] State transitions follow the AgentState machine (Enrolling→Idle→Working→Paused→Withdrawing)
- [ ] Integration test: agent joins, receives work, pauses, resumes, withdraws cleanly
- [ ] `cargo test` passes with zero regressions
## Testing (Principle V)
- Run agent on real hardware, submit job, trigger pause, verify checkpoint saved
- Withdraw and verify zero host residue (scan for files, processes, network listeners)
- Test rapid pause/resume cycles under load
- Test withdraw during active job execution
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.