self-run: repair the task cut function

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-31 05:47:23 +01:00
commit 0e182237fd

View file

@ -133,8 +133,19 @@ fn task_section(mind: &dyn MindPort, claims: &[PipelineRef]) -> String {
}
cut_at(task, TASK_LIMIT)
}
/// `text` cut at a character boundary to `limit` bytes, marked when cut.fn cut_at(mut text: String, limit: usize) -> String { if text.len() > limit { let mut end = limit; while !text.is_char_boundary(end) { end -= 1; } text.truncate(end); text.push_str("
[task truncated]"); } text}
/// `text` cut at a character boundary to `limit` bytes, marked when cut.
fn cut_at(mut text: String, limit: usize) -> String {
if text.len() > limit {
let mut end = limit;
while !text.is_char_boundary(end) {
end -= 1;
}
text.truncate(end);
text.push_str("\n[task truncated]");
}
text
}
/// What the child is told once, at the context ceiling.
pub const FLUSH_MESSAGE: &str = "The context ceiling is reached. Admit to the mind what it lacks, close your run, and end.";