mirror of
https://github.com/coder/coder.git
synced 2026-09-22 21:22:17 +08:00
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.
64 lines
1.5 KiB
Go
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
|
|
)
|