MCPcopy Create free account
hub / github.com/codehamr/codehamr / onlyNonSubstantive

Function onlyNonSubstantive

internal/ctx/ctx.go:300–311  ·  view source on GitHub ↗

onlyNonSubstantive reports whether kept carries no substantive conversation: only system-role notes (soft nudges) and empty assistant messages (no text, no tool calls - the stall shape the empty-reply nudge answers, appended right before that nudge). Vacuously true for an empty slice.

(kept []Message)

Source from the content-addressed store, hash-verified

298func newestToolIndex(history []Message) int {
299 for i := len(history) - 1; i >= 0; i-- {
300 if history[i].Role == RoleTool {
301 return i
302 }
303 }
304 return -1
305}
306
307// onlyNonSubstantive reports whether kept carries no substantive conversation:
308// only system-role notes (soft nudges) and empty assistant messages (no text,
309// no tool calls - the stall shape the empty-reply nudge answers, appended
310// right before that nudge). TrimSpace matches tui.newestAssistantEmpty's
311// definition of "empty", so a whitespace-only stall can't mask the recovery.
312// Vacuously true for an empty slice.
313func onlyNonSubstantive(kept []Message) bool {
314 for _, m := range kept {

Callers 1

PackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected