Files
coder/coderd/x/chatd/attempt.go
T
Cian Johnston b21e0717d5 feat: remove chat chain mode (#26980)
Removes OpenAI Responses "chain mode" from chatd. Closes CODAGT-445.

- Deletes `chatopenai/responses.go` (chain detection, activation, prompt filtering, response ID extraction) and its tests.
- Deletes the `ChainBroken` classification in `chaterror` and the chatloop retry bookkeeping that disabled chain mode mid-generation.
- Drops the `chain_broken` label from the `coderd_chatd_stream_retries_total` metric.
- Stops reading and writing `chat_messages.provider_response_id`
- Deletes the dead `ClearChatMessageProviderResponseIDsByChatID` query. Dropping the column is a follow-up migration.
- Deletes three chatloop hooks no caller sets (`ReloadMessages`, `DisableChainMode`, `PrepareMessages`), the dead `const AgentChatContextSentinelPath`, and stale chain-mode comments.

🤖 Generated by Coder Agents on behalf of @johnstcn.
2026-07-06 11:57:12 +01:00

64 lines
1.5 KiB
Go

package chatd
import (
"database/sql"
"time"
"charm.land/fantasy"
"github.com/coder/coder/v2/codersdk"
)
type runnerActionKind string
type runnerActionMessage struct {
ID int64
Role codersdk.ChatMessageRole
}
const (
runnerActionKindEnterRequiresAction runnerActionKind = "enter_requires_action"
runnerActionKindFinishTurn runnerActionKind = "finish_turn"
runnerActionKindFinishError runnerActionKind = "finish_error"
runnerActionKindFinishInterruption runnerActionKind = "finish_interruption"
)
// stepData is the durable content produced by one provider attempt.
type stepData struct {
Content []fantasy.Content
Usage fantasy.Usage
ContextLimit sql.NullInt64
Runtime time.Duration
ToolCallCreatedAt map[string]time.Time
ToolResultCreatedAt map[string]time.Time
ReasoningStartedAt []time.Time
ReasoningCompletedAt []time.Time
}
// pendingDynamicToolCall describes a dynamic tool call parked for a user.
type pendingDynamicToolCall struct {
ToolCallID string
ToolName string
Args string
}
// compactionOutcome contains a generated context summary.
type compactionOutcome struct {
SystemSummary string
SummaryReport string
ThresholdPercent int32
UsagePercent float64
ContextTokens int64
ContextLimit int64
}
type compactionStatus int
const (
compactionStatusNotNeeded compactionStatus = iota
compactionStatusNeeded
compactionStatusAfterCompaction
compactionStatusStillOverLimit
)