( ctx context.Context, logger slog.Logger, store database.Store, chatID uuid.UUID, parts []codersdk.ChatMessagePart, )
| 1207 | } |
| 1208 | |
| 1209 | func updateChildLastInjectedContext( |
| 1210 | ctx context.Context, |
| 1211 | logger slog.Logger, |
| 1212 | store database.Store, |
| 1213 | chatID uuid.UUID, |
| 1214 | parts []codersdk.ChatMessagePart, |
| 1215 | ) error { |
| 1216 | parts = FilterContextPartsToLatestAgent(parts) |
| 1217 | param, err := BuildLastInjectedContext(parts) |
| 1218 | if err != nil { |
| 1219 | logger.Warn(ctx, "failed to marshal inherited injected context", |
| 1220 | slog.F("chat_id", chatID), |
| 1221 | slog.Error(err), |
| 1222 | ) |
| 1223 | return xerrors.Errorf("marshal inherited injected context: %w", err) |
| 1224 | } |
| 1225 | if _, err := store.UpdateChatLastInjectedContext(ctx, database.UpdateChatLastInjectedContextParams{ |
| 1226 | ID: chatID, |
| 1227 | LastInjectedContext: param, |
| 1228 | }); err != nil { |
| 1229 | logger.Warn(ctx, "failed to update inherited injected context", |
| 1230 | slog.F("chat_id", chatID), |
| 1231 | slog.Error(err), |
| 1232 | ) |
| 1233 | return xerrors.Errorf("update inherited injected context: %w", err) |
| 1234 | } |
| 1235 | |
| 1236 | return nil |
| 1237 | } |
| 1238 | |
| 1239 | func (p *Server) sendSubagentMessage( |
| 1240 | ctx context.Context, |
no test coverage detected