Hmbown/CodeWhale · error

Agent Mail accepts a bounded handoff summary, not a raw…

Error message

Agent Mail accepts a bounded handoff summary, not a raw transcript

What it means

Agent Mail envelope validation rejects a summary whose shape matches a raw transcript (the agent_mail_looks_like_raw_transcript heuristic): handoffs must be bounded, sanitized summaries, because full transcripts blow the message budget and leak unrelated context across threads.

Solutions

  1. Send a bounded, hand-authored summary instead of a pasted transcript.
  2. Trim the summary to the Agent Mail byte limit before submitting.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/runtime_threads.rs:6349 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/c90fa28e722860bb. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/runtime_threads.rs:6349

            return Ok(());
        }
        let continuation_index = u32::try_from(goal.continuation_count.max(1)).unwrap_or(u32::MAX);
        let snapshot = crate::tools::goal::GoalSnapshot::from_thread_goal(&goal);
        let prompt = crate::tools::goal::render_continuation_prompt(&snapshot, continuation_index);
        self.start_goal_turn(thread_id, prompt, continuation_index)
            .await?;
        Ok(())
    }

    /// Persist one canonical Agent Mail envelope in the runtime store. The
    /// caller-supplied id is an idempotency key: an exact replay returns the
    /// existing lifecycle record, while conflicting intent fails closed.
    pub async fn queue_agent_mail(
        &self,
        mut request: AgentMailSendRequest,
    ) -> Result<AgentMailSendResponse> {
        if agent_mail_looks_like_raw_transcript(&request.summary) {
            bail!("Agent Mail accepts a bounded handoff summary, not a raw transcript");
        }
        request.summary = sanitize_agent_mail_text(&request.summary, MAX_AGENT_MAIL_SUMMARY_BYTES);
        request.sender.display_label = sanitize_agent_mail_text(
            &request.sender.display_label,
            codewhale_protocol::agent_mail::MAX_AGENT_MAIL_DISPLAY_LABEL_BYTES,
        );
        for evidence in &mut request.evidence {
            if let Some(label) = evidence.label.as_mut() {
                *label = sanitize_agent_mail_text(
                    label,
                    codewhale_protocol::agent_mail::MAX_AGENT_MAIL_EVIDENCE_LABEL_BYTES,
                );
            }
        }
        request.validate().map_err(|error| anyhow!(error))?;
        if request.source_thread_id == request.destination_thread_id {
            bail!("Agent Mail source and destination threads must differ");
        }

View on GitHub (pinned to 73e0f67d83)