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

Method loadPlanModeInstructions

coderd/x/chatd/chatd.go:6808–6831  ·  view source on GitHub ↗
(
	ctx context.Context,
	mode database.NullChatPlanMode,
	logger slog.Logger,
)

Source from the content-addressed store, hash-verified

6806}
6807
6808func (p *Server) loadPlanModeInstructions(
6809 ctx context.Context,
6810 mode database.NullChatPlanMode,
6811 logger slog.Logger,
6812) string {
6813 if !mode.Valid || mode.ChatPlanMode != database.ChatPlanModePlan {
6814 return ""
6815 }
6816
6817 // Plan-mode instructions live in deployment config, but chat workers do
6818 // not carry a deployment-config actor during background execution.
6819 //nolint:gocritic // Required to read deployment config during background chat processing.
6820 systemCtx := dbauthz.AsSystemRestricted(ctx)
6821 fetched, err := p.db.GetChatPlanModeInstructions(systemCtx)
6822 if err != nil {
6823 logger.Warn(ctx,
6824 "failed to fetch plan mode instructions",
6825 slog.Error(err),
6826 )
6827 return ""
6828 }
6829
6830 return fetched
6831}
6832
6833func userSkillContext(ctx context.Context, userID uuid.UUID) context.Context {
6834 actor := rbac.Subject{

Callers 1

runChatMethod · 0.95

Calls 3

AsSystemRestrictedFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected