MCPcopy Index your code
hub / github.com/coder/coder / resolveContextLimit

Function resolveContextLimit

coderd/x/chatd/chatloop/compaction.go:261–272  ·  view source on GitHub ↗

resolveContextLimit picks the first positive value from metadata, configured limit, and fallback — in that priority order. Returns 0 when none are positive.

(metadataLimit, configLimit, fallback int64)

Source from the content-addressed store, hash-verified

259// configured limit, and fallback — in that priority order. Returns
260// 0 when none are positive.
261func resolveContextLimit(metadataLimit, configLimit, fallback int64) int64 {
262 if metadataLimit > 0 {
263 return metadataLimit
264 }
265 if configLimit > 0 {
266 return configLimit
267 }
268 if fallback > 0 {
269 return fallback
270 }
271 return 0
272}
273
274// shouldCompact returns the usage percentage and whether it exceeds
275// the threshold. Returns (0, false) when contextLimit is

Callers 1

tryCompactFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected