fix(codeagent-wrapper): remove 150-char truncation limit for KeyOutput in summary mode

maxLen=0 in extractKeyOutputFromLines now means unlimited, so the
orchestrator receives the agent's full concluding summary instead of
a 150-character stub. Negative maxLen still returns empty. Structured
summary format and log-path-only behaviour are preserved.

Generated with SWE-Agent.ai

Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
cexll
2026-03-03 11:12:02 +08:00
parent 08877af530
commit 64886d36e0
3 changed files with 41 additions and 6 deletions

View File

@@ -479,11 +479,19 @@ func extractNumberBefore(s string, idx int) int {
}
// extractKeyOutputFromLines extracts key output from pre-split lines.
// maxLen=0 means unlimited; maxLen<0 returns "".
func extractKeyOutputFromLines(lines []string, maxLen int) string {
if len(lines) == 0 || maxLen <= 0 {
if len(lines) == 0 || maxLen < 0 {
return ""
}
mayTruncate := func(s string) string {
if maxLen == 0 {
return s
}
return safeTruncate(s, maxLen)
}
// Priority 1: Look for explicit summary lines
for _, line := range lines {
line = strings.TrimSpace(line)
@@ -498,7 +506,7 @@ func extractKeyOutputFromLines(lines []string, maxLen int) string {
}
content = strings.TrimSpace(content)
if len(content) > 0 {
return safeTruncate(content, maxLen)
return mayTruncate(content)
}
}
}
@@ -514,10 +522,10 @@ func extractKeyOutputFromLines(lines []string, maxLen int) string {
if len(line) < 20 {
continue
}
return safeTruncate(line, maxLen)
return mayTruncate(line)
}
// Fallback: truncate entire message
// Fallback: return entire message
clean := strings.TrimSpace(strings.Join(lines, "\n"))
return safeTruncate(clean, maxLen)
return mayTruncate(clean)
}