huskies: merge 822

This commit is contained in:
dave
2026-04-28 23:06:40 +00:00
parent b698cee284
commit 6092f7efbb
2 changed files with 107 additions and 1 deletions
+21 -1
View File
@@ -13,6 +13,26 @@ use tokio::sync::broadcast;
use super::super::super::{CompletionReport, PipelineStage, agent_config_stage, pipeline_stage};
use super::super::{AgentPool, StoryAgent};
/// Maximum number of bytes of gate output to include in the failure context
/// injected into the resumed session. Keeps the injected message focused —
/// the tail of the output (where errors appear) is always preserved.
const MAX_GATE_OUTPUT_BYTES: usize = 8_000;
/// Truncate gate output to [`MAX_GATE_OUTPUT_BYTES`], keeping the **tail**
/// (where compiler errors and test failures are reported).
fn truncate_gate_output(output: &str) -> &str {
if output.len() <= MAX_GATE_OUTPUT_BYTES {
return output;
}
let start = output.len() - MAX_GATE_OUTPUT_BYTES;
// Advance to the next valid UTF-8 char boundary.
let mut adjusted = start;
while !output.is_char_boundary(adjusted) {
adjusted += 1;
}
&output[adjusted..]
}
impl AgentPool {
/// Pipeline advancement: after an agent completes, move the story to
/// the next pipeline stage and start the appropriate agent.
@@ -197,7 +217,7 @@ impl AgentPool {
"\n\n---\n## Previous Attempt Failed\n\
The acceptance gates failed with the following output:\n{}\n\n\
Please review the failures above, fix the issues, and try again.",
completion.gate_output
truncate_gate_output(&completion.gate_output)
);
if let Err(e) = self
.start_agent(