fix(subagent): cap truncated announce text to maxAnnounceChars
- Reserve space for truncation marker before slicing findings - Prevents final result from exceeding configured character limit - Addresses Codex review feedback on PR #46863 Before: findings.slice(max) + marker (exceeds max by marker length) After: findings.slice(max - marker.length) + marker (respects max)
This commit is contained in:
parent
30f0aa827d
commit
5b14950153
@ -1398,12 +1398,12 @@ export async function runSubagentAnnounceFlow(params: {
|
||||
});
|
||||
|
||||
// Apply maxAnnounceChars truncation if specified
|
||||
const TRUNCATION_MARKER = "\n\n[truncated — full output in transcript]";
|
||||
const truncatedFindings =
|
||||
typeof params.maxAnnounceChars === "number" &&
|
||||
params.maxAnnounceChars >= 1 &&
|
||||
findings.length > params.maxAnnounceChars
|
||||
? findings.slice(0, params.maxAnnounceChars) +
|
||||
"\n\n[truncated — full output in transcript]"
|
||||
? findings.slice(0, params.maxAnnounceChars - TRUNCATION_MARKER.length) + TRUNCATION_MARKER
|
||||
: findings;
|
||||
|
||||
const internalEvents: AgentInternalEvent[] = [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user