{"record":{"id":"c90fa28e722860bb","repo":"Hmbown/CodeWhale","slug":"agent-mail-accepts-a-bounded-handoff-summary-not","errorCode":null,"errorMessage":"Agent Mail accepts a bounded handoff summary, not a raw transcript","messagePattern":"Agent Mail accepts a bounded handoff summary, not a raw transcript","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":6349,"sourceCode":"            return Ok(());\n        }\n        let continuation_index = u32::try_from(goal.continuation_count.max(1)).unwrap_or(u32::MAX);\n        let snapshot = crate::tools::goal::GoalSnapshot::from_thread_goal(&goal);\n        let prompt = crate::tools::goal::render_continuation_prompt(&snapshot, continuation_index);\n        self.start_goal_turn(thread_id, prompt, continuation_index)\n            .await?;\n        Ok(())\n    }\n\n    /// Persist one canonical Agent Mail envelope in the runtime store. The\n    /// caller-supplied id is an idempotency key: an exact replay returns the\n    /// existing lifecycle record, while conflicting intent fails closed.\n    pub async fn queue_agent_mail(\n        &self,\n        mut request: AgentMailSendRequest,\n    ) -> Result<AgentMailSendResponse> {\n        if agent_mail_looks_like_raw_transcript(&request.summary) {\n            bail!(\"Agent Mail accepts a bounded handoff summary, not a raw transcript\");\n        }\n        request.summary = sanitize_agent_mail_text(&request.summary, MAX_AGENT_MAIL_SUMMARY_BYTES);\n        request.sender.display_label = sanitize_agent_mail_text(\n            &request.sender.display_label,\n            codewhale_protocol::agent_mail::MAX_AGENT_MAIL_DISPLAY_LABEL_BYTES,\n        );\n        for evidence in &mut request.evidence {\n            if let Some(label) = evidence.label.as_mut() {\n                *label = sanitize_agent_mail_text(\n                    label,\n                    codewhale_protocol::agent_mail::MAX_AGENT_MAIL_EVIDENCE_LABEL_BYTES,\n                );\n            }\n        }\n        request.validate().map_err(|error| anyhow!(error))?;\n        if request.source_thread_id == request.destination_thread_id {\n            bail!(\"Agent Mail source and destination threads must differ\");\n        }","sourceCodeStart":6331,"sourceCodeEnd":6367,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L6331-L6367","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/runtime_threads.rs:6349 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a bounded, hand-authored summary instead of a pasted transcript.","Trim the summary to the Agent Mail byte limit before submitting."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}