fix(agents): drop unnecessary non-null assertion in fallback prelude formatter

Local default oxlint did not run --type-aware so the warning was missed
on the initial commit; CI surfaced it via check-lint. Hoist the heading
into a named const so its length is read directly without the assertion.
This commit is contained in:
stainlu
2026-04-26 16:50:30 +08:00
committed by Ayaan Zaidi
parent a96f1fa5ef
commit 9691399e53

View File

@@ -237,8 +237,9 @@ export function formatClaudeCliFallbackPrelude(
CLAUDE_CLI_FALLBACK_PRELUDE_MIN_TURN_CHARS,
options?.charBudget ?? CLAUDE_CLI_FALLBACK_PRELUDE_DEFAULT_CHAR_BUDGET,
);
const sections: string[] = ["## Prior session context (from claude-cli)"];
let remaining = charBudget - sections[0]!.length;
const heading = "## Prior session context (from claude-cli)";
const sections: string[] = [heading];
let remaining = charBudget - heading.length;
if (seed.summaryText) {
const summarySection = `\nSummary of earlier conversation:\n${seed.summaryText}`;
if (summarySection.length <= remaining) {