S06-10 - Leftover Processes
Purpose: The results of the kill of a project user, how wb-hostd
accepts them, and what it does when processes are left.
Design
Section titled “Design”Leftover processes
Section titled “Leftover processes”The kill loop of S13-01-process-hardeningS13-01-process-hardening: Layer 1: Process Hardening (v1)How wb-guestd hardens every process it starts for a project user, and how it stops and kills a project user's processes. ends clean, or with a count of processes left.
Kill IDs and records
Section titled “Kill IDs and records”wb-hostd sends a kill of a project user in two cases:
- when it ends a project’s last session in the VM;
- at the first connection, for users with no lost session. It sends that kill only after it has answered the reconnect list.
Each kill carries a kill ID that wb-hostd assigns. For each one,
wb-guestd writes a cleanup record to its root-owned directory, with:
- the kill ID;
- the project ID;
- the result: clean, or the count of processes left, capped at 1001.
It keeps the record until wb-hostd acknowledges it, and lists it at
reconnect (S06-11-reconnect-and-recoveryS06-11-reconnect-and-recovery: Reconnect, Loss and RecoveryWhat happens when the host-guest link drops, when a session is lost, and how a lost session's work is recovered or discarded., “Reconnect”).
It holds at most one record per project user in the VM, counted apart from the 64 session entries. A newer record replaces an older one of the same user. The replaced kill then fails closed at its deadline.
The loop can run because a session’s client went and no session of that user is left. The result is then the cleanup field of that session’s report (S06-09-session-lifecycleS06-09-session-lifecycle: Session LifecycleA session's states from wb claude to its summary, how it starts and ends, its deadlines, and when its VM may be saved., “Ending”).
Acceptance
Section titled “Acceptance”wb-hostd accepts a result only when all of these hold:
- The project ID passes the project ID format check of S05-04-namingS05-04-naming: NamingHow wb identifies a project, a session and its branch, and how projects are registered, checked, moved and removed..
- The record’s kill ID is exactly one that
wb-hostdsent for that project, in this VM and this VM generation. Or the report is that of the session whose end led to the kill. - It arrives before the kill’s deadline (S06-09-session-lifecycleS06-09-session-lifecycle: Session LifecycleA session's states from wb claude to its summary, how it starts and ends, its deadlines, and when its VM may be saved., “Deadlines”), in the VM generation the kill was sent to.
Anything else is dropped, and logged with its rule.
Failing closed
Section titled “Failing closed”A kill without an accepted clean result by its deadline counts as a result of processes left. A late, missing, or dropped result never counts as clean.
wb-hostd keeps its pending kills in memory, not in state.db. A
wb-hostd exit stops every VM. A pending kill then closes either way.
A pending kill whose VM generation ends in a cold stop before its
deadline is closed instead, because the guest it targeted no longer
runs. A cold stop is a stop that wb-vmd reports for any reason:
- guest shutdown and panic included;
wb vm stop;- a
wb-hostdexit; - the cold boot of an upgrade.
An in-place reboot of the guest isn’t a cold stop.
A stop the guest forces is safe, because a running generation has no saved state, and suspend is refused while a kill is pending (S06-09-session-lifecycleS06-09-session-lifecycle: Session LifecycleA session's states from wb claude to its summary, how it starts and ends, its deadlines, and when its VM may be saved., “Idle suspend”).
wb-hostd logs each kill a cold stop closes, with its rule and the
stop’s cause (SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.).
The refusals below belong to the VM generation that produced them. A cold boot starts a new generation without them.
A result of processes left
Section titled “A result of processes left”For a result of processes left, wb-hostd:
- writes an audit event with the rule (SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.);
- tells the user in
wb statusand at the nextwbcommand. Both name the project fromwb-hostd’s own table, never from the guest’s string. Both show the count capped (“more than 1000”); - refuses every new session in that VM, of any project, and learn mode, until the VM is cold-booted (NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it.). Sessions that already run continue;
- never saves the VM. Idle suspend doesn’t run, and
wb vm suspendis refused with the reason. They also are while a kill is pending (S06-09-session-lifecycleS06-09-session-lifecycle: Session LifecycleA session's states from wb claude to its summary, how it starts and ends, its deadlines, and when its VM may be saved., “Idle suspend”); - makes the VM’s next start a cold boot, and deletes a saved state from before the result;
- offers
wb vm stopfollowed bywb vm start(S05-cliS05-cli: Command Line InterfaceSpecify wb, the single user-facing command.). They work once no session runs in the VM.
Only a cold boot clears the refusals, never a suspend and restore.
Guest root
Section titled “Guest root”Guest root can fake a result or hold it back.
- A faked count, a withheld result or a late one only makes
wb-hostdstricter. T11-shared-vm-grantsT11-shared-vm-grants: Projects in one VM share network grantsThe host sees one guest address per VM, and can't tell which project user, session or program opened a connection. records that cost. - A faked clean result leaves the residual of S07-17-approvals-and-learningS07-17-approvals-and-learning: Approvals and LearningHow an unknown destination reaches the user as an approval request, what an approval grants, and how learn mode collects names., “Leftover processes”. A cold boot and the review of the learn list cover it.
Status: Draft