Hmbown/CodeWhale · error
failed to record sub-agent verification approval
Error message
failed to record sub-agent verification approval: {err} What it means
After a sub-agent run completes, its verification approval must be recorded under the reference `agent:{agent_id}:approval` in the lifecycle journal; failure triggers reconciliation to OwnerState::Failed and this error wrapping the underlying cause. The message deliberately embeds the inner error ({err}) because an unrecorded approval means the sub-agent's success cannot be trusted downstream.
Solutions
- Inspect the wrapped {err} in the message — it names the real underlying failure (IO, storage, format)
- Retry the sub-agent run after fixing the state store (disk space, permissions, file lock)
- Verify the session journal/state files are not corrupted or from an incompatible version
- Ensure the approval record API is called before the parent turn finishes settling, and handle its Result explicitly
Example fix
// before: ignore record failure, agent looks approved
let _ = record_approval(&lifecycle.external, &reference, "agent", &key);
// after: fail loudly and reconcile (as the tool does)
if let Err(err) = record_approval(&lifecycle.external, &reference, "agent", &key) {
let _ = lifecycle.reconcile_state(OwnerState::Failed, 1, None);
return Err(anyhow!("failed to record sub-agent verification approval: {err}"));
} Defensive patterns
Strategy: try-catch
Validate before calling
// preflight the state store before recording
if !lifecycle.store_writable() {
return Err(anyhow!("lifecycle store not writable; approval cannot be recorded"));
} Try / catch
if let Err(err) = record_approval(&lifecycle.external, &reference, "agent", &key) {
let _ = lifecycle.reconcile_state(OwnerState::Failed, 1, None);
return Err(anyhow!("failed to record sub-agent verification approval: {err}"));
}
// caller: inspect inner err for IO/permission/corruption fixes Prevention
- Monitor disk space and permissions on the session state directory
- Keep approval record format backward-compatible across upgrades
- Reconcile to OwnerState::Failed whenever recording fails (as implemented)
- Write approval records before the parent turn settles
When it happens
Trigger: Calling the sub-agent completion path when the approval-record function errors — e.g. the lifecycle journal/state store is unavailable, the reference is rejected, or the underlying record API returns an error while lifecycle.external/reference are being persisted.
Common situations: Disk-full or permission problems writing lifecycle state; a corrupted or locked session journal; schema changes to the approval record format after an upgrade; concurrent settlement closing the record mid-write.
Related errors
- ; additionally failed to persist contention receipt
- failed to durably register write-capable sub-agent before…
- failed to register sub-agent work
- sub-agent transcript history shrank from
- agent action=claim widens an enforced write scope, and the…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/bf9a04673654edd2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/subagent/mod.rs:3178
error = %err,
"sub-agent work-graph registration skipped; spawning unbound"
);
return Ok(None);
}
// A root Operate verification lease is provenance, not delegated
// authority. Nested workers cannot inherit this bit.
if runtime.accept_verification && runtime.spawn_depth == 1 {
let reference = format!("operate-verification:{agent_id}");
if let Err(err) = lifecycle.work.record_operation_approval(
&lifecycle.session_id,
&lifecycle.external,
&reference,
"agent",
&format!("agent:{agent_id}:approval"),
) {
let _ = lifecycle.reconcile_state(OwnerState::Failed, 1, None);
return Err(anyhow!(
"failed to record sub-agent verification approval: {err}"
));
}
}
Ok(Some(lifecycle))
}
fn reconcile_record(&self, record: &AgentWorkerRecord) -> Result<bool, String> {
let Some(snapshot) = agent_worker_owner_snapshot(record) else {
return Ok(false);
};
self.work.reconcile_operation(&self.session_id, snapshot)
}
fn reconcile_state(
&self,
state: OwnerState,
seq: u64,View on GitHub (pinned to 73e0f67d83)