( ctx context.Context, mode database.NullChatPlanMode, logger slog.Logger, )
| 6806 | } |
| 6807 | |
| 6808 | func (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 | |
| 6833 | func userSkillContext(ctx context.Context, userID uuid.UUID) context.Context { |
| 6834 | actor := rbac.Subject{ |
no test coverage detected