Hmbown/CodeWhale · error

Persistent service disappeared before commit

Error message

Persistent service {id} disappeared before commit

What it means

commit_persistent_services looked up a PersistPending shell by id and found it gone between collecting the ids and the commit loop — a concurrent mutation of the process map — so the ownership transfer aborts rather than committing a partially known set.

Solutions

  1. This indicates a concurrent removal raced the commit loop; inspect process state and retry the turn's persist-commit.
  2. Avoid draining/closing the shell pool while commit_persistent_services runs.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/tools/shell.rs:3107 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/9f0c0415f67f2ffc. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/tools/shell.rs:3107

    /// Transfer every still-running `persist:true` process out of Codewhale's
    /// ownership. This is called only by the real headless exec host after the
    /// enclosing turn has completed successfully.
    #[cfg(unix)]
    pub fn commit_persistent_services(&mut self) -> Result<Vec<PersistentServiceReceipt>> {
        let mut ids = self
            .processes
            .iter()
            .filter(|(_, shell)| shell.ownership == ShellOwnership::PersistPending)
            .map(|(id, _)| id.clone())
            .collect::<Vec<_>>();
        ids.sort();

        for id in &ids {
            let shell = self
                .processes
                .get_mut(id)
                .ok_or_else(|| anyhow!("Persistent service {id} disappeared before commit"))?;
            shell.poll();
            if shell.status != ShellStatus::Running {
                return Err(anyhow!(
                    "Persistent service {id} exited before ownership transfer (status {:?}, exit code {:?})",
                    shell.status,
                    shell.exit_code
                ));
            }
            if shell
                .child
                .as_ref()
                .and_then(ShellChild::process_id)
                .is_none()
            {
                return Err(anyhow!(
                    "Persistent service {id} has no releasable process id"
                ));
            }

View on GitHub (pinned to 73e0f67d83)