huskies: merge 822
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user