MCPcopy Create free account
hub / github.com/coder/coder / ShouldActivateChainMode

Function ShouldActivateChainMode

coderd/x/chatd/chatopenai/responses.go:188–201  ·  view source on GitHub ↗

ShouldActivateChainMode reports whether a follow-up turn can use previous_response_id instead of replaying history. It requires store=true, a matching model config, meaningful trailing user input, non-plan mode, complete local tool state, and confirmation that tool results were sent to the provider.

(
	providerOptions fantasy.ProviderOptions,
	info ChainModeInfo,
	modelConfigID uuid.UUID,
	isPlanModeTurn bool,
)

Source from the content-addressed store, hash-verified

186// complete local tool state, and confirmation that tool results were sent to
187// the provider.
188func ShouldActivateChainMode(
189 providerOptions fantasy.ProviderOptions,
190 info ChainModeInfo,
191 modelConfigID uuid.UUID,
192 isPlanModeTurn bool,
193) bool {
194 return IsResponsesStoreEnabled(providerOptions) &&
195 info.previousResponseID != "" &&
196 info.contributingTrailingUserCount > 0 &&
197 info.modelConfigID == modelConfigID &&
198 !isPlanModeTurn &&
199 !info.hasUnresolvedLocalToolCalls &&
200 !info.providerMissingToolResults
201}
202
203// ResolveChainMode scans DB messages from the end to inspect the current
204// trailing user turn and detect whether the immediately preceding assistant/tool

Calls 1

IsResponsesStoreEnabledFunction · 0.85