unicity-aos/aos-ce · warning
aos-mcp: could not audit rejected hook message
Error message
aos-mcp: could not audit rejected hook message: {error} What it means
When capsule-mcp rejects a host hook message, it attempts to write an audit record (host, event, reason) via a logging/audit sink. If that audit write fails, it logs this warning; the message is still rejected. The warning exists so rejections remain auditable — losing the audit trail is the real concern, not the rejection itself.
Solutions
- Inspect the {error} in the log to identify the failing audit sink and fix its availability/configuration.
- Verify the audit sink credentials/permissions allow writes.
- Fall back to a secondary audit channel (stdout log capture) until the sink recovers.
- Re-audit manually if compliance requires a record of the rejection.
Example fix
// before
if let Err(error) = audit::record(&serde_json::json!({
"host": bounded_audit(host), "event": bounded_audit(event), "reason": reason,
})) {
log::warn(format!("aos-mcp: could not audit rejected hook message: {error}"));
}
// after
if let Err(error) = audit::record(&serde_json::json!({
"host": bounded_audit(host), "event": bounded_audit(event), "reason": reason,
})) {
log::warn(format!("aos-mcp: could not audit rejected hook message: {error}"));
log::info("AUDIT-FALLBACK host={host} event={event} reason={reason}");
} Defensive patterns
Strategy: fallback
Validate before calling
// verify audit sink writability before processing hooks let audit_ok = audit::health_check().is_ok();
Try / catch
if let Err(e) = audit::record(&payload) {
log::warn("audit write failed: {e}");
// emit to secondary log channel
} Prevention
- Health-check the audit sink at startup
- Keep a secondary audit channel (structured stdout)
- Monitor audit write failure rates
When it happens
Trigger: The audit sink call in reject() (invoked from handle and relay_response paths) returns Err after building the json!({host, event, reason}) payload — e.g., audit KV/log store unavailable or write rejected.
Common situations: Audit storage outage or quota exhaustion while hook messages are being rejected; misconfigured audit sink; host/event strings rejected by the sink.
Related errors
- aos-mcp: could not retire
- meta-harness: malformed canonical payload
- ingress pending read error for source_id
- grant pending read error for capsule_id
AI-assisted analysis of unicity-aos/aos-ce@f6f22024fb (2026-09-13).
Data as JSON: /api/errors/b5c93cbe58cfed8a.
Report an issue: GitHub.
Appendix: source
Thrown at capsules/capsule-mcp/src/host_hooks.rs:377
}
fn is_lower_hex(value: &str, expected_len: usize) -> bool {
value.len() == expected_len
&& value
.bytes()
.all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))
}
fn reject(host: &str, event: &str, reason: &str) {
if let Err(error) = ipc::publish_json(
"astrid.v1.audit.hook_ingress_rejected",
&serde_json::json!({
"host": bounded_audit(host),
"event": bounded_audit(event),
"reason": reason,
}),
) {
log::warn(format!(
"aos-mcp: could not audit rejected hook message: {error}"
));
}
}
fn bounded_audit(value: &str) -> &str {
let end = value.floor_char_boundary(value.len().min(128));
&value[..end]
}
#[cfg(test)]
mod tests {
use super::*;
fn request() -> HostHookRequest {
let token = "a".repeat(64);
let route_id = derive_route_id("codex", "codex-session", &token);
let correlation_id = "b".repeat(32);View on GitHub (pinned to f6f22024fb)